Skip to content

Commit

Permalink
Use the same logic for generating image ref as for other cert-manager…
Browse files Browse the repository at this point in the history
… charts

Signed-off-by: Jack Henschel <[email protected]>
  • Loading branch information
jacksgt committed Oct 9, 2023
1 parent 5e24c55 commit 4f2d397
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 14 deletions.
3 changes: 3 additions & 0 deletions deploy/chart/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ type: application
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0

# This is the version of the application, i.e. openshift-routes
appVersion: 0.2.0
14 changes: 8 additions & 6 deletions deploy/chart/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,16 @@ Create the name of the service account to use
{{- end }}
{{- end }}


{{/*
The final, full image reference
Util function for generating the image URL based on the provided options.
IMPORTANT: This function is standarized across all charts in the cert-manager GH organization.
Any changes to this function should also be made in cert-manager, trust-manager, approver-policy, ...
See https://github.com/cert-manager/cert-manager/issues/6329 for a list of linked PRs.
*/}}
{{- define "openshift-routes.image" -}}
{{- if .Values.image.digest }}
{{- .Values.image.registry }}/{{ .Values.image.repository }}@{{ .Values.image.digest }}
{{- else }}
{{- printf "%s/%s:%s" .Values.image.registry .Values.image.repository .Values.image.tag }}
{{- $defaultTag := index . 1 -}}
{{- with index . 0 -}}
{{- if .registry -}}{{ printf "%s/%s" .registry .repository }}{{- else -}}{{- .repository -}}{{- end -}}
{{- if .digest -}}{{ printf "@%s" .digest }}{{- else -}}{{ printf ":%s" (default $defaultTag .tag) }}{{- end -}}
{{- end }}
{{- end }}
2 changes: 1 addition & 1 deletion deploy/chart/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spec:
- name: openshift-routes
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: {{ include "openshift-routes.image" . }}
image: "{{ template "openshift-routes.image" (tuple .Values.image $.Chart.AppVersion) }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- "-v={{ .Values.logLevel }}"
Expand Down
22 changes: 15 additions & 7 deletions deploy/chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,21 @@ fullnameOverride: ""

image:
# https://github.com/cert-manager/openshift-routes/pkgs/container/cert-manager-openshift-routes
registry: ghcr.io
repository: cert-manager/cert-manager-openshift-routes
# the final image is generated as "${registry}/${repostiory}:${tag}"
tag: "0.2.0"
# if "digest" is set, overrides "tag"
# digest: "sha256:..."
pullPolicy: IfNotPresent
# the final image is generated as "${registry}/${repostiory}:${tag|digest}"

# -- Target image repository.
repository: ghcr.io/cert-manager/cert-manager-openshift-routes
# -- Target image registry. Will be prepended to the target image repositry if set.
registry:

# -- Target image version tag. Defaults to the chart's appVersion.
tag:

# -- Target image digest. Will override any tag if set.
# for example:
# digest: sha256:0e072dddd1f7f8fc8909a2ca6f65e76c5f0d2fcfb8be47935ae3457e8bbceb20
digest:


imagePullSecrets: []

Expand Down

0 comments on commit 4f2d397

Please sign in to comment.