From 6b22ba210a6811231a7f20cecde8a8654c404386 Mon Sep 17 00:00:00 2001 From: Pablo Vigo <pvigo@collabora.com> Date: Fri, 10 May 2024 12:48:07 +0200 Subject: [PATCH 1/2] add publish image in values Currently, the publish Docker image is hardcoded in the statefulset file. It is necessary to parameterize it in the values file to have the option of using another Docker image if needed. Some instances of aptly require OpenID Connect authentication, and it is necessary to use a specific image with support for this authentication. Signed-off-by: Pablo Vigo <pvigo@collabora.com> --- chart/templates/statefulset.yaml | 4 ++-- chart/values.yaml | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/chart/templates/statefulset.yaml b/chart/templates/statefulset.yaml index c8066fbf..f6796f4c 100644 --- a/chart/templates/statefulset.yaml +++ b/chart/templates/statefulset.yaml @@ -76,8 +76,8 @@ spec: - name: {{ .Chart.Name }}-publish securityContext: {{- toYaml .Values.securityContext | nindent 12 }} - image: docker.io/library/httpd:2.4 - imagePullPolicy: {{ .Values.image.pullPolicy }} + image: "{{ .Values.publish.image.repository }}:{{ .Values.publish.image.tag }}" + imagePullPolicy: {{ .Values.publish.image.pullPolicy }} ports: - name: http containerPort: 80 diff --git a/chart/values.yaml b/chart/values.yaml index 5ed215dd..fb310320 100644 --- a/chart/values.yaml +++ b/chart/values.yaml @@ -25,6 +25,10 @@ api: # - -no-lock publish: + image: + repository: docker.io/library/httpd + pullPolicy: IfNotPresent + tag: 2.4 config: before_modules: '' after_modules: '' -- GitLab From ff2346f2e94c5e88f675f907eee72963000e5da9 Mon Sep 17 00:00:00 2001 From: Pablo Vigo <pvigo@collabora.com> Date: Fri, 10 May 2024 12:59:31 +0200 Subject: [PATCH 2/2] put image in container-specific sections The aptly API image was declared outside the specific API section. Considering that the statefulset file has 2 containers with different images, this made the image configuration confusing. Now, the image name is within the specific API section, making the values file more understandable and avoiding confusion. Signed-off-by: Pablo Vigo <pvigo@collabora.com> --- chart/templates/statefulset.yaml | 5 +++-- chart/values.yaml | 10 ++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/chart/templates/statefulset.yaml b/chart/templates/statefulset.yaml index f6796f4c..e0a24812 100644 --- a/chart/templates/statefulset.yaml +++ b/chart/templates/statefulset.yaml @@ -39,8 +39,9 @@ spec: {{- toYaml .Values.api.extraEnvVars | nindent 12 }} securityContext: {{- toYaml .Values.securityContext | nindent 12 }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" - imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- $image_compat := .Values.image | default (dict "repository" "") }} + image: "{{ $image_compat.repository | default .Values.api.image.repository }}:{{ $image_compat.tag | default .Values.api.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.api.image.pullPolicy }} args: - -config=/aptly/config/aptly.conf {{- if .Values.api.extraArgs }} diff --git a/chart/values.yaml b/chart/values.yaml index fb310320..f0418d51 100644 --- a/chart/values.yaml +++ b/chart/values.yaml @@ -4,13 +4,11 @@ replicaCount: 1 -# TODO: put 'image' in container-specific sections, for consistency -image: - repository: registry.gitlab.collabora.com/obs/aptly - pullPolicy: IfNotPresent - tag: main - api: + image: + repository: registry.gitlab.collabora.com/obs/aptly + pullPolicy: IfNotPresent + tag: main resources: {} # Go runtime configuration variables can be set here, e.g.: # extraEnvVars: -- GitLab