From 184448cf8bf0944a9be29d2d6c89b7c452776575 Mon Sep 17 00:00:00 2001 From: chriswldenyer Date: Thu, 16 May 2024 10:25:16 +0100 Subject: [PATCH] chore: mod path of image pull secret and use array Signed-off-by: chriswldenyer --- chart/README.md | 4 ++-- chart/README.md.tmpl | 4 ++-- chart/templates/_helpers.tpl | 16 ++++++++++++++-- chart/values.yaml | 10 +++------- 4 files changed, 21 insertions(+), 13 deletions(-) diff --git a/chart/README.md b/chart/README.md index 8750a60df..952af013d 100644 --- a/chart/README.md +++ b/chart/README.md @@ -16,7 +16,7 @@ Mayastor Helm chart for Kubernetes ``` - Create secret if downloading the container images from a private repo. ```sh - kubectl create secret docker-registry --docker-server="https://index.docker.io/v1/" --docker-username="" --docker-password="" --docker-email="" -n + kubectl create secret docker-registry --docker-server="https://index.docker.io/v1/" --docker-username="" --docker-password="" --docker-email="" -n ``` ### Installing the chart via the git repo @@ -102,7 +102,6 @@ This removes all the Kubernetes components associated with the chart and deletes | apis.​rest.​tolerations | Set tolerations, overrides global | `[]` | | base.​cache_poll_period | Cache timeout for core agent & diskpool deployment | `"30s"` | | base.​default_req_timeout | Request timeout for rest & core agents | `"5s"` | -| base.​imagePullSecrets.​enabled | Enable imagePullSecrets for pulling our container images | `false` | | base.​logging.​color | Enable ansi color code for Pod StdOut/StdErr | `true` | | base.​logging.​format | Valid values for format are pretty, json and compact | `"pretty"` | | base.​logging.​silenceLevel | Silence specific module components | `nil` | @@ -149,6 +148,7 @@ This removes all the Kubernetes components associated with the chart and deletes | etcd.​removeMemberOnContainerTermination | Use a PreStop hook to remove the etcd members from the etcd cluster on container termination Ignored if lifecycleHooks is set or replicaCount=1 | `false` | | etcd.​replicaCount | Number of replicas of etcd | `3` | | image.​pullPolicy | ImagePullPolicy for our images | `"Always"` | +| image.​pullSecrets | docker-secrets required to pull images if the container registry from image.registry is protected | `[]` | | image.​registry | Image registry to pull our product images | `"docker.io"` | | image.​repo | Image registry's namespace | `"openebs"` | | image.​tag | Release tag for our images | `"develop"` | diff --git a/chart/README.md.tmpl b/chart/README.md.tmpl index 52257f464..a7febf297 100644 --- a/chart/README.md.tmpl +++ b/chart/README.md.tmpl @@ -15,7 +15,7 @@ ``` - Create secret if downloading the container images from a private repo. ```sh - kubectl create secret docker-registry --docker-server="https://index.docker.io/v1/" --docker-username="" --docker-password="" --docker-email="" -n + kubectl create secret docker-registry --docker-server="https://index.docker.io/v1/" --docker-username="" --docker-password="" --docker-email="" -n ``` ### Installing the chart via the git repo @@ -42,7 +42,7 @@ $ helm install mymayastor mayastor/{{ template "chart.name" . }} ### Uninstall Helm Chart ```console -$ helm uninstall [RELEASE_NAME] +$ helm uninstall [RELEASE_NAME] ``` This removes all the Kubernetes components associated with the chart and deletes the release. diff --git a/chart/templates/_helpers.tpl b/chart/templates/_helpers.tpl index 495538e2d..8e6d37b9b 100644 --- a/chart/templates/_helpers.tpl +++ b/chart/templates/_helpers.tpl @@ -77,8 +77,20 @@ Usage: {{ include "base_pull_secrets" . }} */}} {{- define "base_pull_secrets" -}} - {{- if .Values.base.imagePullSecrets.enabled }} - {{- include "render" (dict "value" .Values.base.imagePullSecrets.secrets "context" $) | nindent 8 }} + {{- if (not (empty .Values.image.pullSecrets)) }} + {{- range .Values.image.pullSecrets | uniq -}} + {{ nindent 8 "- name:" }} {{ . }} + {{- end }} + {{- else -}} + {{- if .Values.base.imagePullSecrets }} + {{- if .Values.base.imagePullSecrets.enabled }} + {{- if (empty .Values.base.imagePullSecrets.secrets) }} + {{ nindent 8 "- name: login" }} + {{- else -}} + {{- include "render" (dict "value" .Values.base.imagePullSecrets.secrets "context" $) | nindent 8 }} + {{- end}} + {{- end }} + {{- end }} {{- end }} {{- end -}} diff --git a/chart/values.yaml b/chart/values.yaml index 2e693bd65..0804f1a31 100644 --- a/chart/values.yaml +++ b/chart/values.yaml @@ -26,6 +26,9 @@ image: # -- ImagePullPolicy for our images pullPolicy: Always + # -- docker-secrets required to pull images if the container registry from image.registry is protected + pullSecrets: [] + # -- Node labels for pod assignment # ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/ # Note that if multi-arch images support 'kubernetes.io/arch: amd64' @@ -87,13 +90,6 @@ base: - name: etcd-probe image: busybox:latest command: ['sh', '-c', 'trap "exit 1" TERM; until nc -vzw 5 {{ .Release.Name }}-etcd {{.Values.etcd.service.port}}; do date; echo "Waiting for etcd..."; sleep 1; done;'] - # docker-secrets required to pull images if the container registry from image.Registry is protected - imagePullSecrets: - # -- Enable imagePullSecrets for pulling our container images - enabled: false - # Name of the imagePullSecret in the installed namespace - secrets: - - name: login metrics: # -- Enable the metrics exporter