From 40e94559a955ebe2d98c38cf806d9cbc003a763c Mon Sep 17 00:00:00 2001 From: Tao Li Date: Tue, 3 Dec 2024 11:37:27 +0800 Subject: [PATCH] feat: use single path for PGD and PGD proxy image Signed-off-by: Tao Li --- README.md | 35 ++++++++++++++----- RELEASE.md | 5 +++ .../README.md | 10 ++++-- .../templates/_helpers.tpl | 17 +++++++++ .../templates/config.yaml | 4 +-- .../values.schema.json | 6 ++++ .../values.yaml | 26 +++++++++----- 7 files changed, 81 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 151987e..23aa3db 100644 --- a/README.md +++ b/README.md @@ -219,11 +219,8 @@ invocation. The following example uses the `k8s_standard_pgd` registry in `docker.enterprisedb.com`. Following is the description of set options. -- `global.repository`: The repository where the PG4K-PGD and PG4K operator image are downloaded from. -This is a global setting, which is shared for both PG4K-PGD and PG4K operators. -- `PGD_IMAGE_NAME`: The location where the PGD image are pulled from. -- `PGD_PROXY_IMAGE_NAME`: The location where PGD Proxy image are pulled from, usually -the same with `PGD_IMAGE_NAME`. +- `global.repository`: The repository where the operator and operand image are downloaded from. +This is a global setting, which is shared for both PG4K-PGD and PG4K operators and pgd operands. Assuming that you have your necessary credentials, please fill in the USERNAME and PASSWORD below. @@ -236,11 +233,33 @@ helm upgrade --dependency-update \ edb/edb-postgres-distributed-for-kubernetes \ --set image.imageCredentials.username=${USERNAME} \ --set image.imageCredentials.password=${PASSWORD} \ - --set global.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 + --set global.repository=docker.enterprisedb.com/k8s_standard_pgd ``` +If we want to use different flavor or different version of PGD image, we can set the following two +global options, for each helm chart release, the PGD and PGD proxy are upgrade to latest well-tested +versions, by default, the PGD image here is using postgresql-pgd. + +- `pgdImageName`: The PGD image name to be used by the operator. PGD image with this name will be + pulled from `global.repository`. +- `proxyImageName`: The PGD proxy image name to be used by the operator. PGD proxy image with +this name will be pulled from `global.repository`. + +This example uses the `edb-postgres-advanced-pgd` PGD images. + +```console +helm upgrade --dependency-update \ + --install edb-pg4k-pgd \ + --namespace pgd-operator-system \ + --create-namespace \ + edb/edb-postgres-distributed-for-kubernetes \ + --set image.imageCredentials.username=${USERNAME} \ + --set image.imageCredentials.password=${PASSWORD} \ + --set global.pgdImageName=edb-postgres-advanced-pgd:16.4.1-5.5.1-1 \ + --set global.proxyImageName=edb-pgd-proxy:5.5.0 +``` + + ## Deployment using local chart ### Deployment PG4K using local chart diff --git a/RELEASE.md b/RELEASE.md index 48ff980..eaa5c7a 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -86,6 +86,11 @@ follow these steps: 1. update PGD_IMAGE_NAME and PGD_PROXY_IMAGE_NAME defaults inside `charts/edb-postgres-distributed-for-kubernetes/values.yaml` according to the default versions present in the release. + 1. update the `.appVersion` and `.verions` in subchart + `./charts/edb-postgres-distributed-for-kubernetes/charts/edb-postgres-for-kubernetes-lts`, + and follow the [EPK Release](#how-to-release-the-edb-postgres-for-kubernetes-chart) to update + the subchart to latest PG4K lts release. + From here onward, you can follow the steps of the [EPK Release](#how-to-release-the-edb-postgres-for-kubernetes-chart), starting from `point 6`. diff --git a/charts/edb-postgres-distributed-for-kubernetes/README.md b/charts/edb-postgres-distributed-for-kubernetes/README.md index 09cfc0e..6371210 100644 --- a/charts/edb-postgres-distributed-for-kubernetes/README.md +++ b/charts/edb-postgres-distributed-for-kubernetes/README.md @@ -36,8 +36,8 @@ EDB Postgres Distributed for Kubernetes Helm Chart | cert-manager.installCRDs | bool | `true` | | | commonAnnotations | object | `{}` | Annotations to be added to all other resources | | config.create | bool | `true` | Specifies whether the secret should be created | -| config.data.PGD_IMAGE_NAME | string | `"docker.enterprisedb.com/k8s_enterprise_pgd/postgresql-pgd:16.4-5.5.1-1"` | Specifies the location of the pgd image to be used for the operator docker.enterprisedb.com/k8s_standard_pgd/postgresql-pgd:16.4-5.5.1-1 | -| config.data.PGD_PROXY_IMAGE_NAME | string | `"docker.enterprisedb.com/k8s_enterprise_pgd/edb-pgd-proxy:5.5.0"` | Specifies the location of the pgd-proxy image to be used for the operator docker.enterprisedb.com/k8s_standard_pgd/edb-pgd-proxy:5.5.0 | +| config.data.PGD_IMAGE_NAME | string | `""` | Specifies the location of the pgd image (include path) to be used for the operator, this will overwrite the global repository/pgdImageName | +| config.data.PGD_PROXY_IMAGE_NAME | string | `""` | Specifies the location of the pgd image (include path) to be used for the operator, this will overwrite the global repository/pgdImageName| | config.data.PULL_SECRET_NAME | string | `"edb-pull-secret"` | | | config.name | string | `"pgd-operator-controller-manager-config"` | | | config.secret | bool | `false` | Specifies whether it should be stored in a secret, instead of a configmap | @@ -48,7 +48,11 @@ EDB Postgres Distributed for Kubernetes Helm Chart | edb-postgres-for-kubernetes-lts.image.repository | string | `""` | | | fullnameOverride | string | `""` | | | global | object | `{"repository":"docker.enterprisedb.com/k8s_enterprise_pgd"}` | Global values | -| global.repository | string | `"docker.enterprisedb.com/k8s_enterprise_pgd"` | Specifies the repository where the operator image to be downloaded from repository: docker.enterprisedb.com/k8s_standard_pgd | +| global.repository | string | `"docker.enterprisedb.com/k8s_enterprise_pgd"` | Specifies the repository where the operator image to be downloaded from. Another repository is: docker.enterprisedb.com/k8s_standard_pgd | +| global.pgdImageName | string | `"postgresql-pgd:16.4-5.5.1-1"` | Specifies the name of pgd image to be used for the operator, this image will be downloaded from +global repository | +| global.proxyImageName | string | `"edb-pgd-proxy:5.5.0"` | Specifies the name of pgd-proxy image to be used for the operator, this image will be downloaded from +global repository | | image.imageCredentials.create | bool | `true` | Specifies if an imagePullSecret should be created | | image.imageCredentials.name | string | `"edb-pull-secret"` | | | image.imageCredentials.password | string | `""` | | diff --git a/charts/edb-postgres-distributed-for-kubernetes/templates/_helpers.tpl b/charts/edb-postgres-distributed-for-kubernetes/templates/_helpers.tpl index c17679a..c3cd5f1 100644 --- a/charts/edb-postgres-distributed-for-kubernetes/templates/_helpers.tpl +++ b/charts/edb-postgres-distributed-for-kubernetes/templates/_helpers.tpl @@ -41,6 +41,23 @@ Create the pg4k-pgd operator image name {{- end }} {{- end }} + +{{/* +Create the pgd and pgd proxy operand image name in configmap +*/}} +{{- define "edb-postgres-distributed-for-kubernetes.configData" }} +{{- if not .Values.config.data.PGD_IMAGE_NAME }} +{{- $_ := set .Values.config.data "PGD_IMAGE_NAME" (printf "%s/%s" .Values.global.repository .Values.global.pgdImageName) }} +{{- end }} +{{- if not .Values.config.data.PGD_PROXY_IMAGE_NAME }} +{{- $_ := set .Values.config.data "PGD_PROXY_IMAGE_NAME" (printf "%s/%s" .Values.global.repository .Values.global.proxyImageName) }} +{{- end }} +{{- with .Values.config.data }} +{{- toYaml . }} +{{- end }} +{{- end }} + + {{/* Common labels */}} diff --git a/charts/edb-postgres-distributed-for-kubernetes/templates/config.yaml b/charts/edb-postgres-distributed-for-kubernetes/templates/config.yaml index 670e4a3..16f591e 100644 --- a/charts/edb-postgres-distributed-for-kubernetes/templates/config.yaml +++ b/charts/edb-postgres-distributed-for-kubernetes/templates/config.yaml @@ -25,7 +25,7 @@ metadata: {{- toYaml . | nindent 4 }} {{- end }} data: - {{- toYaml .Values.config.data | nindent 2 }} + {{- include "edb-postgres-distributed-for-kubernetes.configData" . | nindent 2 }} {{- else }} apiVersion: v1 kind: Secret @@ -39,6 +39,6 @@ metadata: {{- toYaml . | nindent 4 }} {{- end }} stringData: - {{- toYaml .Values.config.data | nindent 2 }} + {{- include "edb-postgres-distributed-for-kubernetes.configData" . | nindent 2 }} {{- end }} {{- end }} diff --git a/charts/edb-postgres-distributed-for-kubernetes/values.schema.json b/charts/edb-postgres-distributed-for-kubernetes/values.schema.json index 9171b70..65ab7dc 100644 --- a/charts/edb-postgres-distributed-for-kubernetes/values.schema.json +++ b/charts/edb-postgres-distributed-for-kubernetes/values.schema.json @@ -118,6 +118,12 @@ "properties": { "repository": { "type": "string" + }, + "pgdImageName": { + "type": "string" + }, + "proxyImageName": { + "type": "string" } } }, diff --git a/charts/edb-postgres-distributed-for-kubernetes/values.yaml b/charts/edb-postgres-distributed-for-kubernetes/values.yaml index 3c99f2d..9ca1b6d 100644 --- a/charts/edb-postgres-distributed-for-kubernetes/values.yaml +++ b/charts/edb-postgres-distributed-for-kubernetes/values.yaml @@ -20,11 +20,19 @@ replicaCount: 1 # -- Global values global: - # -- Specifies the repository where the operator image to be downloaded from + # -- Specifies the repository where the operator and operand image to be downloaded from # repository: docker.enterprisedb.com/k8s_standard_pgd repository: docker.enterprisedb.com/k8s_enterprise_pgd - + # -- Specifies the pgd image name to be used for the operator, the image will be downloaded from + # global repository + pgdImageName: postgresql-pgd:16.4-5.5.1-1 + # -- Specifies the pgd-proxy image name to be used for the operator, the image will be downloaded from + # global repository + proxyImageName: edb-pgd-proxy:5.5.0 + +# -- operator image configuration image: + # -- Specifies the repository of the pgd operator image, this will overwrite the global repository repository: "" # -- Specifies the name of the operator image to be pulled from repository imageName: pg4k-pgd @@ -84,15 +92,14 @@ config: create: true # -- Specifies whether it should be stored in a secret, instead of a configmap secret: false - data: PULL_SECRET_NAME: edb-pull-secret - # -- Specifies the location of the pgd image to be used for the operator - # docker.enterprisedb.com/k8s_standard_pgd/postgresql-pgd:16.4-5.5.1-1 - PGD_IMAGE_NAME: docker.enterprisedb.com/k8s_enterprise_pgd/postgresql-pgd:16.4-5.5.1-1 - # -- Specifies the location of the pgd-proxy image to be used for the operator - # docker.enterprisedb.com/k8s_standard_pgd/edb-pgd-proxy:5.5.0 - PGD_PROXY_IMAGE_NAME: docker.enterprisedb.com/k8s_enterprise_pgd/edb-pgd-proxy:5.5.0 + # -- Specifies the location of the pgd image (include path) to be used for the operator + # this will overwrite the global repository/pgdImageName + PGD_IMAGE_NAME: "" + # -- Specifies the location of the pgd-proxy image (include path) to be used for the operator + # this will overwrite the global repository/proxyImageName + PGD_PROXY_IMAGE_NAME: "" name: pgd-operator-controller-manager-config # -- Additional arguments to be added to the operator's args list @@ -170,6 +177,7 @@ cert-manager: edb-postgres-for-kubernetes-lts: enabled: true image: + # -- Specifies the repository of the pg4k operator image, this will overwrite the global repository repository: "" crds: create: true