Skip to content

Commit 9ecb1be

Browse files
authored
Merge pull request #264 from inteon/helm_image_options
HELM: add options for configuring image
2 parents fda7f86 + 66377c7 commit 9ecb1be

File tree

4 files changed

+29
-4
lines changed

4 files changed

+29
-4
lines changed

deploy/charts/approver-policy/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,11 @@ A Helm chart for cert-manager-approver-policy
4040
| app.webhook.timeoutSeconds | int | `5` | Timeout of webhook HTTP request. |
4141
| app.webhook.tolerations | list | `[]` | https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/ |
4242
| commonLabels | object | `{}` | Optional allow custom labels to be placed on resources |
43+
| image.digest | string | `nil` | Target image digest. Will override any tag if set. for example: digest: sha256:0e072dddd1f7f8fc8909a2ca6f65e76c5f0d2fcfb8be47935ae3457e8bbceb20 |
4344
| image.pullPolicy | string | `"IfNotPresent"` | Kubernetes imagePullPolicy on Deployment. |
45+
| image.registry | string | `nil` | Target image registry. Will be prepended to the target image repositry if set. |
4446
| image.repository | string | `"quay.io/jetstack/cert-manager-approver-policy"` | Target image repository. |
45-
| image.tag | string | `""` | Target image version tag (if empty, Chart AppVersion will be used) |
47+
| image.tag | string | `nil` | Target image version tag. Defaults to the chart's appVersion. |
4648
| imagePullSecrets | list | `[]` | Optional secrets used for pulling the approver-policy container image. |
4749
| podAnnotations | object | `{}` | Optional allow custom annotations to be placed on cert-manager-approver pod |
4850
| replicaCount | int | `1` | Number of replicas of approver-policy to run. |

deploy/charts/approver-policy/templates/_helpers.tpl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,17 @@ app.kubernetes.io/managed-by: {{ .Release.Service }}
2727
{{ toYaml .Values.commonLabels }}
2828
{{- end }}
2929
{{- end -}}
30+
31+
{{/*
32+
Util function for generating the image URL based on the provided options.
33+
IMPORTANT: This function is standarized across all charts in the cert-manager GH organization.
34+
Any changes to this function should also be made in cert-manager, trust-manager, approver-policy, ...
35+
See https://github.com/cert-manager/cert-manager/issues/6329 for a list of linked PRs.
36+
*/}}
37+
{{- define "image" -}}
38+
{{- $defaultTag := index . 1 -}}
39+
{{- with index . 0 -}}
40+
{{- if .registry -}}{{ printf "%s/%s" .registry .repository }}{{- else -}}{{- .repository -}}{{- end -}}
41+
{{- if .digest -}}{{ printf "@%s" .digest }}{{- else -}}{{ printf ":%s" (default $defaultTag .tag) }}{{- end -}}
42+
{{- end }}
43+
{{- end }}

deploy/charts/approver-policy/templates/deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ spec:
3131
serviceAccountName: {{ include "cert-manager-approver-policy.name" . }}
3232
containers:
3333
- name: {{ include "cert-manager-approver-policy.name" . }}
34-
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
34+
image: "{{ template "image" (tuple .Values.image $.Chart.AppVersion) }}"
3535
imagePullPolicy: {{ .Values.image.pullPolicy }}
3636
ports:
3737
- containerPort: {{ .Values.app.webhook.port }}

deploy/charts/approver-policy/values.yaml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,17 @@ replicaCount: 1
44
image:
55
# -- Target image repository.
66
repository: quay.io/jetstack/cert-manager-approver-policy
7-
# -- Target image version tag (if empty, Chart AppVersion will be used)
8-
tag: ""
7+
# -- Target image registry. Will be prepended to the target image repositry if set.
8+
registry:
9+
10+
# -- Target image version tag. Defaults to the chart's appVersion.
11+
tag:
12+
13+
# -- Target image digest. Will override any tag if set.
14+
# for example:
15+
# digest: sha256:0e072dddd1f7f8fc8909a2ca6f65e76c5f0d2fcfb8be47935ae3457e8bbceb20
16+
digest:
17+
918
# -- Kubernetes imagePullPolicy on Deployment.
1019
pullPolicy: IfNotPresent
1120

0 commit comments

Comments
 (0)