Skip to content

Commit

Permalink
Issue 589: Add imagePullSecrets for Helm hooks
Browse files Browse the repository at this point in the history
### Change log description

* Adds imagePullSecrets to the service accounts for the Helm hooks
* Follows the same principle as the service account for the operator
  taking global imagePullSecrets into account

### Purpose of the change

Fixes pravega#589

### What the code does

Adds imagePullSecrets to the YAML for the ServiceAccounts for the Helm
hooks. This is important when images are pulled from a private registry,
e.g. an internal proxy, such as Artifactory, or when using custom images.

### How to verify it

Render the templates using the following command:

```console
helm template zookeeper charts/zookeeper-operator \
    --show-only templates/post-install-upgrade-hooks.yaml \
    --show-only templates/pre-delete-hooks.yaml \
    --set hooks.serviceAccount.imagePullSecrets={'my-pull-secret'}
```

Signed-off-by: Reinhard Nägele <[email protected]>

# Please enter the commit message for your changes. Lines starting
# with '#' will be kept; you may remove them yourself if you want to.
# An empty message aborts the commit.
#
# Date:      Mon Jan 22 11:52:54 2024 +0100
#
# On branch issue-589-pull-creds-for-hook
# Your branch and 'origin/issue-589-pull-creds-for-hook' have diverged,
# and have 1 and 1 different commits each, respectively.
#
# Changes to be committed:
#	modified:   charts/zookeeper-operator/templates/post-install-upgrade-hooks.yaml
#	modified:   charts/zookeeper-operator/templates/pre-delete-hooks.yaml
#	modified:   charts/zookeeper-operator/values.yaml
#
  • Loading branch information
Reinhard Nägele committed Jan 22, 2024
1 parent 9fc6151 commit 7fa4bdb
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ metadata:
"helm.sh/hook": post-install, post-upgrade
"helm.sh/hook-weight": "1"
"helm.sh/hook-delete-policy": hook-succeeded, before-hook-creation, hook-failed
{{- if or .Values.global.imagePullSecrets .Values.hooks.serviceAccount.imagePullSecrets }}
imagePullSecrets:
{{- range (default .Values.global.imagePullSecrets .Values.hooks.serviceAccount.imagePullSecrets) }}
- name: {{ . }}
{{- end }}
{{- end }}

---

Expand Down
6 changes: 6 additions & 0 deletions charts/zookeeper-operator/templates/pre-delete-hooks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ metadata:
"helm.sh/hook": pre-delete
"helm.sh/hook-weight": "1"
"helm.sh/hook-delete-policy": hook-succeeded, before-hook-creation, hook-failed
{{- if or .Values.global.imagePullSecrets .Values.hooks.serviceAccount.imagePullSecrets }}
imagePullSecrets:
{{- range (default .Values.global.imagePullSecrets .Values.hooks.serviceAccount.imagePullSecrets) }}
- name: {{ . }}
{{- end }}
{{- end }}

---

Expand Down
4 changes: 4 additions & 0 deletions charts/zookeeper-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ tolerations: []
annotations: {}

hooks:
## Optionally specify an array of imagePullSecrets. Will override the global parameter if set
serviceAccount:
imagePullSecrets: []

backoffLimit: 10
image:
repository: lachlanevenson/k8s-kubectl
Expand Down

0 comments on commit 7fa4bdb

Please sign in to comment.