diff --git a/.github/workflows/ci-helm-lint-test.yml b/.github/workflows/ci-helm-lint-test.yml index 83f2e4f..dced7d5 100644 --- a/.github/workflows/ci-helm-lint-test.yml +++ b/.github/workflows/ci-helm-lint-test.yml @@ -58,7 +58,8 @@ jobs: --namespace cert-manager \ --create-namespace \ --set installCRDs=true \ - --set prometheus.enabled=false + --set prometheus.enabled=false \ + --wait - name: Install CNPG Operator run: | @@ -66,16 +67,15 @@ jobs: helm repo update helm install cnpg-operator cnpg-operator/cloudnative-pg \ --namespace cnpg-system \ - --create-namespace + --create-namespace \ + --wait - name: Creat testing values working-directory: ./charts/cloudnative-pg-cluster run: | cat << EOF > test-values.yaml name: "cnpg" - instances: 1 - superuserSecret: - name: null + instances: 3 bootstrap: initdb: database: app @@ -100,22 +100,37 @@ jobs: enablePodMonitor: false postgresql: pg_hba: - - hostnossl all all 0.0.0.0/0 reject - - hostssl all all 0.0.0.0/0 cert clientcert=verify-full + - hostssl all all all cert storage: size: 1Gi testApp: - enabled: true + enabled: false EOF - name: Install CNPG cluster working-directory: ./charts/cloudnative-pg-cluster run: | - #helm repo add cnpg-cluster https://small-hack.github.io/cloudnative-pg-tenant-chart - #helm repo update - #helm install cnpg-cluster cnpg-cluster/cnpg-cluster --values test-values.yaml - helm template . -f test-values.yaml > deploy.yaml - kubectl apply -f deploy.yaml + helm repo add cnpg-cluster https://small-hack.github.io/cloudnative-pg-cluster-chart + helm repo update + helm install cnpg-cluster cnpg-cluster/cnpg-cluster \ + --values test-values.yaml + + ITER=0 + while true; do + if [[ $ITER -ge 300 ]]; then + echo "Cluster not ready" + exit 1 + fi + READY_INSTANCES=$(kubectl get cluster cnpg -o jsonpath='{.status.readyInstances}') + if [[ "$READY_INSTANCES" == 3 ]]; then + echo "Cluster up and running" + break + fi + sleep 1 + STATUS=$(kubectl get cluster) + echo "$STATUS" + (( ++ITER )) + done - name: Run chart-testing (install) id: install diff --git a/charts/cloudnative-pg-cluster/Chart.yaml b/charts/cloudnative-pg-cluster/Chart.yaml index 8ee9f76..04c6e08 100644 --- a/charts/cloudnative-pg-cluster/Chart.yaml +++ b/charts/cloudnative-pg-cluster/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: cnpg-cluster description: Create postgres tenant clusters managed by the CNPG Operator type: application -version: 0.3.6 +version: 0.3.7 maintainers: - name: "cloudymax" diff --git a/charts/cloudnative-pg-cluster/README.md b/charts/cloudnative-pg-cluster/README.md index 8c56773..8f742e0 100644 --- a/charts/cloudnative-pg-cluster/README.md +++ b/charts/cloudnative-pg-cluster/README.md @@ -1,6 +1,6 @@ # cnpg-cluster -![Version: 0.3.6](https://img.shields.io/badge/Version-0.3.6-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) +![Version: 0.3.7](https://img.shields.io/badge/Version-0.3.7-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) Create postgres tenant clusters managed by the CNPG Operator @@ -35,10 +35,12 @@ Create postgres tenant clusters managed by the CNPG Operator | certificates.user.enabled | bool | `false` | create a certificate for a user to connect to postgres using CertManager requires server and client certificate generation enabled | | certificates.user.username | string | `"app"` | name of the user to create a cert for, eg: the DbOwner specified earlier. This data populated into the commonName field of the certificate. | | externalClusters | list | `[]` | | -| instances | int | `3` | | +| imageName | string | `"ghcr.io/cloudnative-pg/postgresql:16.0"` | image to use for all tenant pods | +| instances | int | `3` | number of postgres replicas minimum 1 required | | monitoring.enablePodMonitor | bool | `false` | enable monitoring via Prometheus | | name | string | `"cnpg"` | | | postgresql.pg_hba | list | `["hostnossl all all 0.0.0.0/0 reject","hostssl all all 0.0.0.0/0 cert clientcert=verify-full"]` | records for the pg_hba.conf file. ref: https://www.postgresql.org/docs/current/auth-pg-hba-conf.html | +| primaryUpdateStrategy | string | `"unsupervised"` | | | scheduledBackup.name | string | `"example-backup"` | name to use for your scheduled backup job | | scheduledBackup.spec.backupOwnerReference | string | `"self"` | | | scheduledBackup.spec.cluster.name | string | `"pg-backup"` | | diff --git a/charts/cloudnative-pg-cluster/templates/cnpg_cluster.yaml b/charts/cloudnative-pg-cluster/templates/cnpg_cluster.yaml index 6325a9e..d1d6d60 100644 --- a/charts/cloudnative-pg-cluster/templates/cnpg_cluster.yaml +++ b/charts/cloudnative-pg-cluster/templates/cnpg_cluster.yaml @@ -4,7 +4,9 @@ kind: Cluster metadata: name: {{ .Values.name }} spec: - instances: {{ .Values.instances}} + instances: {{ .Values.instances }} + imageName: {{ .Values.imageName }} + primaryUpdateStrategy: {{ .Values.primaryUpdateStrategy }} {{- if .Values.backup }} {{- with .Values.backup }} backup: diff --git a/charts/cloudnative-pg-cluster/values.yaml b/charts/cloudnative-pg-cluster/values.yaml index 6ec60c6..2aeed2b 100644 --- a/charts/cloudnative-pg-cluster/values.yaml +++ b/charts/cloudnative-pg-cluster/values.yaml @@ -1,7 +1,19 @@ name: "cnpg" +# -- number of postgres replicas +# minimum 1 required instances: 3 +# -- image to use for all tenant pods +imageName: ghcr.io/cloudnative-pg/postgresql:16.0 + +# Examples of rolling update strategy: +# unsupervised: automated update of the primary once all +# replicas have been upgraded (default) +# supervised: requires manual supervision to perform +# the switchover of the primary +primaryUpdateStrategy: unsupervised + bootstrap: initdb: # -- initial database to create