Skip to content
This repository was archived by the owner on Dec 14, 2025. It is now read-only.

Commit 82bf6d7

Browse files
pull[bot]MartinKirchnerMartin Kirchner
authored
[pull] main from nextcloud:main (#58)
* fix(cronjob): Make command of cronjob container configurable (nextcloud#708) This allows to run it without root permissions by using a while-true-script over cron (cron needs root permissions for the impersonation). Signed-off-by: Martin Kirchner <martin.kirchner@cas.de> Co-authored-by: Martin Kirchner <martin.kirchner@cas.de> * fix: Extract labels to helper template nextcloud#707 Signed-off-by: Martin Kirchner <martin.kirchner@cas.de> * fix(nextcloud): Reorder definitions of main and cronjob container nextcloud#710 In a next step we could extract the common parts of the two containers to a helper template. Signed-off-by: Martin Kirchner <martin.kirchner@cas.de> --------- Signed-off-by: Martin Kirchner <martin.kirchner@cas.de> Co-authored-by: MartinKirchner <17732361+MartinKirchner@users.noreply.github.com> Co-authored-by: Martin Kirchner <martin.kirchner@cas.de>
1 parent b4992e1 commit 82bf6d7

21 files changed

+83
-124
lines changed

charts/nextcloud/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
apiVersion: v2
22
name: nextcloud
3-
version: 6.6.6
3+
version: 6.6.9
44
# renovate: image=docker.io/library/nextcloud
55
appVersion: 30.0.6
66
description: A file sharing server that puts the control and security of your own data back into your hands.

charts/nextcloud/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ The following table lists the configurable parameters of the nextcloud chart and
190190
| `redis.global.storageClass` | PVC Storage Class for both Redis&reg; master and replica Persistent Volumes | `''` |
191191
| `redis.master.persistence.enabled` | Enable persistence on Redis&reg; master nodes using Persistent Volume Claims | `true` |
192192
| `redis.replica.persistence.enabled` | Enable persistence on Redis&reg; replica nodes using Persistent Volume Claims | `true` |
193+
| `cronjob.command` | The command the cronjob container executes | `/cron.sh` |
193194
| `cronjob.enabled` | Whether to enable/disable cron jobs sidecar | `false` |
194195
| `cronjob.lifecycle.postStartCommand` | Specify deployment lifecycle hook postStartCommand for the cron jobs sidecar | `nil` |
195196
| `cronjob.lifecycle.preStopCommand` | Specify deployment lifecycle hook preStopCommand for the cron jobs sidecar | `nil` |

charts/nextcloud/templates/_helpers.tpl

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,3 +398,37 @@ Create volume mounts for the nextcloud container as well as the cron sidecar con
398398
subPath: {{ $key }}
399399
{{- end }}
400400
{{- end -}}
401+
402+
403+
{{/*
404+
Create match labels for the nextcloud container as well as the cronjob container.
405+
Parameters:
406+
- component (optional): app/cronjob/...
407+
- rootContext: $ (Inside a template the scope changes, i.e. you cannot access variables of the parent context or its parents.
408+
Unfortunately this is also the case for the root context, this means .Values, .Release, .Chart cannot be accessed.
409+
However the other templates need values from the objects. That's why the caller has to pass on reference to the root context which this template in turn passes on.)
410+
*/}}
411+
{{- define "nextcloud.selectorLabels" -}}
412+
app.kubernetes.io/name: {{ include "nextcloud.name" .rootContext }}
413+
app.kubernetes.io/instance: {{ .rootContext.Release.Name }}
414+
{{- if .component }}
415+
app.kubernetes.io/component: {{ .component }}
416+
{{- end }}
417+
{{- end -}}
418+
419+
{{/*
420+
Create match labels for the nextcloud deployment as well as the cronjob.
421+
Parameters:
422+
- component (optional): app/cronjob/...
423+
- rootContext: $ (Inside a template the scope changes, i.e. you cannot access variables of the parent context or its parents.
424+
Unfortunately this is also the case for the root context, this means .Values, .Release, .Chart cannot be accessed.
425+
However the other templates need values from the objects. That's why the caller has to pass on reference to the root context which this template in turn passes on.)
426+
*/}}
427+
{{- define "nextcloud.labels" -}}
428+
{{ include "nextcloud.selectorLabels" ( dict "component" .component "rootContext" .rootContext) }}
429+
helm.sh/chart: {{ include "nextcloud.chart" .rootContext }}
430+
app.kubernetes.io/managed-by: {{ .rootContext.Release.Service }}
431+
{{- with .rootContext.Chart.AppVersion }}
432+
app.kubernetes.io/version: {{ quote . }}
433+
{{- end }}
434+
{{- end -}}

charts/nextcloud/templates/config.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@ kind: ConfigMap
44
metadata:
55
name: {{ template "nextcloud.fullname" . }}-config
66
labels:
7-
app.kubernetes.io/name: {{ include "nextcloud.name" . }}
8-
helm.sh/chart: {{ include "nextcloud.chart" . }}
9-
app.kubernetes.io/instance: {{ .Release.Name }}
10-
app.kubernetes.io/managed-by: {{ .Release.Service }}
7+
{{- include "nextcloud.labels" ( dict "rootContext" $ ) | nindent 4 }}
118
data:
129
{{- range $filename, $content := .Values.nextcloud.configs }}
1310
{{ $filename }}: |-

charts/nextcloud/templates/configmap-hooks.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@ kind: ConfigMap
55
metadata:
66
name: {{ template "nextcloud.fullname" . }}-hooks
77
labels:
8-
app.kubernetes.io/name: {{ include "nextcloud.name" . }}
9-
helm.sh/chart: {{ include "nextcloud.chart" . }}
10-
app.kubernetes.io/instance: {{ .Release.Name }}
11-
app.kubernetes.io/managed-by: {{ .Release.Service }}
8+
{{- include "nextcloud.labels" ( dict "rootContext" $ ) | nindent 4 }}
129
data:
1310
{{- range $hook, $shell := .Values.nextcloud.hooks }}
1411
{{- if $shell }}

charts/nextcloud/templates/db-secret.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@ kind: Secret
66
metadata:
77
name: {{ .Release.Name }}-db
88
labels:
9-
app.kubernetes.io/name: {{ include "nextcloud.name" . }}
10-
helm.sh/chart: {{ include "nextcloud.chart" . }}
11-
app.kubernetes.io/instance: {{ .Release.Name }}
12-
app.kubernetes.io/managed-by: {{ .Release.Service }}
9+
{{- include "nextcloud.labels" ( dict "rootContext" $ ) | nindent 4 }}
1310
type: Opaque
1411
data:
1512
{{- if .Values.mariadb.enabled }}

charts/nextcloud/templates/deployment.yaml

Lines changed: 20 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@ kind: Deployment
44
metadata:
55
name: {{ template "nextcloud.fullname" . }}
66
labels:
7-
app.kubernetes.io/name: {{ include "nextcloud.name" . }}
8-
helm.sh/chart: {{ include "nextcloud.chart" . }}
9-
app.kubernetes.io/instance: {{ .Release.Name }}
10-
app.kubernetes.io/managed-by: {{ .Release.Service }}
11-
app.kubernetes.io/component: app
7+
{{- include "nextcloud.labels" ( dict "component" "app" "rootContext" $ ) | nindent 4 }}
128
{{- with .Values.deploymentLabels }}
139
{{- toYaml . | nindent 4 }}
1410
{{- end }}
@@ -24,15 +20,11 @@ spec:
2420
{{- toYaml .Values.nextcloud.strategy | nindent 4 }}
2521
selector:
2622
matchLabels:
27-
app.kubernetes.io/name: {{ include "nextcloud.name" . }}
28-
app.kubernetes.io/instance: {{ .Release.Name }}
29-
app.kubernetes.io/component: app
23+
{{- include "nextcloud.selectorLabels" ( dict "component" "app" "rootContext" $ ) | nindent 6 }}
3024
template:
3125
metadata:
3226
labels:
33-
app.kubernetes.io/name: {{ include "nextcloud.name" . }}
34-
app.kubernetes.io/instance: {{ .Release.Name }}
35-
app.kubernetes.io/component: app
27+
{{- include "nextcloud.selectorLabels" ( dict "component" "app" "rootContext" $ ) | nindent 8 }}
3628
{{- if .Values.redis.enabled }}
3729
{{ template "nextcloud.redis.fullname" . }}-client: "true"
3830
{{- end }}
@@ -77,6 +69,22 @@ spec:
7769
{{- end }}
7870
env:
7971
{{- include "nextcloud.env" . | nindent 12 }}
72+
resources:
73+
{{- toYaml .Values.resources | nindent 12 }}
74+
{{- with .Values.nextcloud.securityContext }}
75+
securityContext:
76+
{{- toYaml . | nindent 12 }}
77+
{{- end }}
78+
volumeMounts:
79+
{{- include "nextcloud.volumeMounts" . | trim | nindent 12 }}
80+
{{- range $hook, $shell := .Values.nextcloud.hooks }}
81+
{{- if $shell }}
82+
- name: nextcloud-hooks
83+
mountPath: /docker-entrypoint-hooks.d/{{ $hook }}/helm.sh
84+
subPath: {{ $hook }}.sh
85+
readOnly: true
86+
{{- end }}
87+
{{- end }}
8088
{{- if not .Values.nginx.enabled }}
8189
ports:
8290
- name: http
@@ -131,22 +139,6 @@ spec:
131139
{{- end }}
132140
{{- end }}
133141
{{- end }}{{/* end-if not nginx.enabled */}}
134-
resources:
135-
{{- toYaml .Values.resources | nindent 12 }}
136-
{{- with .Values.nextcloud.securityContext }}
137-
securityContext:
138-
{{- toYaml . | nindent 12 }}
139-
{{- end }}
140-
volumeMounts:
141-
{{- include "nextcloud.volumeMounts" . | trim | nindent 12 }}
142-
{{- range $hook, $shell := .Values.nextcloud.hooks }}
143-
{{- if $shell }}
144-
- name: nextcloud-hooks
145-
mountPath: /docker-entrypoint-hooks.d/{{ $hook }}/helm.sh
146-
subPath: {{ $hook }}.sh
147-
readOnly: true
148-
{{- end }}
149-
{{- end }}
150142
{{- if .Values.nginx.enabled }}
151143
- name: {{ .Chart.Name }}-nginx
152144
image: "{{ .Values.nginx.image.repository }}:{{ .Values.nginx.image.tag }}"
@@ -253,7 +245,7 @@ spec:
253245
image: {{ include "nextcloud.image" . }}
254246
imagePullPolicy: {{ .Values.image.pullPolicy }}
255247
command:
256-
- /cron.sh
248+
{{- toYaml .Values.cronjob.command | nindent 12 }}
257249
{{- with .Values.cronjob.lifecycle }}
258250
lifecycle:
259251
{{- with .postStartCommand }}

charts/nextcloud/templates/hpa.yaml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@ kind: HorizontalPodAutoscaler
55
metadata:
66
name: {{ template "nextcloud.fullname" . }}
77
labels:
8-
app.kubernetes.io/name: {{ include "nextcloud.name" . }}
9-
helm.sh/chart: {{ include "nextcloud.chart" . }}
10-
app.kubernetes.io/instance: {{ .Release.Name }}
11-
app.kubernetes.io/managed-by: {{ .Release.Service }}
12-
app.kubernetes.io/component: app
8+
{{- include "nextcloud.labels" ( dict "component" "app" "rootContext" $ ) | nindent 4 }}
139
spec:
1410
scaleTargetRef:
1511
kind: Deployment

charts/nextcloud/templates/imaginary/deployment.yaml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,18 @@ kind: Deployment
55
metadata:
66
name: {{ template "nextcloud.fullname" . }}-imaginary
77
labels:
8-
app.kubernetes.io/name: {{ include "nextcloud.name" . }}
9-
helm.sh/chart: {{ include "nextcloud.chart" . }}
10-
app.kubernetes.io/instance: {{ .Release.Name }}
11-
app.kubernetes.io/managed-by: {{ .Release.Service }}
12-
app.kubernetes.io/component: imaginary
8+
{{- include "nextcloud.labels" ( dict "component" "imaginary" "rootContext" $ ) | nindent 4 }}
139
spec:
1410
replicas: {{ .Values.imaginary.replicaCount }}
1511
selector:
1612
matchLabels:
17-
app.kubernetes.io/name: {{ include "nextcloud.name" . }}
18-
app.kubernetes.io/instance: {{ .Release.Name }}
19-
app.kubernetes.io/component: imaginary
13+
{{- include "nextcloud.selectorLabels" ( dict "component" "imaginary" "rootContext" $ ) | nindent 6 }}
2014
template:
2115
metadata:
2216
annotations:
2317
{{- toYaml .Values.imaginary.podAnnotations | nindent 8 }}
2418
labels:
25-
app.kubernetes.io/name: {{ include "nextcloud.name" . }}
26-
app.kubernetes.io/instance: {{ .Release.Name }}
27-
app.kubernetes.io/component: imaginary
19+
{{- include "nextcloud.selectorLabels" ( dict "component" "imaginary" "rootContext" $ ) | nindent 8 }}
2820
{{- with .Values.imaginary.podLabels }}
2921
{{- toYaml . | nindent 8 }}
3022
{{- end }}

charts/nextcloud/templates/imaginary/service.yaml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@ kind: Service
55
metadata:
66
name: {{ template "nextcloud.fullname" . }}-imaginary
77
labels:
8-
app.kubernetes.io/name: {{ include "nextcloud.name" . }}
9-
helm.sh/chart: {{ include "nextcloud.chart" . }}
10-
app.kubernetes.io/instance: {{ .Release.Name }}
11-
app.kubernetes.io/managed-by: {{ .Release.Service }}
12-
app.kubernetes.io/component: imaginary
8+
{{- include "nextcloud.labels" ( dict "component" "imaginary" "rootContext" $ ) | nindent 4 }}
139
{{- with .Values.imaginary.service.labels }}
1410
{{- toYaml . | nindent 4 }}
1511
{{- end }}
@@ -30,7 +26,5 @@ spec:
3026
nodePort: {{ . }}
3127
{{- end }}
3228
selector:
33-
app.kubernetes.io/name: {{ include "nextcloud.name" . }}
34-
app.kubernetes.io/instance: {{ .Release.Name }}
35-
app.kubernetes.io/component: imaginary
29+
{{- include "nextcloud.selectorLabels" ( dict "component" "imaginary" "rootContext" $ ) | nindent 4 }}
3630
{{- end }}

0 commit comments

Comments
 (0)