diff --git a/charts/nextcloud/Chart.yaml b/charts/nextcloud/Chart.yaml index 26b03113..18a63900 100644 --- a/charts/nextcloud/Chart.yaml +++ b/charts/nextcloud/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 name: nextcloud -version: 4.5.2 +version: 4.5.3 appVersion: 27.1.3 description: A file sharing server that puts the control and security of your own data back into your hands. keywords: diff --git a/charts/nextcloud/templates/metrics-deployment.yaml b/charts/nextcloud/templates/metrics-deployment.yaml deleted file mode 100644 index ea30e918..00000000 --- a/charts/nextcloud/templates/metrics-deployment.yaml +++ /dev/null @@ -1,75 +0,0 @@ -{{- if .Values.metrics.enabled }} -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ template "nextcloud.fullname" . }}-metrics - labels: - app.kubernetes.io/name: {{ include "nextcloud.name" . }} - helm.sh/chart: {{ include "nextcloud.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/component: metrics -spec: - replicas: {{ .Values.metrics.replicaCount }} - selector: - matchLabels: - app.kubernetes.io/name: {{ include "nextcloud.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/component: metrics - template: - metadata: - annotations: {{- toYaml .Values.metrics.podAnnotations | nindent 8 }} - labels: - app.kubernetes.io/name: {{ include "nextcloud.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/component: metrics - {{- if .Values.metrics.podLabels }} -{{ toYaml .Values.metrics.podLabels | indent 8 }} - {{- end }} - spec: - {{- if .Values.metrics.image.pullSecrets }} - imagePullSecrets: - {{- range .Values.metrics.image.pullSecrets }} - - name: {{ . }} - {{- end}} - {{- end }} - containers: - - name: metrics-exporter - image: "{{ .Values.metrics.image.repository }}:{{ .Values.metrics.image.tag }}" - imagePullPolicy: {{ .Values.metrics.image.pullPolicy }} - env: - {{- if .Values.metrics.token }} - - name: NEXTCLOUD_AUTH_TOKEN - valueFrom: - secretKeyRef: - name: {{ .Values.nextcloud.existingSecret.secretName | default (include "nextcloud.fullname" .) }} - key: {{ .Values.nextcloud.existingSecret.tokenKey }} - {{- else }} - - name: NEXTCLOUD_USERNAME - valueFrom: - secretKeyRef: - name: {{ .Values.nextcloud.existingSecret.secretName | default (include "nextcloud.fullname" .) }} - key: {{ .Values.nextcloud.existingSecret.usernameKey }} - - name: NEXTCLOUD_PASSWORD - valueFrom: - secretKeyRef: - name: {{ .Values.nextcloud.existingSecret.secretName | default (include "nextcloud.fullname" .) }} - key: {{ .Values.nextcloud.existingSecret.passwordKey }} - {{- end }} - # NEXTCLOUD_SERVER is used by metrics-exporter to reach the Nextcloud (K8s-)Service to grab the serverinfo api endpoint - - name: NEXTCLOUD_SERVER - value: http{{ if .Values.metrics.https }}s{{ end }}://{{ template "nextcloud.fullname" . }}:{{ .Values.service.port }} - - name: NEXTCLOUD_TIMEOUT - value: {{ .Values.metrics.timeout }} - - name: NEXTCLOUD_TLS_SKIP_VERIFY - value: {{ .Values.metrics.tlsSkipVerify | quote }} - ports: - - name: metrics - containerPort: 9205 - {{- if .Values.metrics.resources }} - resources: {{- toYaml .Values.metrics.resources | nindent 10 }} - {{- end }} - securityContext: - runAsUser: 1000 - runAsNonRoot: true -{{- end }} diff --git a/charts/nextcloud/templates/metrics/deployment.yaml b/charts/nextcloud/templates/metrics/deployment.yaml new file mode 100644 index 00000000..2c3b5b8e --- /dev/null +++ b/charts/nextcloud/templates/metrics/deployment.yaml @@ -0,0 +1,78 @@ +{{- if .Values.metrics.enabled }} +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ template "nextcloud.fullname" . }}-metrics + labels: + app.kubernetes.io/name: {{ include "nextcloud.name" . }} + helm.sh/chart: {{ include "nextcloud.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/component: metrics +spec: + replicas: {{ .Values.metrics.replicaCount }} + selector: + matchLabels: + app.kubernetes.io/name: {{ include "nextcloud.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: metrics + template: + metadata: + annotations: + {{- toYaml .Values.metrics.podAnnotations | nindent 8 }} + labels: + app.kubernetes.io/name: {{ include "nextcloud.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: metrics + {{- with .Values.metrics.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- with .Values.metrics.image.pullSecrets }} + imagePullSecrets: + {{- range . }} + - name: {{ . }} + {{- end}} + {{- end }} + containers: + - name: metrics-exporter + image: "{{ .Values.metrics.image.repository }}:{{ .Values.metrics.image.tag }}" + imagePullPolicy: {{ .Values.metrics.image.pullPolicy }} + env: + {{- if .Values.metrics.token }} + - name: NEXTCLOUD_AUTH_TOKEN + valueFrom: + secretKeyRef: + name: {{ .Values.nextcloud.existingSecret.secretName | default (include "nextcloud.fullname" .) }} + key: {{ .Values.nextcloud.existingSecret.tokenKey }} + {{- else }} + - name: NEXTCLOUD_USERNAME + valueFrom: + secretKeyRef: + name: {{ .Values.nextcloud.existingSecret.secretName | default (include "nextcloud.fullname" .) }} + key: {{ .Values.nextcloud.existingSecret.usernameKey }} + - name: NEXTCLOUD_PASSWORD + valueFrom: + secretKeyRef: + name: {{ .Values.nextcloud.existingSecret.secretName | default (include "nextcloud.fullname" .) }} + key: {{ .Values.nextcloud.existingSecret.passwordKey }} + {{- end }} + # NEXTCLOUD_SERVER is used by metrics-exporter to reach the Nextcloud (K8s-)Service to grab the serverinfo api endpoint + - name: NEXTCLOUD_SERVER + value: http{{ if .Values.metrics.https }}s{{ end }}://{{ template "nextcloud.fullname" . }}:{{ .Values.service.port }} + - name: NEXTCLOUD_TIMEOUT + value: {{ .Values.metrics.timeout }} + - name: NEXTCLOUD_TLS_SKIP_VERIFY + value: {{ .Values.metrics.tlsSkipVerify | quote }} + ports: + - name: metrics + containerPort: 9205 + {{- with .Values.metrics.resources }} + resources: + {{- toYaml . | nindent 10 }} + {{- end }} + securityContext: + runAsUser: 1000 + runAsNonRoot: true +{{- end }} diff --git a/charts/nextcloud/templates/metrics-service.yaml b/charts/nextcloud/templates/metrics/service.yaml similarity index 61% rename from charts/nextcloud/templates/metrics-service.yaml rename to charts/nextcloud/templates/metrics/service.yaml index 1d287451..5eaafe09 100644 --- a/charts/nextcloud/templates/metrics-service.yaml +++ b/charts/nextcloud/templates/metrics/service.yaml @@ -1,4 +1,5 @@ {{- if .Values.metrics.enabled }} +--- apiVersion: v1 kind: Service metadata: @@ -9,22 +10,22 @@ metadata: app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/managed-by: {{ .Release.Service }} app.kubernetes.io/component: metrics - {{- if .Values.metrics.service.labels -}} - {{ toYaml .Values.metrics.service.labels | nindent 4 }} - {{- end -}} - {{- if .Values.metrics.service.annotations }} - annotations: {{ toYaml .Values.metrics.service.annotations | nindent 4 }} + {{- with .Values.metrics.service.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with .Values.metrics.service.annotations }} + annotations: + {{- toYaml . | nindent 4 }} {{- end }} spec: type: {{ .Values.metrics.service.type }} - {{ if eq .Values.metrics.service.type "LoadBalancer" -}} {{ if .Values.metrics.service.loadBalancerIP }} + {{- if and (eq .Values.metrics.service.type "LoadBalancer") .Values.metrics.service.loadBalancerIP }} loadBalancerIP: {{ .Values.metrics.service.loadBalancerIP }} - {{ end -}} - {{- end -}} + {{- end }} ports: - - name: metrics - port: 9205 - targetPort: metrics + - name: metrics + port: 9205 + targetPort: metrics selector: app.kubernetes.io/name: {{ include "nextcloud.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} diff --git a/charts/nextcloud/templates/metrics-servicemonitor.yaml b/charts/nextcloud/templates/metrics/servicemonitor.yaml similarity index 66% rename from charts/nextcloud/templates/metrics-servicemonitor.yaml rename to charts/nextcloud/templates/metrics/servicemonitor.yaml index e007784c..adc090a9 100644 --- a/charts/nextcloud/templates/metrics-servicemonitor.yaml +++ b/charts/nextcloud/templates/metrics/servicemonitor.yaml @@ -1,10 +1,11 @@ {{- if and .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled }} +--- apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: name: {{ template "nextcloud.fullname" . }} - {{- if .Values.metrics.serviceMonitor.namespace }} - namespace: {{ .Values.metrics.serviceMonitor.namespace | quote }} + {{- with .Values.metrics.serviceMonitor.namespace }} + namespace: {{ . | quote }} {{- else }} namespace: {{ .Release.Namespace | quote }} {{- end }} @@ -14,8 +15,8 @@ metadata: app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/managed-by: {{ .Release.Service }} app.kubernetes.io/component: metrics - {{- if .Values.metrics.serviceMonitor.labels -}} - {{ toYaml .Values.metrics.serviceMonitor.labels | nindent 4 }} + {{- with .Values.metrics.serviceMonitor.labels }} + {{- toYaml . | nindent 4 }} {{- end }} spec: jobLabel: {{ .Values.metrics.serviceMonitor.jobLabel | quote }} @@ -30,10 +31,10 @@ spec: endpoints: - port: metrics path: "/" - {{- if .Values.metrics.serviceMonitor.interval }} - interval: {{ .Values.metrics.serviceMonitor.interval }} + {{- with .Values.metrics.serviceMonitor.interval }} + interval: {{ . }} {{- end }} - {{- if .Values.metrics.serviceMonitor.scrapeTimeout }} - scrapeTimeout: {{ .Values.metrics.serviceMonitor.scrapeTimeout }} + {{- with .Values.metrics.serviceMonitor.scrapeTimeout }} + scrapeTimeout: {{ . }} {{- end }} {{- end }}