-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtrakrf-db.yaml
More file actions
48 lines (45 loc) · 2.22 KB
/
Copy pathtrakrf-db.yaml
File metadata and controls
48 lines (45 loc) · 2.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
{{- /*
One CNPG Cluster Application per env where .dbCluster.enabled is true.
Per-env config (Cluster name, namespace, retain SC, external LB IP)
lives in .Values.envs.<env>.dbCluster at the root chart values level —
the template has zero env-name string conditionals. Adding or removing
a CNPG Cluster is a values change only.
Both envs run dedicated Clusters today (trakrf-db-preview in trakrf-preview,
trakrf-db-prod in trakrf-prod). The `enabled` flag exists so future
environments (whitelabel tenants, etc.) can be staged off until their
bootstrap is ready, without changing template shape.
automatedPrune=false: stateful guardrail. Combined with the
premium-rwo-retain StorageClass on the PVC, an accidental prune or
Cluster CR delete cannot destroy data.
externalIp is non-empty only on envs that need an external psql endpoint
(today: preview, for the FDW pull-migration dev workflow). The block is
GKE-only by structure: tofu sets the IP on GKE, leaves it blank elsewhere.
*/ -}}
{{- range $env, $cfg := $.Values.envs }}
{{- $dc := $cfg.dbCluster }}
{{- if $dc.enabled }}
{{- $ignore := printf "- group: postgresql.cnpg.io\n kind: Cluster\n name: %s\n managedFieldsManagers:\n - manager\n" $dc.fullnameOverride }}
{{- $values := printf "fullnameOverride: %s\nstorage:\n createRetainClass: %t\n" $dc.fullnameOverride $dc.createRetainClass }}
{{- if $dc.storageSize }}
{{- $values = printf "%s size: %q\n" $values $dc.storageSize }}
{{- end }}
{{- $values = printf "%sbackups:\n bucket: %q\n gcpServiceAccountEmail: %q\n" $values $.Values.cnpgBackupBucket $.Values.cnpgBackupsGcpServiceAccountEmail }}
{{- if and $dc.externalIp (eq $.Values.cluster "gke") }}
{{- $values = printf "%sexternalPreview:\n enabled: true\n loadBalancerIP: %q\n sourceRanges:\n - %q\n" $values $dc.externalIp $.Values.breakglassSourceCidr }}
{{- end }}
---
{{- include "trakrf.application" (dict
"name" $dc.fullnameOverride
"path" "helm/trakrf-db"
"namespace" $dc.namespace
"syncWave" "0"
"cluster" $.Values.cluster
"repoURL" $.Values.repoURL
"targetRevision" $.Values.targetRevision
"destination" $.Values.destination
"inlineValues" $values
"ignoreDifferences" $ignore
"automatedPrune" false
) }}
{{- end }}
{{- end }}