Skip to content

Commit

Permalink
fix: bucket only linode (#1703)
Browse files Browse the repository at this point in the history
Co-authored-by: Jehoszafat Zimnowoda <17126497+j-zimnowoda@users.noreply.github.com>
  • Loading branch information
srodenhuis and j-zimnowoda authored Sep 6, 2024
1 parent 9af2bc6 commit 6ace30c
Show file tree
Hide file tree
Showing 11 changed files with 46 additions and 91 deletions.
9 changes: 0 additions & 9 deletions helmfile.d/snippets/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -786,12 +786,6 @@ environments:
obj:
provider:
type: disabled
buckets:
loki: loki
cnpg: cnpg
velero: velero
harbor: harbor
tempo: tempo
platformBackups:
database:
harbor:
Expand All @@ -800,9 +794,6 @@ environments:
enabled: false
keycloak:
enabled: false
persistentVolumes:
gitea:
enabled: false
cluster:
provider: linode
name: apl
Expand Down
15 changes: 6 additions & 9 deletions tests/fixtures/env/settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,16 @@ kms:
keys: somesecretvalue
tenantId: somesecretvalue
obj:
buckets:
cnpg: my-clusterid-cnpg
harbor: my-clusterid-harbor
loki: my-clusterid-loki
tempo: my-clusterid-tempo
velero: my-clusterid-velero
provider:
linode:
accessKeyId: someaccessKeyId
region: nl-ams-1
buckets:
cnpg: my-clusterid-cnpg
harbor: my-clusterid-harbor
loki: my-clusterid-loki
tempo: my-clusterid-tempo
velero: my-clusterid-velero
type: linode
oidc:
adminGroupID: someAdminGroupID
Expand Down Expand Up @@ -88,9 +88,6 @@ platformBackups:
enabled: true
retentionPolicy: 7d
schedule: 0 0 0 * * *
persistentVolumes:
gitea:
enabled: false
smtp:
auth_username: no-reply@doma.in
from: no-reply@doma.in
Expand Down
2 changes: 2 additions & 0 deletions values-changes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,8 @@ changes:
- version: 28
deletions:
- 'apps.cnpg.storage'
- 'obj.buckets'
- 'platformBackups.persistentVolumes.gitea'
- 'alerts.drone'
- 'otomi.isHomeMonitored'
- 'home'
Expand Down
55 changes: 22 additions & 33 deletions values-schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2894,22 +2894,11 @@ properties:
description: Linode API Token
$ref: '#/definitions/wordCharacterPattern'
x-secret: ''
gitea:
title: Gitea
properties:
enabled:
type: boolean
default: false
ttl:
$ref: '#/definitions/backupTtl'
schedule:
$ref: '#/definitions/backupSchedule'
obj:
properties:
provider:
properties:
linode:
additionalProperties: false
properties:
region:
description: The region of the bucket
Expand All @@ -2923,6 +2912,28 @@ properties:
description: The secret of the access key
$ref: '#/definitions/wordCharacterPattern'
x-secret: ''
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
required:
- region
- accessKeyId
Expand All @@ -2934,28 +2945,6 @@ 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
7 changes: 3 additions & 4 deletions values/gitea/gitea-otomi-db.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
{{- $cnpg := $v.apps.cnpg }}
{{- $gdb := $v.databases.gitea }}
{{- $obj := $v.obj.provider }}
{{- $bu := $v.obj.buckets }}
{{- $b := $v.platformBackups.database.gitea }}

name: gitea-db
Expand All @@ -20,12 +19,12 @@ backup:
type: {{ $obj.type }}
{{- if eq $obj.type "minioLocal" }}
minioLocal:
destinationPath: "s3://{{ $bu.cnpg }}/gitea"
destinationPath: "s3://cnpg/gitea"
{{- end }}
{{- if eq $obj.type "linode" }}
linode:
destinationPath: "s3://{{ $bu.cnpg }}/gitea"
endpointURL: https://{{ $bu.cnpg }}.{{ $obj.linode.region }}.linodeobjects.com
destinationPath: "s3://{{ $obj.linode.buckets.cnpg }}/gitea"
endpointURL: https://{{ $obj.linode.buckets.cnpg }}.{{ $obj.linode.region }}.linodeobjects.com
{{- end }}
{{- end }}
{{- end }}
Expand Down
7 changes: 3 additions & 4 deletions values/harbor/harbor-otomi-db.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
{{- $hdb := $v.databases.harbor }}
{{- $cnpg := $v.apps.cnpg }}
{{- $obj := $v.obj.provider }}
{{- $bu := $v.obj.buckets }}
{{- $b := $v.platformBackups.database.harbor }}

name: harbor-otomi-db
Expand All @@ -19,12 +18,12 @@ backup:
type: {{ $obj.type }}
{{- if eq $obj.type "minioLocal" }}
minioLocal:
destinationPath: "s3://{{ $bu.cnpg }}/harbor"
destinationPath: "s3://cnpg/harbor"
{{- end }}
{{- if eq $obj.type "linode" }}
linode:
destinationPath: "s3://{{ $bu.cnpg }}/harbor"
endpointURL: https://{{ $bu.cnpg }}.{{ $obj.linode.region }}.linodeobjects.com
destinationPath: "s3://{{ $obj.linode.buckets.cnpg }}/harbor"
endpointURL: https://{{ $obj.linode.buckets.cnpg }}.{{ $obj.linode.region }}.linodeobjects.com
{{- end }}
{{- end }}
{{- end }}
Expand Down
3 changes: 1 addition & 2 deletions values/harbor/harbor.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
{{- $h := $v.apps.harbor }}
{{- $db := $v.databases.harbor }}
{{- $obj := $v.obj.provider }}
{{- $bu := $v.obj.buckets }}
{{- $harborDomain := printf "harbor.%s" $v.cluster.domainSuffix }}
{{- $notaryDomain := printf "notary.%s" $v.cluster.domainSuffix }}
{{- $harborSecretName := ($harborDomain | replace "." "-") }}
Expand Down Expand Up @@ -183,7 +182,7 @@ persistence:
v4auth: true
{{- end }}
{{- if eq $obj.type "linode" }}
bucket: {{ $bu.harbor }}
bucket: {{ $obj.linode.buckets.harbor }}
regionendpoint: https://{{ $obj.linode.region }}.linodeobjects.com
accesskey: {{ $obj.linode.accessKeyId }}
secretkey: {{ $obj.linode.secretAccessKey }}
Expand Down
7 changes: 3 additions & 4 deletions values/keycloak/keycloak-otomi-db.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
{{- $cnpg := $v.apps.cnpg }}
{{- $kdb := $v.databases.keycloak }}
{{- $obj := $v.obj.provider }}
{{- $bu := $v.obj.buckets }}
{{- $b := $v.platformBackups.database.keycloak }}

name: keycloak-db
Expand All @@ -20,12 +19,12 @@ backup:
type: {{ $obj.type }}
{{- if eq $obj.type "minioLocal" }}
minioLocal:
destinationPath: "s3://{{ $bu.cnpg }}/keycloak"
destinationPath: "s3://cnpg/keycloak"
{{- end }}
{{- if eq $obj.type "linode" }}
linode:
destinationPath: "s3://{{ $bu.cnpg }}/keycloak"
endpointURL: https://{{ $bu.cnpg }}.{{ $obj.linode.region }}.linodeobjects.com
destinationPath: "s3://{{ $obj.linode.buckets.cnpg }}/keycloak"
endpointURL: https://{{ $obj.linode.buckets.cnpg }}.{{ $obj.linode.region }}.linodeobjects.com
{{- end }}
{{- end }}
{{- end }}
Expand Down
5 changes: 2 additions & 3 deletions values/loki/loki.gotmpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{{- $v := .Values -}}
{{- $l:= $v.apps.loki }}
{{- $obj := $v.obj.provider }}
{{- $bu := $v.obj.buckets }}
{{- $useObjectStorage := eq $obj.type "minioLocal" "linode" }}

nameOverride: loki
Expand Down Expand Up @@ -51,11 +50,11 @@ loki:
{{- if $useObjectStorage }}
aws:
{{- if eq $obj.type "minioLocal" }}
s3: http://otomi-admin:{{ $v.otomi.adminPassword }}@minio.minio.svc.cluster.local.:9000/{{ $bu.loki }}
s3: http://otomi-admin:{{ $v.otomi.adminPassword }}@minio.minio.svc.cluster.local.:9000/loki
s3forcepathstyle: true
{{- end }}
{{- if eq $obj.type "linode" }}
s3: https://{{ $obj.linode.accessKeyId }}:{{ $obj.linode.secretAccessKey }}@{{ $obj.linode.region }}.linodeobjects.com/{{ $bu.loki }}
s3: https://{{ $obj.linode.accessKeyId }}:{{ $obj.linode.secretAccessKey }}@{{ $obj.linode.region }}.linodeobjects.com/{{ $obj.linode.buckets.loki }}
s3forcepathstyle: true
sse_encryption: false
http_config:
Expand Down
3 changes: 1 addition & 2 deletions values/tempo/tempo.gotmpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{{- $v := .Values -}}
{{- $t:= $v.apps.tempo }}
{{- $obj := $v.obj.provider }}
{{- $bu := $v.obj.buckets }}


fullnameOverride: tempo
Expand Down Expand Up @@ -80,7 +79,7 @@ storage:
{{- end }}
{{- if eq $obj.type "linode" }}
s3:
bucket: {{ $bu.tempo }}
bucket: {{ $obj.linode.buckets.tempo }}
endpoint: {{ $obj.linode.region }}.linodeobjects.com
access_key: {{ $obj.linode.accessKeyId }}
secret_key: {{ $obj.linode.secretAccessKey }}
Expand Down
24 changes: 3 additions & 21 deletions values/velero/velero.gotmpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{{- $v := .Values }}
{{- $vl := $v.apps.velero }}
{{- $obj := $v.obj.provider }}
{{- $bu := $v.obj.buckets }}
{{- $b := $v.platformBackups.persistentVolumes }}

resources: {{- $vl.resources | toYaml | nindent 2 }}
Expand Down Expand Up @@ -64,7 +63,7 @@ configuration:
- name: apl-minio
provider: aws
default: true
bucket: {{ $bu.velero}}
bucket: velero
config:
s3Url: http://minio.minio.svc.cluster.local:9000
publicUrl: http://minio.minio.svc.cluster.local:9000
Expand All @@ -76,7 +75,7 @@ configuration:
- name: apl-linode
provider: aws
default: true
bucket: {{ $bu.velero }}
bucket: {{ $obj.linode.buckets.velero }}
config:
s3Url: https://{{ $obj.linode.region }}.linodeobjects.com
region: {{ $obj.linode.region }}
Expand Down Expand Up @@ -131,21 +130,4 @@ deployNodeAgent: {{ $vl.restic.enabled }}
nodeAgent:
podSecurityContext:
runAsUser: 1338
fsGroup: 1338

{{- if $b.gitea.enabled }}
schedules:
gitea:
disabled: false
schedule: {{ $b.gitea.schedule }}
useOwnerReferencesInBackup: false
template:
ttl: {{ $b.gitea.ttl }}
includedNamespaces:
- gitea
includedResources:
- pv
- pvc
includeClusterResources: true
storageLocation: apl
{{- end }}
fsGroup: 1338

0 comments on commit 6ace30c

Please sign in to comment.