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 <&1 >/dev/null | grep 'No resources found' diff --git a/README.md b/README.md index dda335965..132478a4b 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,30 @@ helm upgrade --install cnpg \ cnpg/cloudnative-pg ``` +#### Single namespace installation + +It is possible to limit the operator's capabilities to solely the namespace in +which it has been installed. With this restriction, the cluster-level +permissions required by the operator will be substantially reduced, and +the security profile of the installation will be enhanced. + +You can install the operator in single-namespace mode by setting the +`config.clusterWide` flag to false, as in the following example: + +```console +helm upgrade --install cnpg \ + --namespace cnpg-system \ + --create-namespace \ + --set config.clusterWide=false \ + cnpg/cloudnative-pg +``` + +**IMPORTANT**: the single-namespace installation mode can't coexist +with the cluster-wide operator. Otherwise there would be collisions when +managing the resources in the namespace watched by the single-namespace +operator. +It is up to the user to ensure there is no collision between operators. + Refer to the [Operator Chart documentation](charts/cloudnative-pg/README.md) for advanced configuration and monitoring. ## Cluster chart diff --git a/charts/cloudnative-pg/README.md b/charts/cloudnative-pg/README.md index f78461cfc..6194c9d76 100644 --- a/charts/cloudnative-pg/README.md +++ b/charts/cloudnative-pg/README.md @@ -30,7 +30,8 @@ CloudNativePG Operator Helm Chart | additionalEnv | list | `[]` | Array containing extra environment variables which can be templated. For example: - name: RELEASE_NAME value: "{{ .Release.Name }}" - name: MY_VAR value: "mySpecialKey" | | affinity | object | `{}` | Affinity for the operator to be installed. | | commonAnnotations | object | `{}` | Annotations to be added to all other resources. | -| config | object | `{"create":true,"data":{},"name":"cnpg-controller-manager-config","secret":false}` | Operator configuration. | +| config | object | `{"clusterWide":true,"create":true,"data":{},"name":"cnpg-controller-manager-config","secret":false}` | Operator configuration. | +| config.clusterWide | bool | `true` | This option determines if the operator is responsible for observing events across the entire Kubernetes cluster or if its focus should be narrowed down to the specific namespace within which it has been deployed. | | config.create | bool | `true` | Specifies whether the secret should be created. | | config.data | object | `{}` | The content of the configmap/secret, see https://cloudnative-pg.io/documentation/current/operator_conf/#available-options for all the available options. | | config.name | string | `"cnpg-controller-manager-config"` | The name of the configmap/secret to use. | diff --git a/charts/cloudnative-pg/templates/NOTES.txt b/charts/cloudnative-pg/templates/NOTES.txt index 0f79fe0dc..d0b65b9b4 100644 --- a/charts/cloudnative-pg/templates/NOTES.txt +++ b/charts/cloudnative-pg/templates/NOTES.txt @@ -1,6 +1,6 @@ CloudNativePG operator should be installed in namespace "{{ .Release.Namespace }}". -You can now create a PostgreSQL cluster with 3 nodes in the current namespace as follows: +You can now create a PostgreSQL cluster with 3 nodes as follows: cat <