|
1 | | -import { CoreV1Api, User as k8sUser, KubeConfig, V1ObjectReference } from '@kubernetes/client-node' |
| 1 | +import { CoreV1Api, KubeConfig, User as k8sUser, V1ObjectReference } from '@kubernetes/client-node' |
2 | 2 | import Debug from 'debug' |
3 | 3 |
|
4 | 4 | import { getRegions, ObjectStorageKeyRegions } from '@linode/api-v4' |
@@ -295,10 +295,21 @@ export default class OtomiStack { |
295 | 295 |
|
296 | 296 | getSettingsInfo(): SettingsInfo { |
297 | 297 | const settings = this.getSettings(['cluster', 'dns', 'otomi', 'smtp', 'ingress']) |
| 298 | + const otomiInfo = pick(settings.otomi, [ |
| 299 | + 'hasExternalDNS', |
| 300 | + 'hasExternalIDP', |
| 301 | + 'isPreInstalled', |
| 302 | + 'aiEnabled', |
| 303 | + 'git.repoUrl', |
| 304 | + 'git.branch', |
| 305 | + ]) |
| 306 | + if (otomiInfo.git?.repoUrl?.includes('gitea-http.gitea.svc.cluster.local')) { |
| 307 | + otomiInfo.git.repoUrl = `https://gitea.${settings.cluster?.domainSuffix}/otomi/values` |
| 308 | + } |
298 | 309 | return { |
299 | 310 | cluster: pick(settings.cluster, ['name', 'domainSuffix', 'apiServer', 'provider', 'linode']), |
300 | 311 | dns: pick(settings.dns, ['zones']), |
301 | | - otomi: pick(settings.otomi, ['hasExternalDNS', 'hasExternalIDP', 'isPreInstalled', 'aiEnabled']), |
| 312 | + otomi: otomiInfo, |
302 | 313 | smtp: pick(settings.smtp, ['smarthost']), |
303 | 314 | ingressClassNames: map(settings.ingress?.classes, 'className') ?? [], |
304 | 315 | } as SettingsInfo |
@@ -1292,10 +1303,11 @@ export default class OtomiStack { |
1292 | 1303 |
|
1293 | 1304 | async getInternalRepoUrls(teamId: string): Promise<string[]> { |
1294 | 1305 | if (env.isDev || !teamId || teamId === 'admin') return [] |
1295 | | - const { cluster, otomi } = this.getSettings(['cluster', 'otomi']) |
1296 | 1306 | const gitea = this.getApp('gitea') |
1297 | | - const username = (gitea?.values?.adminUsername ?? '') as string |
1298 | | - const password = (gitea?.values?.adminPassword ?? otomi?.adminPassword ?? '') as string |
| 1307 | + if (!gitea?.values?.enabled) return [] |
| 1308 | + const { cluster, otomi } = this.getSettings(['cluster', 'otomi']) |
| 1309 | + const username = (otomi?.git?.username ?? '') as string |
| 1310 | + const password = (otomi?.git?.password ?? '') as string |
1299 | 1311 | const orgName = `team-${teamId}` |
1300 | 1312 | const domainSuffix = cluster?.domainSuffix |
1301 | 1313 | const internalRepoUrls = (await getGiteaRepoUrls(username, password, orgName, domainSuffix)) || [] |
|
0 commit comments