diff --git a/README.md b/README.md index 85ca444..4aefb30 100644 --- a/README.md +++ b/README.md @@ -94,10 +94,9 @@ Like PG4K install, both the operator and the operand images required by PG4K-PGD may be pulled from the `k8s_enterprise` or `k8s_standard` repositories at `docker.enterprisedb.com`, please obtaining an EDB subscription token before setup. -The `edb-postgres-distributed-for-kubernetes` chart will by default install PG4K -operator defined by sub-chart in the same namespace, the PG4K operator installed -in the sub-chart is PG4K LTS release operator, which is upgraded along with the -parent chart version release. +The `edb-postgres-distributed-for-kubernetes` chart will install the operator for +both PG4K-PGD and PG4K in the same namespace. The PG4K operator used for PG4K-PGD +is well-tested and belongs to latest long term support release of PG4K. The `edb-postgres-distributed-for-kubernetes` chart also install the cert-manager operators as dependency. You can avoid this if necessary. See the sub-section @@ -145,7 +144,7 @@ helm chart are working: ### Deploying the PG4K-PGD operators and cert-manager individually The chart `edb-postgres-distributed-for-kubernetes` is set by default to -also install PG4K and cert-manager operators, which it depends on. +also install cert-manager operators, which it depends on. When following this route, all operators will be installed in the same namespace. This is in contrast with other installation paths, where the operators reside in dedicated namespaces. @@ -154,7 +153,7 @@ Installing all dependencies in the same namespace is a design limitation of Helm, but we can get around it by installing dependencies with separate invocations of `helm`. -If you would like to install the cert-manager in separate namespaces, please +If you would like to install the cert-manager in a separate namespaces, please follow the below steps. #### 1. Setup cert-manager @@ -184,23 +183,10 @@ In case you choose this option, remember to also specify `--set cert-manager.enabled=false` during the installation of the PG4K-PGD helm chart in the next section. -#### 2. Setup PG4K - -By default, a PG4K operator with LTS release is installed alongside with PG4K-PGD -deploy. You can follow [PG4K helm chart](#deployment-of-the-edb-postgres-for-kubernetes-operator-pg4k) -to deploy the PG4K operator in its own namespace. But it is highly recommended to use -the PG4K operator installed as dependency of PG4K-PGD chart, which contains the well tested PG4K -operator version. - -In case you choose to use existing PG4K operator, remember to also specify -`--set edb-postgres-for-kubernetes-lts.enabled=false` during the installation of the PG4K-PGD -helm chart in the next section. - -#### 3. Setup PG4K-PGD +#### 2. Setup PG4K-PGD Once the above deployments are ready, you can deploy the PG4K-PGD helm chart. taking care -to set `edb-postgres-for-kubernetes-lts.enabled` to false if you PG4K already deployed, -and set `cert-manager.enabled` to false if cert-manager is installed separately. +to set `cert-manager.enabled` to false if cert-manager is installed separately. **Note:** in the following example, the flags setting the credentials were elided to put the focus on the `enabled=false` condition. The flags may still be @@ -213,11 +199,10 @@ helm upgrade --dependency-update \ --create-namespace \ edb/edb-postgres-distributed-for-kubernetes \ --set cert-manager.enabled=false - --set edb-postgres-for-kubernetes-lts.enabled=false ``` -You can see the three separate namespaces, the same that would be created if -installing manually without Helm charts. +You can see two seperate namespaces where cert-manager is installed in `cert-manager` +namespaces. ``` sh $ kubectl get ns @@ -225,7 +210,6 @@ NAME STATUS AGE … cert-manager Active 24m pgd-operator-system Active 55s -postgresql-operator-system Active 5m33s ``` ### Controlling the image repositories @@ -238,14 +222,13 @@ subscription plan. This needs to be done in several places in the command-line invocation. The following example uses the `k8s_standard_pgd` registry in -`docker.enterprisedb.com`. -Note the multiple `--set` options, for the `image.repository`, -`PGD_IMAGE_NAME` and `PGD_PROXY_IMAGE_NAME` in addition to the -`edb-postgres-for-kubernetes-lts.image.repository` where the PGD operator -is pulled from. There are 4 in total -- `image.repository` where the PG4K-PGD operator image is pulled from. -- `edb-postgres-for-kubernetes-lts.image.repository` where the PG4K operator image is pulled from. -- `PGD_IMAGE_NAME` and `PGD_PROXY_IMAGE_NAME` where the PGD and PGD Proxy image are pulled from. +`docker.enterprisedb.com`. Following is the description of multiple +set options. +- `image.repository` where the PG4K-PGD and PG4K operator image is pulled from, this is the repository without imageName, the default +operator image name is defined in the value file. +- `PGD_IMAGE_NAME` where the PGD image are pulled from. +- `PGD_PROXY_IMAGE_NAME` where PGD Proxy image are pulled from, usually +the same with `PGD_IMAGE_NAME`. Assuming that you have your necessary credentials, please fill in the USERNAME and PASSWORD below. @@ -258,8 +241,7 @@ helm upgrade --dependency-update \ edb/edb-postgres-distributed-for-kubernetes \ --set image.imageCredentials.username=${USERNAME} \ --set image.imageCredentials.password=${PASSWORD} \ - --set image.repository=docker.enterprisedb.com/k8s_standard_pgd/pg4k-pgd \ - --set edb-postgres-for-kubernetes-lts.image.repository=docker.enterprisedb.com/k8s_standard_pgd/edb-postgres-for-kubernetes \ + --set image.repository=docker.enterprisedb.com/k8s_standard_pgd \ --set config.data.PGD_IMAGE_NAME=docker.enterprisedb.com/k8s_standard_pgd/postgresql-pgd:15.6-5.5.1-1 \ --set config.data.PGD_PROXY_IMAGE_NAME=docker.enterprisedb.com/k8s_standard_pgd/edb-pgd-proxy:5.5.0 ``` diff --git a/charts/edb-postgres-distributed-for-kubernetes/README.md b/charts/edb-postgres-distributed-for-kubernetes/README.md index e87b743..ea43ead 100644 --- a/charts/edb-postgres-distributed-for-kubernetes/README.md +++ b/charts/edb-postgres-distributed-for-kubernetes/README.md @@ -44,18 +44,21 @@ EDB Postgres Distributed for Kubernetes Helm Chart | containerSecurityContext | object | `{"allowPrivilegeEscalation":false,"capabilities":{"drop":["ALL"]},"readOnlyRootFilesystem":true,"runAsGroup":10001,"runAsUser":10001}` | Container Security Context | | crds.create | bool | `true` | || | edb-postgres-for-kubernetes-lts.enable | bool | `true` | | -| edb-postgres-for-kubernetes-lts.image.repository | string | `"docker.enterprisedb.com/k8s_enterprise_pgd/edb-postgres-for-kubernetes"` | | +| edb-postgres-for-kubernetes-lts.image.repository | string | `""` | Overrides the global image repository for pg4k operator. | +| edb-postgres-for-kubernetes-lts.image.imageName | string | `"edb-postgres-for-kubernetes"` | pg4k operator image name in repository| | edb-postgres-for-kubernetes-lts.image.imagePullSecrets[0].name | string| `"edb-pull-secret"` | | | edb-postgres-for-kubernetes-lts.config.data.PULL_SECRET_NAME| string| `"edb-pull-secret"` | | +|global.repository| string|`docker.enterprisedb.com/k8s_enterprise_pgd`| specifies the repository name where all the operators are pulled from, image name is not included| | imagePullSecrets[0].name | string | `"edb-pull-secret"` | | | fullnameOverride | string | `""` | | | image.imageCredentials.create | bool | `true` | Specifies if an imagePullSecret should be created | | image.imageCredentials.name | string | `"edb-pull-secret"` | | | image.imageCredentials.password | string | `""` | | | image.imageCredentials.registry | string | `"docker.enterprisedb.com"` | | -| image.imageCredentials.username | string | `""` | | +| image.imageCredentials.username | string | `""` | | +| image.repository | string | `""` | Overrides the global image repository for pg4k-pgd operator.| +| image.imageName | string | `"pg4k-pgd"` | pg4k-pgd operator image name in repository| | image.pullPolicy | string | `"IfNotPresent"` | | -| image.repository | string | `"docker.enterprisedb.com/k8s_enterprise_pgd/pg4k-pgd"` | | | image.tag | string | `""` | Overrides the image tag whose default is the chart appVersion. | | managerConfig.data.health.healthProbeBindAddress | string | `":9443"` | | | managerConfig.data.leaderElection.enabled | bool | `true` | | diff --git a/charts/edb-postgres-distributed-for-kubernetes/charts/edb-postgres-for-kubernetes-lts/templates/_helpers.tpl b/charts/edb-postgres-distributed-for-kubernetes/charts/edb-postgres-for-kubernetes-lts/templates/_helpers.tpl index 5ec2d8c..f860909 100644 --- a/charts/edb-postgres-distributed-for-kubernetes/charts/edb-postgres-for-kubernetes-lts/templates/_helpers.tpl +++ b/charts/edb-postgres-distributed-for-kubernetes/charts/edb-postgres-for-kubernetes-lts/templates/_helpers.tpl @@ -72,6 +72,17 @@ Create the imagePullSecret {{- end }} {{- end }} +{{/* +Create the pg4k operator image name +*/}} +{{- define "edb-postgres-for-kubernetes-lts.operatorImageName" }} +{{- if .Values.image.repository }} +{{- printf "%s/%s:%s" .Values.image.repository ( .Values.imageName | default "edb-postgres-for-kubernetes" ) ( .Values.image.tag | default .Chart.AppVersion ) }} +{{- else }} +{{- printf "%s/%s:%s" .Values.global.repository ( .Values.global.imageName | default "edb-postgres-for-kubernetes" ) ( .Values.image.tag | default .Chart.AppVersion ) }} +{{- end }} +{{- end }} + {{/* Define the common set of rules that can be applied either with namespace scope or clusterwide diff --git a/charts/edb-postgres-distributed-for-kubernetes/charts/edb-postgres-for-kubernetes-lts/templates/deployment.yaml b/charts/edb-postgres-distributed-for-kubernetes/charts/edb-postgres-for-kubernetes-lts/templates/deployment.yaml index 4c8be70..f5ab323 100644 --- a/charts/edb-postgres-distributed-for-kubernetes/charts/edb-postgres-for-kubernetes-lts/templates/deployment.yaml +++ b/charts/edb-postgres-distributed-for-kubernetes/charts/edb-postgres-for-kubernetes-lts/templates/deployment.yaml @@ -70,7 +70,7 @@ spec: - /manager env: - name: OPERATOR_IMAGE_NAME - value: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + value: "{{- include "edb-postgres-for-kubernetes-lts.operatorImageName" . }}" - name: OPERATOR_NAMESPACE valueFrom: fieldRef: @@ -84,7 +84,7 @@ spec: - name: WATCH_NAMESPACE value: "{{ .Release.Namespace }}" {{- end }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + image: "{{- include "edb-postgres-for-kubernetes-lts.operatorImageName" . }}" imagePullPolicy: {{ .Values.image.pullPolicy }} livenessProbe: httpGet: diff --git a/charts/edb-postgres-distributed-for-kubernetes/charts/edb-postgres-for-kubernetes-lts/values.yaml b/charts/edb-postgres-distributed-for-kubernetes/charts/edb-postgres-for-kubernetes-lts/values.yaml index d7c9472..d5cec73 100644 --- a/charts/edb-postgres-distributed-for-kubernetes/charts/edb-postgres-for-kubernetes-lts/values.yaml +++ b/charts/edb-postgres-distributed-for-kubernetes/charts/edb-postgres-for-kubernetes-lts/values.yaml @@ -19,10 +19,12 @@ replicaCount: 1 image: - repository: docker.enterprisedb.com/k8s_enterprise/edb-postgres-for-kubernetes - pullPolicy: IfNotPresent + repository: docker.enterprisedb.com/k8s_enterprise + # The name of the operator image to be pulled from repository + imageName: edb-postgres-for-kubernetes # -- Overrides the image tag whose default is the chart appVersion. tag: "" + pullPolicy: IfNotPresent # Credentials configuration imageCredentials: # -- Specifies if an imagePullSecret should be created @@ -41,6 +43,7 @@ fullnameOverride: "" hostNetwork: false dnsPolicy: "" +installCRDs: true crds: # -- Specifies whether the CRDs should be created when installing the chart. create: true diff --git a/charts/edb-postgres-distributed-for-kubernetes/templates/_helpers.tpl b/charts/edb-postgres-distributed-for-kubernetes/templates/_helpers.tpl index 4fb1e7a..bbbaf21 100644 --- a/charts/edb-postgres-distributed-for-kubernetes/templates/_helpers.tpl +++ b/charts/edb-postgres-distributed-for-kubernetes/templates/_helpers.tpl @@ -30,6 +30,17 @@ Create chart name and version as used by the chart label. {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} {{- end }} +{{/* +Create the pg4k-pgd operator image name +*/}} +{{- define "edb-postgres-distributed-for-kubernetes.operatorImageName" }} +{{- if .Values.image.repository }} +{{- printf "%s/%s:%s" .Values.image.repository .Values.image.imageName | default "pg4k-pgd" .Values.image.imageTag | default .Chart.AppVersion }} +{{- else }} +{{- printf "%s/%s:%s" .Values.global.repository ( .Values.image.imageName | default "pg4k-pgd" ) ( .Values.image.imageTag | default .Chart.AppVersion ) }} +{{- end }} +{{- end }} + {{/* Common labels */}} diff --git a/charts/edb-postgres-distributed-for-kubernetes/templates/deployment.yaml b/charts/edb-postgres-distributed-for-kubernetes/templates/deployment.yaml index 46c5688..d6ef87a 100644 --- a/charts/edb-postgres-distributed-for-kubernetes/templates/deployment.yaml +++ b/charts/edb-postgres-distributed-for-kubernetes/templates/deployment.yaml @@ -65,12 +65,12 @@ spec: - /manager env: - name: OPERATOR_IMAGE_NAME - value: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + value: "{{- include "edb-postgres-distributed-for-kubernetes.operatorImageName" . }}" - name: OPERATOR_NAMESPACE valueFrom: fieldRef: fieldPath: metadata.namespace - image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + image: "{{- include "edb-postgres-distributed-for-kubernetes.operatorImageName" . }}" imagePullPolicy: {{ .Values.image.pullPolicy }} livenessProbe: httpGet: diff --git a/charts/edb-postgres-distributed-for-kubernetes/values.yaml b/charts/edb-postgres-distributed-for-kubernetes/values.yaml index 24727d7..3eebf94 100644 --- a/charts/edb-postgres-distributed-for-kubernetes/values.yaml +++ b/charts/edb-postgres-distributed-for-kubernetes/values.yaml @@ -18,13 +18,20 @@ replicaCount: 1 +# -- Global values +global: + # -- Specifies the repository where the operator image to be downloaded from + # repository: docker.enterprisedb.com/k8s_standard_pgd + repository: docker.enterprisedb.com/k8s_enterprise_pgd + image: - # Additional Registries - # repository: docker.enterprisedb.com/k8s_standard_pgd/pg4k-pgd - repository: docker.enterprisedb.com/k8s_enterprise_pgd/pg4k-pgd - pullPolicy: IfNotPresent + repository: "" + # -- Specifies the name of the operator image to be pulled from repository + imageName: pg4k-pgd + # -- Specifies the tag of the operator image to be pulled from repository # -- Overrides the image tag whose default is the chart appVersion. - tag: "" + imageTag: "" + imagePullPolicy: IfNotPresent # Credentials configuration imageCredentials: # -- Specifies if an imagePullSecret should be created @@ -36,6 +43,7 @@ image: imagePullSecrets: - name: edb-pull-secret + nameOverride: "" fullnameOverride: "" @@ -158,16 +166,9 @@ cert-manager: enabled: true installCRDs: true -# edb-postgres-for-kubernetes-lts +# edb-postgres-for-kubernetes-lts subcharts edb-postgres-for-kubernetes-lts: enabled: true - image: - repository: docker.enterprisedb.com/k8s_enterprise_pgd/edb-postgres-for-kubernetes - imagePullSecrets: - - name: edb-pull-secret - config: - data: - PULL_SECRET_NAME: edb-pull-secret + repository: "" crds: - # -- Specifies whether the CRDs should be created when installing the chart. create: true