Skip to content

Commit

Permalink
Merge branch 'main' into kuttl
Browse files Browse the repository at this point in the history
Signed-off-by: Itay Grudev <[email protected]>
  • Loading branch information
itay-grudev authored Mar 26, 2024
2 parents d1ec567 + ac69315 commit af5ab64
Show file tree
Hide file tree
Showing 21 changed files with 201 additions and 6,493 deletions.
12 changes: 9 additions & 3 deletions .github/actions/deploy-operator/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ runs:
steps:
- name: Deploy the operator
shell: bash
run: |
helm upgrade --install cnpg --namespace cnpg-system \
--create-namespace charts/cloudnative-pg --wait
run:
helm dependency update charts/cloudnative-pg

helm upgrade
--install
--namespace cnpg-system
--create-namespace
--wait
cnpg charts/cloudnative-pg
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ inputs:
runs:
using: composite
steps:
- name: Wait for cluster to become ready
- name: Wait for the cluster to become ready
shell: bash
run: |
ITER=0
Expand All @@ -22,7 +22,7 @@ runs:
echo "Cluster not ready"
exit 1
fi
READY_INSTANCES=$(kubectl get cluster ${INPUT_CLUSTER_NAME} -o jsonpath='{.status.readyInstances}')
READY_INSTANCES=$(kubectl get clusters.postgresql.cnpg.io ${INPUT_CLUSTER_NAME} -o jsonpath='{.status.readyInstances}')
if [[ "$READY_INSTANCES" == ${INPUT_READY_INSTANCES} ]]; then
echo "Cluster up and running"
break
Expand Down
32 changes: 32 additions & 0 deletions .github/actions/verify-pooler-ready/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Verifies that a CNPG cluster has a certain amount of ready instances
description: Verifies that a CNPG cluster has a certain amount of ready instances
inputs:
pooler-name:
description: The name of the pooler to verify
required: true
default: database-cluster
ready-instances:
description: The amount of ready instances to wait for
required: true
default: "3"

runs:
using: composite
steps:
- name: Wait for the pooler to become ready
shell: bash
run: |
ITER=0
while true; do
if [[ $ITER -ge 300 ]]; then
echo "Pooler not ready"
exit 1
fi
READY_INSTANCES=$(kubectl get deployments.apps ${INPUT_POOLER_NAME} -o jsonpath='{.status.readyReplicas}')
if [[ "$READY_INSTANCES" == ${INPUT_READY_INSTANCES} ]]; then
echo "Pooler up and running"
break
fi
sleep 1
(( ++ITER ))
done
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ jobs:
- name: Run chart-testing (lint)
run: |
ct lint --target-branch=main --check-version-increment=false
ct lint --chart-repos cnpg-grafana=https://cloudnative-pg.github.io/grafana-dashboards --target-branch=main --check-version-increment=false
10 changes: 7 additions & 3 deletions .github/workflows/release-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ jobs:
with:
version: v3.14.1

- name: Add chart dependencies
run: |
helm repo add cnpg-grafana-dashboard https://cloudnative-pg.github.io/grafana-dashboards
- name: Run chart-releaser
uses: helm/chart-releaser-action@a917fd15b20e8b64b94d9158ad54cd6345335584 # v1.6.0
env:
Expand Down Expand Up @@ -71,14 +75,14 @@ jobs:
# would be preserved, causing a non-zero exit. Set nullglob to fix this
run: |
shopt -s nullglob
for pkg in .cr-release-packages/*; do
for pkg in .cr-release-packages/*.tgz; do
if [ -z "${pkg:-}" ]; then
break
fi
helm push "${pkg}" oci://ghcr.io/"${GITHUB_REPOSITORY_OWNER}"/charts
helm push "${pkg}" oci://ghcr.io/"${GITHUB_REPOSITORY}"
file=${pkg##*/}
name=${file%-*}
version=${file%.*}
version=${version##*-}
cosign sign ghcr.io/"${GITHUB_REPOSITORY_OWNER}"/charts/"${name}":"${version}"
cosign sign --yes ghcr.io/"${GITHUB_REPOSITORY}"/"${name}":"${version}"
done
35 changes: 35 additions & 0 deletions .github/workflows/tests-cluster-standalone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,38 @@ jobs:
- name: Run KUTTL tests
run: |
kubectl kuttl test
test-cluster-pgbouncer:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0

- name: Setup kind
uses: ./.github/actions/setup-kind

- name: Deploy the operator
uses: ./.github/actions/deploy-operator

- name: Deploy a standalone cluster
run: |
helm upgrade --install \
--values charts/cluster/examples/pgbouncer.yaml \
--namespace database \
--create-namespace \
--wait \
database ./charts/cluster
- name: Verify that the cluster is ready
uses: ./.github/actions/verify-cluster-ready
with:
cluster-name: database-cluster
ready-instances: 1

- name: Verify that the pooler is ready
uses: ./.github/actions/verify-pooler-ready
with:
pooler-name: database-cluster-pooler-rw
ready-instances: 1
2 changes: 1 addition & 1 deletion .github/workflows/tests-operator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
EOF
- name: Verify that the cluster is ready
uses: ./.github/actions/verify-ready-instances
uses: ./.github/actions/verify-cluster-ready
with:
cluster-name: cluster-example
ready-instances: 3
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Ignore Helm subcharts
charts/**/charts/*.tgz

# Binaries for programs and plugins
*.exe
*.exe~
Expand Down
6 changes: 6 additions & 0 deletions charts/cloudnative-pg/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: cluster
repository: https://cloudnative-pg.github.io/grafana-dashboards
version: 0.0.1
digest: sha256:f2055d3b9f52be6989a8285cb736ec555f91f133791382787f4beb4387175ca0
generated: "2024-03-23T16:27:46.965208992+02:00"
6 changes: 6 additions & 0 deletions charts/cloudnative-pg/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,9 @@ home: https://cloudnative-pg.io
maintainers:
- name: phisco
email: [email protected]
dependencies:
- name: cluster
alias: monitoring
condition: monitoring.grafanaDashboard.create
version: "0.0"
repository: https://cloudnative-pg.github.io/grafana-dashboards
12 changes: 10 additions & 2 deletions charts/cloudnative-pg/README.md

Large diffs are not rendered by default.

Loading

0 comments on commit af5ab64

Please sign in to comment.