Skip to content

Commit 4c3cee5

Browse files
committed
feat(nextcloud): add notify_push support
Signed-off-by: WrenIX <dev.github@wrenix.eu>
1 parent 3dfd22e commit 4c3cee5

File tree

8 files changed

+213
-44
lines changed

8 files changed

+213
-44
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: 5.0.0
3+
version: 5.1.0
44
appVersion: 29.0.1
55
description: A file sharing server that puts the control and security of your own data back into your hands.
66
keywords:

charts/nextcloud/templates/db-secret.yaml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,23 @@ metadata:
1313
type: Opaque
1414
data:
1515
{{- if .Values.mariadb.enabled }}
16-
db-username: {{ .Values.mariadb.auth.username | b64enc | quote }}
17-
db-password: {{ .Values.mariadb.auth.password | b64enc | quote }}
16+
{{- with .Values.mariadb.auth }}
17+
db-username: {{ .username | b64enc | quote }}
18+
db-password: {{ .password | b64enc | quote }}
19+
db-url: {{ printf "mysql://%s:%s@%s/%s" .username .password (template "mariadb.primary.fullname" $.Subcharts.mariadb) .database | b64enc | quote }}
20+
{{- end }}
1821
{{- else if .Values.postgresql.enabled }}
19-
db-username: {{ .Values.postgresql.global.postgresql.auth.username | b64enc | quote }}
20-
db-password: {{ .Values.postgresql.global.postgresql.auth.password | b64enc | quote }}
22+
{{- with .Values.postgresql.global.postgresql.auth }}
23+
db-username: {{ .username | b64enc | quote }}
24+
db-password: {{ .password | b64enc | quote }}
25+
db-url: {{ printf "postgres://%s:%s@%s/%s" .username .password (template "postgresql.v1.primary.fullname" $.Subcharts.postgresql) .database | b64enc | quote }}
26+
{{- end }}
2127
{{- else }}
22-
db-username: {{ .Values.externalDatabase.user | b64enc | quote }}
23-
db-password: {{ .Values.externalDatabase.password | b64enc | quote }}
28+
{{- with .Values.externalDatabase }}
29+
db-username: {{ .user | b64enc | quote }}
30+
db-password: {{ .password | b64enc | quote }}
31+
db-url: {{ printf "%s://%s:%s@%s/%s" .type .user .password .host .database | b64enc | quote }}
32+
{{- end }}
2433
{{- end }}
2534
{{- end }}
2635
{{- end }}

charts/nextcloud/templates/ingress.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,15 @@ spec:
3939
serviceName: {{ template "nextcloud.fullname" . }}
4040
servicePort: {{ .Values.service.port }}
4141
{{- end }}
42+
{{- if .Values.notifyPush.enabled }}
43+
- path: {{ .Values.notifyPush.ingress.path }}
44+
pathType: {{ .Values.notifyPush.ingress.pathType }}
45+
backend:
46+
service:
47+
name: {{ template "nextcloud.fullname" . }}-notify-push
48+
port:
49+
name: http
50+
{{- end }}
4251
{{- with .Values.ingress.tls }}
4352
tls:
4453
{{- toYaml . | nindent 4 }}
Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,38 @@
11
{{- if .Values.metrics.enabled }}
2+
{{- with .Values.metrics.service }}
23
---
34
apiVersion: v1
45
kind: Service
56
metadata:
6-
name: {{ template "nextcloud.fullname" . }}-metrics
7+
name: {{ template "nextcloud.fullname" $ }}-metrics
78
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 }}
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 }}
1213
app.kubernetes.io/component: metrics
13-
{{- with .Values.metrics.service.labels }}
14+
app.kubernetes.io/monitor: enabled
15+
{{- with .labels }}
1416
{{- toYaml . | nindent 4 }}
1517
{{- end }}
16-
{{- with .Values.metrics.service.annotations }}
18+
{{- with .annotations }}
1719
annotations:
1820
{{- toYaml . | nindent 4 }}
1921
{{- end }}
2022
spec:
21-
type: {{ .Values.metrics.service.type }}
22-
{{- if eq .Values.metrics.service.type "LoadBalancer" }}
23-
{{- with .Values.metrics.service.loadBalancerIP }}
23+
type: {{ .type }}
24+
{{- if eq .type "LoadBalancer" }}
25+
{{- with .loadBalancerIP }}
2426
loadBalancerIP: {{ . }}
2527
{{- end }}
2628
{{- end }}
29+
selector:
30+
app.kubernetes.io/name: {{ include "nextcloud.name" $ }}
31+
app.kubernetes.io/instance: {{ $.Release.Name }}
32+
app.kubernetes.io/component: metrics
2733
ports:
2834
- name: metrics
29-
port: 9205
35+
port: 9100
3036
targetPort: metrics
31-
selector:
32-
app.kubernetes.io/name: {{ include "nextcloud.name" . }}
33-
app.kubernetes.io/instance: {{ .Release.Name }}
34-
app.kubernetes.io/component: metrics
37+
{{- end }}
3538
{{- end }}
Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,41 @@
1-
{{- if and .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled }}
1+
{{- with .Values.prometheus.serviceMonitor }}
2+
{{- if .enabled }}
23
---
34
apiVersion: monitoring.coreos.com/v1
45
kind: ServiceMonitor
56
metadata:
6-
name: {{ template "nextcloud.fullname" . }}
7-
namespace: {{ .Values.metrics.serviceMonitor.namespace | default .Release.Namespace | quote }}
7+
name: {{ template "nextcloud.fullname" $ }}
8+
namespace: {{ .namespace | default $.Release.Namespace | quote }}
89
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 }}
13-
app.kubernetes.io/component: metrics
14-
{{- with .Values.metrics.serviceMonitor.labels }}
10+
app.kubernetes.io/name: {{ include "nextcloud.name" $ }}
11+
helm.sh/chart: {{ include "nextcloud.chart" $ }}
12+
app.kubernetes.io/instance: {{ $.Release.Name }}
13+
app.kubernetes.io/managed-by: {{ $.Release.Service }}
14+
{{- with .labels }}
1515
{{- toYaml . | nindent 4 }}
1616
{{- end }}
1717
spec:
18-
jobLabel: {{ .Values.metrics.serviceMonitor.jobLabel | quote }}
18+
jobLabel: {{ .jobLabel | quote }}
1919
selector:
2020
matchLabels:
21-
app.kubernetes.io/name: {{ include "nextcloud.name" . }}
22-
app.kubernetes.io/instance: {{ .Release.Name }}
23-
app.kubernetes.io/component: metrics
21+
app.kubernetes.io/name: {{ include "nextcloud.name" $ }}
22+
app.kubernetes.io/instance: {{ $.Release.Name }}
23+
app.kubernetes.io/monitor: enabled
2424
namespaceSelector:
25-
{{- with .Values.metrics.serviceMonitor.namespaceSelector }}
25+
{{- with .namespaceSelector }}
2626
{{- toYaml . | nindent 4 }}
2727
{{- else }}
2828
matchNames:
29-
- {{ .Release.Namespace | quote }}
29+
- {{ $.Release.Namespace | quote }}
3030
{{- end }}
3131
endpoints:
3232
- port: metrics
33-
path: "/"
34-
{{- with .Values.metrics.serviceMonitor.interval }}
33+
path: "/metrics"
34+
{{- with .interval }}
3535
interval: {{ . }}
3636
{{- end }}
37-
{{- with .Values.metrics.serviceMonitor.scrapeTimeout }}
37+
{{- with .scrapeTimeout }}
3838
scrapeTimeout: {{ . }}
3939
{{- end }}
4040
{{- end }}
41+
{{- end }}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
{{- if .Values.notifyPush.enabled }}
2+
---
3+
apiVersion: apps/v1
4+
kind: Deployment
5+
metadata:
6+
name: {{ template "nextcloud.fullname" . }}-notify-push
7+
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: notify-push
13+
spec:
14+
replicas: {{ .Values.notifyPush.replicaCount }}
15+
selector:
16+
matchLabels:
17+
app.kubernetes.io/name: {{ include "nextcloud.name" . }}
18+
app.kubernetes.io/instance: {{ .Release.Name }}
19+
app.kubernetes.io/component: notify-push
20+
template:
21+
metadata:
22+
annotations:
23+
{{- toYaml .Values.notifyPush.podAnnotations | nindent 8 }}
24+
labels:
25+
app.kubernetes.io/name: {{ include "nextcloud.name" . }}
26+
app.kubernetes.io/instance: {{ .Release.Name }}
27+
app.kubernetes.io/component: notify-push
28+
{{- with .Values.notifyPush.podLabels }}
29+
{{- toYaml . | nindent 8 }}
30+
{{- end }}
31+
spec:
32+
{{- with .Values.notifyPush.image.pullSecrets }}
33+
imagePullSecrets:
34+
{{- range . }}
35+
- name: {{ . }}
36+
{{- end}}
37+
{{- end }}
38+
containers:
39+
- name: notify-push
40+
image: "{{ .Values.metrics.image.repository }}:{{ .Values.metrics.image.tag }}"
41+
imagePullPolicy: {{ .Values.metrics.image.pullPolicy }}
42+
env:
43+
- name: PORT
44+
value: "7867"
45+
- name: METRICS_PORT
46+
value: "9867"
47+
- name: DATABASE_URL
48+
valueFrom:
49+
secretKeyRef:
50+
name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-db" .Release.Name) }}
51+
key: {{ .Values.externalDatabase.existingSecret.databaseURLKey }}
52+
- name: REDIS_URL
53+
value: "redis://{{ template "nextcloud.redis.fullname" . }}-master:{{ .Values.redis.master.service.ports.redis | quote }}"
54+
- name: NEXTCLOUD_URL # deployment.namespace.svc.cluster.local
55+
value: "http{{ if .Values.notifyPush.https }}s{{ end }}://{{ template "nextcloud.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.service.port }}"
56+
ports:
57+
- name: http
58+
containerPort: 7867
59+
- name: metrics
60+
containerPort: 9867
61+
{{- with .Values.notifyPush.resources }}
62+
resources:
63+
{{- toYaml . | nindent 12 }}
64+
{{- end }}
65+
securityContext:
66+
runAsUser: 1000
67+
runAsNonRoot: true
68+
{{- end }}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{{- if .Values.notifyPush.enabled }}
2+
{{- with .Values.notifyPush.service }}
3+
---
4+
apiVersion: v1
5+
kind: Service
6+
metadata:
7+
name: {{ template "nextcloud.fullname" $ }}-notify-push
8+
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 }}
13+
app.kubernetes.io/component: notify-push
14+
app.kubernetes.io/monitor: enabled
15+
{{- with .labels }}
16+
{{- toYaml . | nindent 4 }}
17+
{{- end }}
18+
{{- with .annotations }}
19+
annotations:
20+
{{- toYaml . | nindent 4 }}
21+
{{- end }}
22+
spec:
23+
type: {{ .type }}
24+
{{- if eq .type "LoadBalancer" }}
25+
{{- with .loadBalancerIP }}
26+
loadBalancerIP: {{ . }}
27+
{{- end }}
28+
{{- end }}
29+
selector:
30+
app.kubernetes.io/name: {{ include "nextcloud.name" $ }}
31+
app.kubernetes.io/instance: {{ $.Release.Name }}
32+
app.kubernetes.io/component: notify-push
33+
ports:
34+
- name: http
35+
port: 80
36+
targetPort: http
37+
- name: metrics
38+
port: 9100
39+
targetPort: metrics
40+
{{- end }}
41+
{{- end }}

charts/nextcloud/values.yaml

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -278,11 +278,16 @@ externalDatabase:
278278
## Use a existing secret
279279
existingSecret:
280280
enabled: false
281-
# secretName: nameofsecret
281+
# -- e.g. nameofsecret
282+
secretName:
282283
usernameKey: db-username
283284
passwordKey: db-password
284-
# hostKey: db-hostname-or-ip
285-
# databaseKey: db-name
285+
# -- e.g. db-hostname-or-ip
286+
hostKey:
287+
# -- e.g. db-name
288+
databaseKey:
289+
# -- complete URL with type, username and password (current only for notify_push used)
290+
databaseURLKey: db-url
286291

287292
##
288293
## MariaDB chart configuration
@@ -479,6 +484,37 @@ tolerations: []
479484

480485
affinity: {}
481486

487+
# Notify Push (Clientpush)
488+
notifyPush:
489+
enabled: false
490+
491+
replicaCount: 1
492+
493+
image:
494+
registry: docker.io
495+
repository: icewind1991/notify_push
496+
tag: 0.6.11
497+
pullPolicy: IfNotPresent
498+
pullSecrets:
499+
# - myRegistrKeySecretName
500+
501+
resources: {}
502+
503+
podAnnotations: {}
504+
podLabels: {}
505+
506+
service:
507+
type: ClusterIP
508+
# -- Use serviceLoadBalancerIP to request a specific static IP, otherwise leave blank
509+
loadBalancerIP:
510+
annotations: {}
511+
labels: {}
512+
513+
ingress:
514+
path: /push
515+
pathType: Prefix
516+
517+
482518

483519
## Prometheus Exporter / Metrics
484520
##
@@ -523,8 +559,10 @@ metrics:
523559
prometheus.io/port: "9205"
524560
labels: {}
525561

562+
#
563+
prometheus:
526564
## Prometheus Operator ServiceMonitor configuration
527-
##
565+
## collects data from nextcloud metrics and notify_push if enabled
528566
serviceMonitor:
529567
## @param metrics.serviceMonitor.enabled Create ServiceMonitor Resource for scraping metrics using PrometheusOperator
530568
##

0 commit comments

Comments
 (0)