From 06ac3d18507297854a37e7aaa444e36aeb4b31ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Bosdonnat?= Date: Sat, 5 Oct 2024 14:50:53 +0200 Subject: [PATCH 1/3] Remove the chart build tag containing the release number The release number causes issues with the OBS publish script as that would require deleting old releases... which is not permitted. --- containers/proxy-helm/proxy-helm.changes.cbosdo | 1 + containers/server-helm/server-helm.changes.cbosdo | 1 + rel-eng/chart_push.sh | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 containers/proxy-helm/proxy-helm.changes.cbosdo create mode 100644 containers/server-helm/server-helm.changes.cbosdo diff --git a/containers/proxy-helm/proxy-helm.changes.cbosdo b/containers/proxy-helm/proxy-helm.changes.cbosdo new file mode 100644 index 000000000000..95cfadaaa2d6 --- /dev/null +++ b/containers/proxy-helm/proxy-helm.changes.cbosdo @@ -0,0 +1 @@ +- Remove the build tag with the release number diff --git a/containers/server-helm/server-helm.changes.cbosdo b/containers/server-helm/server-helm.changes.cbosdo new file mode 100644 index 000000000000..95cfadaaa2d6 --- /dev/null +++ b/containers/server-helm/server-helm.changes.cbosdo @@ -0,0 +1 @@ +- Remove the build tag with the release number diff --git a/rel-eng/chart_push.sh b/rel-eng/chart_push.sh index 156fa9dbb9f0..bb52f8d9fe8e 100644 --- a/rel-eng/chart_push.sh +++ b/rel-eng/chart_push.sh @@ -50,7 +50,7 @@ if [ -f "${SRPM_PKG_DIR}/Chart.yaml" ]; then # Remove leading zero from Uyuni release and add potentially missing micro part SEMANTIC_VERSION=$(echo ${PRODUCT_VERSION} | sed 's/\([0-9]\+\)\.0\?\([1-9][0-9]*\)\(\.\([0-9]\+\)\)\?\( .\+\)\?/\1.\2.\4\5/' | sed 's/\.$/.0/') # Also include the semantic version since helm chart wants it for OCI repos (those generated by OBS) - sed "/^#\!BuildTag:/ s/$/ ${NAME}:${SEMANTIC_VERSION} ${NAME}:${PRODUCT_VERSION} ${NAME}:${PRODUCT_VERSION}.%RELEASE%/" -i ${SRPM_PKG_DIR}/Chart.yaml + sed "/^#\!BuildTag:/ s/$/ ${NAME}:${SEMANTIC_VERSION} ${NAME}:${PRODUCT_VERSION}" -i ${SRPM_PKG_DIR}/Chart.yaml rm ${SRPM_PKG_DIR}/${PKG_NAME}.spec fi From 17aa84806e72bdb54524f80702483975fcfd469d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Bosdonnat?= Date: Sat, 5 Oct 2024 06:13:59 -0700 Subject: [PATCH 2/3] Fix the labels indentation in the helm charts labels are in the metadata section instead of the root of the YAML. Moving them back to the expected place to avoid (non-blocking) errors when applying the helm chart. --- containers/proxy-helm/proxy-helm.changes.cbosdo.helm-fixes | 1 + containers/proxy-helm/templates/deployment.yaml | 4 ++-- containers/server-helm/server-helm.changes.cbosdo.helm-fixes | 1 + containers/server-helm/templates/deployment.yaml | 4 ++-- 4 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 containers/proxy-helm/proxy-helm.changes.cbosdo.helm-fixes create mode 100644 containers/server-helm/server-helm.changes.cbosdo.helm-fixes diff --git a/containers/proxy-helm/proxy-helm.changes.cbosdo.helm-fixes b/containers/proxy-helm/proxy-helm.changes.cbosdo.helm-fixes new file mode 100644 index 000000000000..0c4f4ff26ba6 --- /dev/null +++ b/containers/proxy-helm/proxy-helm.changes.cbosdo.helm-fixes @@ -0,0 +1 @@ +- Fix labels indentation (bsc#1231150) diff --git a/containers/proxy-helm/templates/deployment.yaml b/containers/proxy-helm/templates/deployment.yaml index c127f02c2035..70c89a233991 100644 --- a/containers/proxy-helm/templates/deployment.yaml +++ b/containers/proxy-helm/templates/deployment.yaml @@ -3,8 +3,8 @@ kind: Deployment metadata: name: uyuni-proxy namespace: "{{ .Release.Namespace }}" -labels: - app: uyuni-proxy + labels: + app: uyuni-proxy spec: replicas: 1 selector: diff --git a/containers/server-helm/server-helm.changes.cbosdo.helm-fixes b/containers/server-helm/server-helm.changes.cbosdo.helm-fixes new file mode 100644 index 000000000000..0c4f4ff26ba6 --- /dev/null +++ b/containers/server-helm/server-helm.changes.cbosdo.helm-fixes @@ -0,0 +1 @@ +- Fix labels indentation (bsc#1231150) diff --git a/containers/server-helm/templates/deployment.yaml b/containers/server-helm/templates/deployment.yaml index 4f1c65a56cda..592ed499ef7c 100644 --- a/containers/server-helm/templates/deployment.yaml +++ b/containers/server-helm/templates/deployment.yaml @@ -3,8 +3,8 @@ kind: Deployment metadata: name: uyuni namespace: "{{ .Release.Namespace }}" -labels: - app: uyuni + labels: + app: uyuni spec: replicas: 1 selector: From 707787989e4a1f71741208099e469febcb60b8a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Bosdonnat?= Date: Sat, 5 Oct 2024 06:24:19 -0700 Subject: [PATCH 3/3] Add registry secret authentication value to helm charts If the images are stored in a registry requiring authentication the pod needs to have imagePullSecrets defined. --- containers/proxy-helm/proxy-helm.changes.cbosdo.helm-fixes | 2 ++ containers/proxy-helm/templates/deployment.yaml | 4 ++++ containers/proxy-helm/values.yaml | 4 ++++ containers/server-helm/server-helm.changes.cbosdo.helm-fixes | 2 ++ containers/server-helm/templates/deployment.yaml | 4 ++++ containers/server-helm/values.yaml | 4 ++++ 6 files changed, 20 insertions(+) diff --git a/containers/proxy-helm/proxy-helm.changes.cbosdo.helm-fixes b/containers/proxy-helm/proxy-helm.changes.cbosdo.helm-fixes index 0c4f4ff26ba6..a8f88132d41d 100644 --- a/containers/proxy-helm/proxy-helm.changes.cbosdo.helm-fixes +++ b/containers/proxy-helm/proxy-helm.changes.cbosdo.helm-fixes @@ -1 +1,3 @@ +- Add registrySecret value to the helm chart for authentication + (bsc#1231157) - Fix labels indentation (bsc#1231150) diff --git a/containers/proxy-helm/templates/deployment.yaml b/containers/proxy-helm/templates/deployment.yaml index 70c89a233991..ab80ff2e587f 100644 --- a/containers/proxy-helm/templates/deployment.yaml +++ b/containers/proxy-helm/templates/deployment.yaml @@ -15,6 +15,10 @@ spec: labels: app: uyuni-proxy spec: +{{- if .Values.registrySecret }} + imagePullSecrets: + - name: {{ .Values.registrySecret }} +{{- end }} containers: - name: httpd image: {{- include "deployment.container.image" (dict "name" "proxy-httpd" "global" .) | indent 1}} diff --git a/containers/proxy-helm/values.yaml b/containers/proxy-helm/values.yaml index 0bb54e938205..58aff4faa958 100644 --- a/containers/proxy-helm/values.yaml +++ b/containers/proxy-helm/values.yaml @@ -17,6 +17,10 @@ images: ## pullPolicy: "Always" +## registrySecret defines the name of secret to use to pull the images from the +## registry with authentication. Leave empty for no authentication. +registrySecret: "" + ## ingress defines the ingress that is used in the cluster. ## It can be either "nginx", "traefik" or any other value. ingress: "traefik" diff --git a/containers/server-helm/server-helm.changes.cbosdo.helm-fixes b/containers/server-helm/server-helm.changes.cbosdo.helm-fixes index 0c4f4ff26ba6..a8f88132d41d 100644 --- a/containers/server-helm/server-helm.changes.cbosdo.helm-fixes +++ b/containers/server-helm/server-helm.changes.cbosdo.helm-fixes @@ -1 +1,3 @@ +- Add registrySecret value to the helm chart for authentication + (bsc#1231157) - Fix labels indentation (bsc#1231150) diff --git a/containers/server-helm/templates/deployment.yaml b/containers/server-helm/templates/deployment.yaml index 592ed499ef7c..d275083dfdf0 100644 --- a/containers/server-helm/templates/deployment.yaml +++ b/containers/server-helm/templates/deployment.yaml @@ -15,6 +15,10 @@ spec: labels: app: uyuni spec: +{{- if .Values.registrySecret }} + imagePullSecrets: + - name: {{ .Values.registrySecret }} +{{- end }} initContainers: {{- if not .Values.migration }} - name: init-etc-tls diff --git a/containers/server-helm/values.yaml b/containers/server-helm/values.yaml index f954b6ee9798..c55f6aab1455 100644 --- a/containers/server-helm/values.yaml +++ b/containers/server-helm/values.yaml @@ -13,6 +13,10 @@ images: ## pullPolicy: "IfNotPresent" +## registrySecret defines the name of secret to use to pull the images from the +## registry with authentication. Leave empty for no authentication. +registrySecret: "" + ## uyuni server overall Persistent Volume access modes ## Must match those of existing PV or dynamic provisioner ## Ref: http://kubernetes.io/docs/user-guide/persistent-volumes/