Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: values changes #1652

Merged
merged 4 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4,690 changes: 0 additions & 4,690 deletions chart/otomi/values.schema.json

This file was deleted.

2 changes: 1 addition & 1 deletion helmfile.d/snippets/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ environments:
obj:
provider:
type: disabled
bucket:
merll marked this conversation as resolved.
Show resolved Hide resolved
buckets:
loki: loki
cnpg: cnpg
velero: velero
Expand Down
3 changes: 1 addition & 2 deletions src/cmd/bootstrap.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,13 @@ describe('Bootstrapping values', () => {
const res = await getStoredClusterSecrets(deps)
expect(res).toEqual(undefined)
})
it('should set apiName, k8sContext and owner if needed', async () => {
it('should set k8sContext and owner if needed', async () => {
deps.processValues.mockReturnValue(values)
deps.hfValues.mockReturnValue(values)
await bootstrap(deps)
expect(deps.writeValues).toHaveBeenCalledWith(
expect.objectContaining({
cluster: expect.objectContaining({
apiName: expect.any(String),
k8sContext: expect.any(String),
owner: expect.any(String),
}),
Expand Down
10 changes: 3 additions & 7 deletions src/cmd/bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -371,19 +371,15 @@ export const bootstrap = async (
}
const finalValues = (await deps.hfValues()) as Record<string, any>
const {
cluster: { apiName, k8sContext, name, owner, provider },
cluster: { k8sContext, name, owner, provider },
} = finalValues
// we can derive defaults for the following values
// that we want to end up in the files, so the api can access them
if (!k8sContext || !apiName || !owner) {
if (!k8sContext || !owner) {
const add: Record<string, any> = { cluster: {} }
const engine = providerMap(provider as string)
const defaultOwner = 'otomi'
const defaultOwner = 'apl'
const defaultName = `${owner || defaultOwner}-${engine}-${name}`
if (!apiName) {
d.info(`No value for cluster.apiName found, providing default one: ${defaultName}`)
add.cluster.apiName = defaultName
}
if (!k8sContext) {
d.info(`No value for cluster.k8sContext found, providing default one: ${defaultName}`)
add.cluster.k8sContext = defaultName
Expand Down
6 changes: 3 additions & 3 deletions tests/fixtures/env/cluster.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cluster:
apiServer: https://1.1.1.1:8443
domainSuffix: demo.eks.otomi.cloud
k8sContext: otomi-eks-demo
domainSuffix: dev.linode-apl.net
k8sContext: linode-dev
name: demo
owner: redkubes
owner: akamai
provider: linode
12 changes: 6 additions & 6 deletions tests/fixtures/env/settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,12 @@ platformBackups:
gitea:
enabled: false
obj:
bucket:
merll marked this conversation as resolved.
Show resolved Hide resolved
loki: loki
cnpg: cnpg
velero: velero
harbor: harbor
tempo: tempo
buckets:
loki: my-clusterid-loki
cnpg: my-clusterid-cnpg
velero: my-clusterid-velero
harbor: my-clusterid-harbor
tempo: my-clusterid-tempo
provider:
# type: minioLocal
linode:
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/env/teams/services.admin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ teamConfig:
admin:
services:
- auth: true
domain: hello.team-admin.demo.eks.otomi.cloud
domain: hello.team-admin.dev.linode-apl.net
id: cb5149c4-8ea5-4c5a-be04-a37258658bd0
name: hello-admin
ownHost: true
Expand Down
4 changes: 2 additions & 2 deletions tests/fixtures/env/teams/services.demo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ teamConfig:
demo:
services:
- auth: true
domain: hello.team-demo.demo.eks.otomi.cloud
domain: hello.team-demo.dev.linode-apl.net
headers:
response:
set:
Expand All @@ -26,7 +26,7 @@ teamConfig:
enabled: true
weightV1: 70
weightV2: 30
- domain: tlspass.eks.dev.otomi.cloud
- domain: tlspass.dev.linode-apl.net
id: cb5149c4-8ea5-4c5a-be04-a37258658bd4
ksvc:
predeployed: true
Expand Down
22 changes: 21 additions & 1 deletion values-changes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -250,4 +250,24 @@ changes:
- 'teamConfig.{team}.apps.prometheus.shortcuts'
- 'teamConfig.{team}.apps.rabbitmq.shortcuts'
- 'teamConfig.{team}.apps.sealed-secrets.shortcuts'
- 'teamConfig.{team}.apps.tempo.shortcuts'
- 'teamConfig.{team}.apps.tempo.shortcuts'
- version: 25
deletions:
- 'ingress.platformClass.loadBalancerRG'
- 'ingress.platformClass.loadBalancerSubnet'
- 'azure.monitor'
- 'cluster.apiName'
- 'cluster.region'
- 'teamConfig.{team}.azureMonitor'
- 'apps.cluster-autoscaler'
- 'apps.cluster-overprovisioner'
- 'apps.harbor.persistence'
- 'apps.ingress-azure'
- 'apps.kube-descheduler'
- 'apps.loki.storage'
- 'apps.tempo.storage'
- 'apps.velero.cloud'
- 'apps.velero.storage'
- 'platformBackups.persistentVolumes.drone'
- 'platformBackups.persistentVolumes.harbor'
- 'platformBackups.persistentVolumes.keycloak'
23 changes: 22 additions & 1 deletion values-schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2959,7 +2959,28 @@ properties:
- linode
- disabled
default: disabled

buckets:
properties:
loki:
type: string
$ref: '#/definitions/wordCharacterPattern'
default: loki
cnpg:
type: string
$ref: '#/definitions/wordCharacterPattern'
default: cnpg
velero:
type: string
$ref: '#/definitions/wordCharacterPattern'
default: velero
harbor:
type: string
$ref: '#/definitions/wordCharacterPattern'
default: harbor
tempo:
type: string
$ref: '#/definitions/wordCharacterPattern'
default: tempo
databases:
properties:
keycloak:
Expand Down
2 changes: 1 addition & 1 deletion values/gitea/gitea-otomi-db.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{{- $cnpg := $v.apps.cnpg }}
{{- $gdb := $v.databases.gitea }}
{{- $obj := $v.obj.provider }}
{{- $bu := $v.obj.bucket }}
{{- $bu := $v.obj.buckets }}
{{- $b := $v.platformBackups.database.gitea }}

name: gitea-db
Expand Down
2 changes: 1 addition & 1 deletion values/harbor/harbor-otomi-db.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{{- $hdb := $v.databases.harbor }}
{{- $cnpg := $v.apps.cnpg }}
{{- $obj := $v.obj.provider }}
{{- $bu := $v.obj.bucket }}
{{- $bu := $v.obj.buckets }}
{{- $b := $v.platformBackups.database.harbor }}

name: harbor-otomi-db
Expand Down
2 changes: 1 addition & 1 deletion values/harbor/harbor.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{{- $h := $v.apps.harbor }}
{{- $db := $v.databases.harbor }}
{{- $obj := $v.obj.provider }}
{{- $bu := $v.obj.bucket }}
{{- $bu := $v.obj.buckets }}
{{- $harborDomain := printf "harbor.%s" $v.cluster.domainSuffix }}
{{- $notaryDomain := printf "notary.%s" $v.cluster.domainSuffix }}
{{- $harborSecretName := ($harborDomain | replace "." "-") }}
Expand Down
2 changes: 1 addition & 1 deletion values/keycloak/keycloak-otomi-db.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{{- $sp := $cnpg.storage }}
{{- $kdb := $v.databases.keycloak }}
{{- $obj := $v.obj.provider }}
{{- $bu := $v.obj.bucket }}
{{- $bu := $v.obj.buckets }}
{{- $b := $v.platformBackups.database.keycloak }}

name: keycloak-db
Expand Down
2 changes: 1 addition & 1 deletion values/loki/loki.gotmpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{- $v := .Values -}}
{{- $l:= $v.apps.loki }}
{{- $obj := $v.obj.provider }}
{{- $bu := $v.obj.bucket }}
{{- $bu := $v.obj.buckets }}

nameOverride: loki

Expand Down
2 changes: 1 addition & 1 deletion values/tempo/tempo.gotmpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{- $v := .Values -}}
{{- $t:= $v.apps.tempo }}
{{- $obj := $v.obj.provider }}
{{- $bu := $v.obj.bucket }}
{{- $bu := $v.obj.buckets }}


fullnameOverride: tempo
Expand Down
2 changes: 1 addition & 1 deletion values/velero/velero.gotmpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{- $v := .Values }}
{{- $vl := $v.apps.velero }}
{{- $obj := $v.obj.provider }}
{{- $bu := $v.obj.bucket }}
{{- $bu := $v.obj.buckets }}
{{- $b := $v.platformBackups.persistentVolumes }}

resources: {{- $vl.resources | toYaml | nindent 2 }}
Expand Down
6 changes: 3 additions & 3 deletions versions.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
api: sr-storage-backup-refactor
console: sr-storage-backup-refactor
tasks: 2.5.0
api: main
console: main
tasks: main
tools: 1.6.4