From b96c38ee168ae73ebdf26e1d0a2c0706ea765380 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niccol=C3=B2=20Fei?= Date: Wed, 30 Oct 2024 18:56:22 +0100 Subject: [PATCH 1/2] feat: support cnpg operator namespace-restricted installation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Leonardo Cecchi Co-authored-by: Jaime Silvela Co-authored-by: Jonathan Gonzalez V. Signed-off-by: Niccolò Fei --- .github/actions/deploy-cluster/action.yml | 27 ++ .github/actions/deploy-operator/action.yml | 15 +- .../actions/verify-cluster-ready/action.yml | 12 +- .github/workflows/tests-operator.yml | 46 +++- README.md | 24 ++ charts/cloudnative-pg/README.md | 3 +- charts/cloudnative-pg/templates/NOTES.txt | 7 +- charts/cloudnative-pg/templates/_helpers.tpl | 222 +++++++++++++++ charts/cloudnative-pg/templates/config.yaml | 12 + .../cloudnative-pg/templates/deployment.yaml | 4 + .../cloudnative-pg/templates/podmonitor.yaml | 15 ++ charts/cloudnative-pg/templates/rbac.yaml | 252 ++++-------------- charts/cloudnative-pg/values.schema.json | 3 + charts/cloudnative-pg/values.yaml | 4 + 14 files changed, 424 insertions(+), 222 deletions(-) create mode 100644 .github/actions/deploy-cluster/action.yml diff --git a/.github/actions/deploy-cluster/action.yml b/.github/actions/deploy-cluster/action.yml new file mode 100644 index 000000000..4feaa026b --- /dev/null +++ b/.github/actions/deploy-cluster/action.yml @@ -0,0 +1,27 @@ +name: Deploy a CNPG Cluster +description: Deploys a CNPG Cluster +inputs: + namespace: + description: 'The name of the namespace where the Cluster will be deployed' + required: false + default: 'default' +runs: + using: composite + steps: + - name: Deploy a cluster + shell: bash + env: + NAMESPACE: ${{ inputs.namespace }} + run: | + cat < Date: Tue, 5 Nov 2024 13:35:53 +0100 Subject: [PATCH 2/2] test: verify unwatched namespaces are being ignored MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Niccolò Fei --- .github/workflows/tests-operator.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/tests-operator.yml b/.github/workflows/tests-operator.yml index ae25f3cbb..6c4ec9ebb 100644 --- a/.github/workflows/tests-operator.yml +++ b/.github/workflows/tests-operator.yml @@ -59,3 +59,15 @@ jobs: namespace: 'single-install' cluster-name: 'cluster-example' ready-instances: '3' + + - name: Create a separate namespace + run: kubectl create ns test-ignore + + - name: Deploy a cluster in 'test-ignore' + uses: ./.github/actions/deploy-cluster + with: + namespace: 'test-ignore' + + - name: Verify the cluster in 'test-ignore' is being ignored + run: | + kubectl -n test-ignore get pods 2>&1 >/dev/null | grep 'No resources found'