Skip to content

Commit 1e3c86a

Browse files
committed
values: refactor image block
1 parent 9eab8d9 commit 1e3c86a

8 files changed

+98
-13
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

+21-5
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,25 @@ Your release is named {{ .Release.Name }}.
44

55
{{- if .Values.invenio.extra_config}}
66

7-
DEPRECATION WARNING:
7+
DEPRECATION WARNING:
88
`invenio.extra_config` has been renamed to `invenio.extraConfig` and will be
99
removed in a future release.
1010

1111
{{- end }}
1212

1313
{{- if .Values.invenio.sentry.existing_secret }}
1414

15-
DEPRECATION WARNING:
16-
`invenio.sentry.existing_secret` has been renamed to `invenio.sentry.existingSecret`
15+
DEPRECATION WARNING:
16+
`invenio.sentry.existing_secret` has been renamed to `invenio.sentry.existingSecret`
1717
and its type has changed from boolean to string.
1818
This key will be removed in a future release.
1919

2020
{{- end }}
2121

2222
{{- if .Values.invenio.sentry.secret_name }}
2323

24-
DEPRECATION WARNING:
25-
`invenio.sentry.secret_name` has been removed in favor of
24+
DEPRECATION WARNING:
25+
`invenio.sentry.secret_name` has been removed in favor of
2626
`invenio.sentry.existingSecret` will be removed in a future release.
2727

2828
{{- end }}
@@ -44,3 +44,19 @@ DEPRECATION WARNING:
4444
`invenio.existingSecret` and it will be removed in a future release.
4545

4646
{{- end }}
47+
48+
{{- if or .Values.web.image .Values.worker.image }}
49+
50+
DEPRECATION WARNING:
51+
`<service>.image` has been removed in favor of `image` and it will be
52+
removed in a future release.
53+
54+
{{- end }}
55+
56+
{{- if or .Values.web.imagePullSecret .Values.worker.imagePullSecret }}
57+
58+
DEPRECATION WARNING:
59+
`<service>.imagePullSecret` has been removed in favor of
60+
`image.pullSecrets` and it will be removed in a future release.
61+
62+
{{- end }}

charts/invenio/templates/_helpers.tpl

+22-1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,27 @@ 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 := .Values.image.registry -}}
58+
{{- $repositoryName := .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+
{{- if $registryName }}
68+
{{- printf "%s/%s%s%s" $registryName $repositoryName $separator $termination -}}
69+
{{- else -}}
70+
{{- printf "%s%s%s" $repositoryName $separator $termination -}}
71+
{{- end -}}
72+
{{- end -}}
73+
5374
########################### Invenio hostname ###########################
5475
{{/*
5576
This template renders the hostname for Invenio.
@@ -299,7 +320,7 @@ Get the sentry secret name
299320
{{- if .Values.invenio.sentry.existingSecret -}}
300321
{{- print (tpl .Values.invenio.sentry.existingSecret .) -}}
301322
{{- else if .Values.invenio.sentry.secret_name -}}
302-
{{- print .Values.invenio.sentry.secret_name -}}
323+
{{- print .Values.invenio.sentry.secret_name -}}
303324
{{- else -}}
304325
{{- printf "%s-%s" (include "invenio.fullname" .) "sentry" -}}
305326
{{- end -}}

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

+7-2
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",
@@ -33,7 +34,7 @@ spec:
3334
envFrom:
3435
- configMapRef:
3536
name: {{ include "invenio.fullname" . }}-config
36-
- secretRef:
37+
- secretRef:
3738
name: {{ include "invenio.secretName" . }}
3839
env:
3940
- name: TZ
@@ -65,4 +66,8 @@ spec:
6566
imagePullSecrets:
6667
- name: {{ .Values.web.imagePullSecret }}
6768
{{- end }}
69+
{{- with .Values.image.pullSecrets }}
70+
imagePullSecrets:
71+
{{- toYaml . | nindent 8 }}
72+
{{- end }}
6873
{{- 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",
@@ -215,7 +216,8 @@ spec:
215216
initContainers:
216217
# copy assets from uwsgi to nginx
217218
- name: copy-web-assets
218-
image: {{ required "Missing .Values.web.image" .Values.web.image }}
219+
image: {{ default .Values.web.image (include "invenio.image" .) }}
220+
imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
219221
command: [
220222
"/bin/bash",
221223
"-c",
@@ -294,3 +296,7 @@ spec:
294296
imagePullSecrets:
295297
- name: {{ .Values.web.imagePullSecret }}
296298
{{- end }}
299+
{{- with .Values.image.pullSecrets }}
300+
imagePullSecrets:
301+
{{- toYaml . | nindent 8 }}
302+
{{- 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",
@@ -132,5 +133,9 @@ spec:
132133
imagePullSecrets:
133134
- name: {{ .Values.worker.imagePullSecret }}
134135
{{- end }}
136+
{{- with .Values.image.pullSecrets }}
137+
imagePullSecrets:
138+
{{- toYaml . | nindent 8 }}
139+
{{- end }}
135140
strategy:
136141
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",
@@ -170,3 +171,7 @@ spec:
170171
imagePullSecrets:
171172
- name: {{ .Values.worker.imagePullSecret }}
172173
{{- end }}
174+
{{- with .Values.image.pullSecrets }}
175+
imagePullSecrets:
176+
{{- toYaml . | nindent 8 }}
177+
{{- 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)