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 cusom images.

### How to verify it

Render the tem plates using the following commands:

```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.
#
# Author:    Krishnadas Menon <[email protected]>
# Date:      Mon Jan 22 14:32:23 2024 +0530
#
# On branch issue-589-pull-creds-for-hook
# 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
krishnadas-menon authored and Reinhard Nägele committed Jan 22, 2024
1 parent 9fc6151 commit 2abf49b
Show file tree
Hide file tree
Showing 3 changed files with 17 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
5 changes: 5 additions & 0 deletions charts/zookeeper-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ tolerations: []
annotations: {}

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

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

0 comments on commit 2abf49b

Please sign in to comment.