diff --git a/library/common-test/Chart.yaml b/library/common-test/Chart.yaml index 0c7cb71b..fd5cfbb8 100644 --- a/library/common-test/Chart.yaml +++ b/library/common-test/Chart.yaml @@ -3,7 +3,7 @@ appVersion: "" dependencies: - name: common repository: file://../common - version: ~12.6.0 + version: ~12.7.0 deprecated: false description: Helper chart to test different use cases of the common library home: https://github.com/truecharts/apps/tree/master/charts/library/common-test diff --git a/library/common/Chart.yaml b/library/common/Chart.yaml index 4138e4be..79c9c54e 100644 --- a/library/common/Chart.yaml +++ b/library/common/Chart.yaml @@ -15,4 +15,4 @@ maintainers: name: common sources: null type: library -version: 12.6.9 +version: 12.7.0 diff --git a/library/common/templates/class/_cnpgCluster.tpl b/library/common/templates/class/_cnpgCluster.tpl index 6ffa7b95..e309e657 100644 --- a/library/common/templates/class/_cnpgCluster.tpl +++ b/library/common/templates/class/_cnpgCluster.tpl @@ -15,14 +15,16 @@ apiVersion: {{ include "tc.v1.common.capabilities.cnpg.cluster.apiVersion" $ }} kind: Cluster metadata: name: {{ $cnpgClusterName }} - {{- $labels := (mustMerge ($cnpgClusterLabels | default dict) (include "tc.v1.common.lib.metadata.allLabels" $ | fromYaml)) -}} - {{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $ "labels" $labels) | trim) }} + {{- $labels := (mustMerge ($cnpgClusterLabels | default dict) (include "tc.v1.common.lib.metadata.allLabels" $ | fromYaml)) }} labels: + cnpg.io/reload: "on" + {{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $ "labels" $labels) | trim) }} {{- . | nindent 4 }} {{- end }} - {{- $annotations := (mustMerge ($cnpgClusterAnnotations | default dict) (include "tc.v1.common.lib.metadata.allAnnotations" $ | fromYaml)) -}} - {{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $ "annotations" $annotations) | trim) }} + {{- $annotations := (mustMerge ($cnpgClusterAnnotations | default dict) (include "tc.v1.common.lib.metadata.allAnnotations" $ | fromYaml)) }} annotations: + cnpg.io/hibernation: {{ if $values.hibernate }}"on"{{ else }}"off"{{ end }} + {{- with (include "tc.v1.common.lib.metadata.render" (dict "rootCtx" $ "annotations" $annotations) | trim) }} {{- . | nindent 4 }} {{- end }} spec: @@ -64,7 +66,7 @@ spec: nodeMaintenanceWindow: inProgress: false - reusePVC: on + reusePVC: true postgresql: {{- tpl ( $values.postgresql | toYaml ) $ | nindent 4 }} diff --git a/library/common/templates/class/_cnpgPooler.tpl b/library/common/templates/class/_cnpgPooler.tpl index ce241e39..67b63a5a 100644 --- a/library/common/templates/class/_cnpgPooler.tpl +++ b/library/common/templates/class/_cnpgPooler.tpl @@ -21,7 +21,7 @@ spec: cluster: name: {{ $cnpgClusterName }} - instances: {{ $values.pooler.instances | default 2 }} + instances: {{ if $values.hibernate}}0{{ else }}{{ $values.pooler.instances | default 2 }}{{ end }} type: {{ $values.pooler.type }} pgbouncer: poolMode: session diff --git a/library/common/values.yaml b/library/common/values.yaml index 4f1322d5..0f0657b4 100644 --- a/library/common/values.yaml +++ b/library/common/values.yaml @@ -705,6 +705,8 @@ cnpg: main: enabled: false primary: true + # -- Puts the cnpg cluster in hibernation mode + hibernate: false # -- number of instances for both postgres and pgbouncer instances: 2 database: "app" @@ -724,6 +726,7 @@ cnpg: storage: size: "256Gi" walsize: "256Gi" + # -- Gets scaled to 0 if hibernation is true pooler: instances: 2 # -- set to enable prometheus metrics