Skip to content

Cluster Chart v0.0.1-alpha #208

Cluster Chart v0.0.1-alpha

Cluster Chart v0.0.1-alpha #208

name: continuous-delivery
on:
pull_request:
branches-ignore:
- 'gh-pages'
jobs:
install_deploy:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
with:
fetch-depth: 0
- name: Set up Helm
uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3.5
with:
version: v3.6.2
- name: Create kind cluster
uses: helm/kind-action@dda0770415bac9fc20092cacbc54aa298604d140 # v1.8.0
- name: Deploy using helm chart
run: |
helm upgrade --install cnpg --namespace cnpg-system \
--create-namespace charts/cloudnative-pg --wait
- name: Install kubectl
uses: azure/setup-kubectl@901a10e89ea615cf61f57ac05cecdf23e7de06d8 # v3.2
- name: Deploy a cluster
run: |
cat <<EOF | kubectl apply -f -
# Example of PostgreSQL cluster
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: cluster-example
spec:
instances: 3
storage:
size: 1Gi
EOF
ITER=0
while true; do
if [[ $ITER -ge 300 ]]; then
echo "Cluster not ready"
exit 1
fi
READY_INSTANCES=$(kubectl get cluster cluster-example -o jsonpath='{.status.readyInstances}')
if [[ "$READY_INSTANCES" == 3 ]]; then
echo "Cluster up and running"
break
fi
sleep 1
(( ++ITER ))
done