Skip to content

Commit 443e208

Browse files
committed
values: refactor image block
1 parent c20baf5 commit 443e208

8 files changed

+87
-6
lines changed

charts/invenio/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
apiVersion: v2
22
name: invenio
3-
appVersion: v12.0.0-beta.1.3
3+
appVersion: v12.0.10
44
description: Turn-key research data management platform.
55
home: https://inveniosoftware.org/
66
icon: https://inveniosoftware.org/static/img/logo-invenio-white.svg

charts/invenio/templates/NOTES.txt

+16
Original file line numberDiff line numberDiff line change
@@ -116,3 +116,19 @@ DEPRECATION WARNING:
116116
Use `invenio.extraEnvFrom` or `invenio.extraEnvVars` instead.
117117

118118
{{- end }}
119+
120+
{{- if or .Values.web.image .Values.worker.image }}
121+
122+
DEPRECATION WARNING:
123+
`<service>.image` has been removed in favor of `image` and it will be
124+
removed in a future release.
125+
126+
{{- end }}
127+
128+
{{- if or .Values.web.imagePullSecret .Values.worker.imagePullSecret }}
129+
130+
DEPRECATION WARNING:
131+
`<service>.imagePullSecret` has been removed in favor of
132+
`image.pullSecrets` and it will be removed in a future release.
133+
134+
{{- end }}

charts/invenio/templates/_helpers.tpl

+17
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,23 @@ app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
5050
app.kubernetes.io/managed-by: {{ .Release.Service }}
5151
{{- end }}
5252

53+
{{/*
54+
Return the proper Invenio image name
55+
*/}}
56+
{{- define "invenio.image" -}}
57+
{{- $registryName := required "Missing .Values.image.registry" .Values.image.registry -}}
58+
{{- $repositoryName := required "Missing .Values.image.repository" .Values.image.repository -}}
59+
{{- $separator := ":" -}}
60+
{{- $termination := .Values.image.tag | default .Chart.AppVersion | toString -}}
61+
62+
{{- if .Values.image.digest }}
63+
{{- $separator = "@" -}}
64+
{{- $termination = .Values.image.digest | toString -}}
65+
{{- end -}}
66+
67+
{{- printf "%s/%s%s%s" $registryName $repositoryName $separator $termination -}}
68+
{{- end -}}
69+
5370
########################### Invenio hostname ###########################
5471
{{/*
5572
This template renders the hostname for Invenio.

charts/invenio/templates/install-init-job.yaml

+6-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ spec:
2424
spec:
2525
containers:
2626
- name: install-init
27-
image: {{ required "Missing .Values.web.image" .Values.web.image }}
27+
image: {{ default .Values.web.image (include "invenio.image" .) }}
28+
imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
2829
command: [
2930
"/bin/bash",
3031
"-c",
@@ -64,4 +65,8 @@ spec:
6465
imagePullSecrets:
6566
- name: {{ .Values.web.imagePullSecret }}
6667
{{- end }}
68+
{{- with .Values.image.pullSecrets }}
69+
imagePullSecrets:
70+
{{- toYaml . | nindent 8 }}
71+
{{- end }}
6772
{{- end }}

charts/invenio/templates/web-deployment.yaml

+8-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ spec:
2727
{{- end }}
2828
containers:
2929
- name: web
30-
image: {{ required "Missing .Values.web.image" .Values.web.image }}
30+
image: {{ default .Values.web.image (include "invenio.image" .) }}
31+
imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
3132
command: [
3233
"/bin/bash",
3334
"-c",
@@ -199,7 +200,8 @@ spec:
199200
initContainers:
200201
# copy assets from uwsgi to nginx
201202
- name: copy-web-assets
202-
image: {{ required "Missing .Values.web.image" .Values.web.image }}
203+
image: {{ default .Values.web.image (include "invenio.image" .) }}
204+
imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
203205
command: [
204206
"/bin/bash",
205207
"-c",
@@ -275,3 +277,7 @@ spec:
275277
imagePullSecrets:
276278
- name: {{ .Values.web.imagePullSecret }}
277279
{{- end }}
280+
{{- with .Values.image.pullSecrets }}
281+
imagePullSecrets:
282+
{{- toYaml . | nindent 8 }}
283+
{{- end }}

charts/invenio/templates/worker-beat-deployment.yaml

+6-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ spec:
2626
{{- end }}
2727
containers:
2828
- name: worker-beat
29-
image: {{ required "Missing .Values.worker.image" .Values.worker.image }}
29+
image: {{ default .Values.worker.image (include "invenio.image" .) }}
30+
imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
3031
command: [
3132
"/bin/bash",
3233
"-c",
@@ -110,5 +111,9 @@ spec:
110111
imagePullSecrets:
111112
- name: {{ .Values.worker.imagePullSecret }}
112113
{{- end }}
114+
{{- with .Values.image.pullSecrets }}
115+
imagePullSecrets:
116+
{{- toYaml . | nindent 8 }}
117+
{{- end }}
113118
strategy:
114119
type: Recreate # For data safety, beat must never have more than 1 replica!

charts/invenio/templates/worker-deployment.yaml

+6-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ spec:
2626
{{- end }}
2727
containers:
2828
- name: worker
29-
image: {{ required "Missing .Values.worker.image" .Values.worker.image }}
29+
image: {{ default .Values.worker.image (include "invenio.image" .) }}
30+
imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
3031
command: [
3132
"/bin/bash",
3233
"-c",
@@ -156,3 +157,7 @@ spec:
156157
imagePullSecrets:
157158
- name: {{ .Values.worker.imagePullSecret }}
158159
{{- end }}
160+
{{- with .Values.image.pullSecrets }}
161+
imagePullSecrets:
162+
{{- toYaml . | nindent 8 }}
163+
{{- end }}

charts/invenio/values.yaml

+27
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,33 @@ nameOverride: ""
1010
##
1111
fullnameOverride: ""
1212

13+
## Invenio image version
14+
## ref: https://github.com/inveniosoftware/demo-inveniordm/pkgs/container/demo-inveniordm%2Fdemo-inveniordm
15+
## @param image.registry Invenio image registry
16+
## @param image.repository Invenio image repository
17+
## @skip image.tag Invenio image tag (immutable tags are recommended)
18+
## @param image.digest Invenio image digest in the way sha256:aa.... Please note this parameter, if set, will override the tag
19+
## @param image.pullPolicy Invenio image pull policy
20+
## @param image.pullSecrets Invenio image pull secrets
21+
image:
22+
registry: ghrc.io
23+
repository: inveniosoftware/demo-inveniordm
24+
tag: demo-inveniordm:12.0.10
25+
digest: ""
26+
## Specify a imagePullPolicy
27+
## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
28+
## ref: https://kubernetes.io/docs/concepts/containers/images/#pre-pulled-images
29+
##
30+
pullPolicy: IfNotPresent
31+
## Optionally specify an array of imagePullSecrets.
32+
## Secrets must be manually created in the namespace.
33+
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
34+
## e.g:
35+
## pullSecrets:
36+
## - myRegistryKeySecretName
37+
##
38+
pullSecrets: []
39+
1340
ingress:
1441
annotations: {}
1542
enabled: false

0 commit comments

Comments
 (0)