Skip to content

Commit 7be41e2

Browse files
merllAni1357
authored andcommitted
feat: cnpg recovery options (#1926)
Co-authored-by: Ani Argjiri <[email protected]> Co-authored-by: jeho <[email protected]> (cherry picked from commit 98d8bfe)
1 parent 6261689 commit 7be41e2

12 files changed

+120
-158
lines changed

charts/otomi-db/values.yaml

+2-19
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,8 @@ clusterAffinity:
2121
topologyKey: kubernetes.io/hostname
2222
podAntiAffinityType: preferred
2323

24-
# Example for backups:
25-
# clusterBackup:
26-
# backup:
27-
# barmanObjectStore:
28-
# destinationPath: s3://bucket/
29-
# endpointURL: "http://minio.minio.svc.cluster.local:9000"
30-
# s3Credentials:
31-
# accessKeyId:
32-
# name: minio-creds
33-
# key: MINIO_ACCESS_KEY
34-
# secretAccessKey:
35-
# name: minio-creds
36-
# key: MINIO_SECRET_KEY
37-
3824
clusterSpec:
39-
bootstrap:
40-
initdb:
41-
database: app
42-
owner: app
25+
bootstrap: {}
4326

4427
backup:
4528
enabled: false
@@ -53,4 +36,4 @@ backup:
5336
minioLocal:
5437
destinationPath: ""
5538
linode:
56-
destinationPath: ""
39+
destinationPath: ""

helmfile.d/helmfile-03.init.yaml

+7-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ releases:
1717
namespace: argocd
1818
labels:
1919
app: core
20-
<<: *default
20+
<<: *default
2121
- name: otomi-operator
2222
installed: true
2323
namespace: otomi-operator
@@ -57,6 +57,12 @@ releases:
5757
pkg: apl-gitea-operator
5858
app: core
5959
<<: *default
60+
- name: harbor-artifacts
61+
installed: {{ $a | get "harbor.enabled" }}
62+
namespace: harbor
63+
labels:
64+
pkg: harbor
65+
<<: *raw
6066
- name: apl-harbor-operator-artifacts
6167
installed: {{ $a | get "harbor.enabled" }}
6268
namespace: apl-harbor-operator

helmfile.d/helmfile-04.databases.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ releases:
2727
pkg: keycloak
2828
<<: *otomiDb
2929
- name: gitea-otomi-db
30-
installed: {{ or $v.databases.gitea.useOtomiDB $v.databases.gitea.imported }}
30+
installed: true
3131
namespace: gitea
3232
labels:
3333
pkg: gitea

helmfile.d/helmfile-09.init.yaml

+1-9
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ bases:
1010
{{ readFile "snippets/templates.gotmpl" }}
1111
{{- $v := .Values }}
1212
{{- $a := $v.apps }}
13-
{{- $h := $a.harbor }}
14-
{{- $k := $a.keycloak }}
1513

1614
releases:
1715
- name: knative-serving-artifacts
@@ -40,12 +38,6 @@ releases:
4038
labels:
4139
pkg: minio
4240
<<: *default
43-
- name: harbor-artifacts
44-
installed: {{ $h | get "enabled" }}
45-
namespace: harbor
46-
labels:
47-
pkg: harbor
48-
<<: *raw
4941
- name: tekton-triggers
5042
installed: true
5143
namespace: tekton-pipelines
@@ -58,4 +50,4 @@ releases:
5850
namespace: otomi-pipelines
5951
labels:
6052
app: core
61-
<<: *default
53+
<<: *default

helmfile.d/snippets/defaults.yaml

+21-7
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ environments:
1414
memory: 64Mi
1515
limits:
1616
cpu: 200m
17-
memory: 256Mi
17+
memory: 256Mi
1818
_rawValues: {}
1919
argocd:
2020
controllerStatusProcessors: 20
@@ -249,7 +249,7 @@ environments:
249249
condition: (
250250
container.image.repository in (
251251
docker.io/gitea/gitea
252-
) or (k8s.ns.name = "keycloak")
252+
) or (k8s.ns.name = "keycloak")
253253
)
254254
- macro: user_known_create_files_below_dev_activities
255255
condition: (
@@ -881,7 +881,7 @@ environments:
881881
cpu: 100m
882882
memory: 256Mi
883883
persistence:
884-
master:
884+
master:
885885
size: 1Gi
886886
sentinel:
887887
size: 1Gi
@@ -1037,7 +1037,7 @@ environments:
10371037
memory: 24Mi
10381038
limits:
10391039
cpu: 100m
1040-
memory: 128Mi
1040+
memory: 128Mi
10411041
_rawValues: {}
10421042
otel:
10431043
enabled: false
@@ -1261,9 +1261,10 @@ environments:
12611261
databases:
12621262
keycloak:
12631263
imageName: null
1264-
imported: false
12651264
size: 5Gi
12661265
replicas: 2
1266+
recovery: {}
1267+
externalClusters: []
12671268
resources:
12681269
limits:
12691270
cpu: "200m"
@@ -1276,6 +1277,8 @@ environments:
12761277
size: 5Gi
12771278
replicas: 2
12781279
coreDatabase: registry
1280+
recovery: {}
1281+
externalClusters: []
12791282
resources:
12801283
limits:
12811284
cpu: "200m"
@@ -1285,10 +1288,10 @@ environments:
12851288
memory: 192Mi
12861289
gitea:
12871290
imageName: null
1288-
useOtomiDB: true
1289-
imported: false
12901291
size: 5Gi
12911292
replicas: 2
1293+
recovery: {}
1294+
externalClusters: []
12921295
resources:
12931296
limits:
12941297
cpu: "200m"
@@ -1303,12 +1306,23 @@ environments:
13031306
database:
13041307
harbor:
13051308
enabled: false
1309+
retentionPolicy: 7d
1310+
schedule: 0 0 * * *
1311+
pathSuffix: harbor
13061312
gitea:
13071313
enabled: false
1314+
retentionPolicy: 7d
1315+
schedule: 0 0 * * *
1316+
pathSuffix: gitea
13081317
keycloak:
13091318
enabled: false
1319+
retentionPolicy: 7d
1320+
schedule: 0 0 * * *
1321+
pathSuffix: keycloak
13101322
gitea:
13111323
enabled: false
1324+
retentionPolicy: 7d
1325+
schedule: 0 0 * * *
13121326
cluster:
13131327
provider: linode
13141328
name: apl

values-changes.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -336,3 +336,8 @@ changes:
336336
- databases.harbor.resources.limits.cpu: '200m'
337337
- databases.harbor.resources.requests.memory: '192Mi'
338338
- databases.harbor.resources.requests.cpu: '200m'
339+
- version: 33
340+
deletions:
341+
- 'databases.keycloak.imported'
342+
- 'databases.gitea.imported'
343+
- 'databases.gitea.useOtomiDB'

values-schema.yaml

+43-10
Original file line numberDiff line numberDiff line change
@@ -1655,7 +1655,7 @@ properties:
16551655
$ref: '#/definitions/email'
16561656
issuer:
16571657
description: |
1658-
Indicates the origin of the wildcard certificate.
1658+
Indicates the origin of the wildcard certificate.
16591659
The custom-ca - cert-manager uses the customRootCA to generate wildcard certificate.
16601660
The letsencrypt - cert-manager requests certificate from letsencrypt endpoint.
16611661
The byo-wildcard-cert allows users to bring their own trusted wildcard certificate (cert-manager not involved)
@@ -3168,6 +3168,10 @@ properties:
31683168
$ref: '#/definitions/backupRetentionPolicy'
31693169
schedule:
31703170
$ref: '#/definitions/backupSchedule'
3171+
pathSuffix:
3172+
type: string
3173+
pattern: '^[a-z0-9]([-a-z0-9]*[a-z0-9])$'
3174+
default: harbor
31713175
gitea:
31723176
title: Gitea
31733177
properties:
@@ -3180,6 +3184,10 @@ properties:
31803184
$ref: '#/definitions/backupRetentionPolicy'
31813185
schedule:
31823186
$ref: '#/definitions/backupSchedule'
3187+
pathSuffix:
3188+
type: string
3189+
pattern: '^[a-z0-9]([-a-z0-9]*[a-z0-9])$'
3190+
default: gitea
31833191
keycloak:
31843192
title: Keycloak
31853193
properties:
@@ -3192,6 +3200,10 @@ properties:
31923200
$ref: '#/definitions/backupRetentionPolicy'
31933201
schedule:
31943202
$ref: '#/definitions/backupSchedule'
3203+
pathSuffix:
3204+
type: string
3205+
pattern: '^[a-z0-9]([-a-z0-9]*[a-z0-9])$'
3206+
default: keycloak
31953207
persistentVolumes:
31963208
type: object
31973209
description: Create backups of persistent volumes
@@ -3293,9 +3305,16 @@ properties:
32933305
replicas:
32943306
type: integer
32953307
default: 2
3296-
imported:
3297-
type: boolean
3298-
default: false
3308+
recovery:
3309+
type: object
3310+
additionalProperties: true
3311+
default: {}
3312+
externalClusters:
3313+
type: array
3314+
items:
3315+
type: object
3316+
additionalProperties: true
3317+
default: []
32993318
harbor:
33003319
title: Harbor
33013320
properties:
@@ -3306,22 +3325,36 @@ properties:
33063325
replicas:
33073326
type: integer
33083327
default: 2
3328+
recovery:
3329+
type: object
3330+
additionalProperties: true
3331+
default: {}
3332+
externalClusters:
3333+
type: array
3334+
items:
3335+
type: object
3336+
additionalProperties: true
3337+
default: []
33093338
gitea:
33103339
title: gitea
33113340
properties:
3312-
useOtomiDB:
3313-
type: boolean
3314-
default: false
33153341
size:
33163342
type: string
33173343
resources:
33183344
$ref: '#/definitions/resources'
33193345
replicas:
33203346
type: integer
33213347
default: 2
3322-
imported:
3323-
type: boolean
3324-
default: false
3348+
recovery:
3349+
type: object
3350+
additionalProperties: true
3351+
default: {}
3352+
externalClusters:
3353+
type: array
3354+
items:
3355+
type: object
3356+
additionalProperties: true
3357+
default: []
33253358
teamConfig:
33263359
additionalProperties: false
33273360
patternProperties:

values/gitea/gitea-otomi-db.gotmpl

+7-27
Original file line numberDiff line numberDiff line change
@@ -29,44 +29,21 @@ backup:
2929
type: {{ $obj.type }}
3030
{{- if eq $obj.type "minioLocal" }}
3131
minioLocal:
32-
destinationPath: "s3://cnpg/gitea"
32+
destinationPath: "s3://cnpg/{{ $b.pathSuffix }}"
3333
{{- end }}
3434
{{- if eq $obj.type "linode" }}
3535
linode:
36-
destinationPath: "s3://{{ $obj.linode.buckets.cnpg }}/gitea"
36+
destinationPath: "s3://{{ $obj.linode.buckets.cnpg }}/{{ $b.pathSuffix }}"
3737
endpointURL: https://{{ $obj.linode.region }}.linodeobjects.com
3838
{{- end }}
3939
{{- end }}
4040
{{- end }}
4141

42-
{{- if $gdb.imported }}
4342
clusterSpec:
4443
bootstrap:
45-
initdb:
46-
database: gitea
47-
owner: gitea
48-
secret:
49-
name: gitea-db-secret
50-
import:
51-
type: microservice
52-
databases:
53-
- gitea
54-
source:
55-
externalCluster: gitea-postgresql
56-
externalClusters:
57-
- name: gitea-postgresql
58-
connectionParameters:
59-
host: gitea-postgresql.gitea.svc.cluster.local
60-
user: gitea
61-
dbname: gitea
62-
sslmode: disable
63-
password:
64-
name: gitea-postgresql
65-
key: postgresql-password
66-
44+
{{- if $gdb.recovery }}
45+
recovery: {{ toYaml $gdb.recovery | nindent 6 }}
6746
{{- else }}
68-
clusterSpec:
69-
bootstrap:
7047
initdb:
7148
database: gitea
7249
owner: gitea
@@ -75,5 +52,8 @@ clusterSpec:
7552
localeCollate: 'en_US.UTF-8'
7653
localeCType: 'en_US.UTF-8'
7754
{{- end }}
55+
{{- if $gdb.externalClusters }}
56+
externalClusters: {{ toYaml $gdb.externalClusters | nindent 4 }}
57+
{{- end }}
7858

7959
resources: {{- toYaml $gdb.resources | nindent 2 }}

0 commit comments

Comments
 (0)