Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable update process options #25

Merged
merged 3 commits into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 28 additions & 13 deletions .github/workflows/ci-helm-lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,24 +58,24 @@ jobs:
--namespace cert-manager \
--create-namespace \
--set installCRDs=true \
--set prometheus.enabled=false
--set prometheus.enabled=false \
--wait

- name: Install CNPG Operator
run: |
helm repo add cnpg-operator https://cloudnative-pg.github.io/charts
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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion charts/cloudnative-pg-cluster/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 4 additions & 2 deletions charts/cloudnative-pg-cluster/README.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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"` | |
Expand Down
4 changes: 3 additions & 1 deletion charts/cloudnative-pg-cluster/templates/cnpg_cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
12 changes: 12 additions & 0 deletions charts/cloudnative-pg-cluster/values.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Loading