diff --git a/charts/nextcloud/templates/deployment.yaml b/charts/nextcloud/templates/deployment.yaml index 3d6840c0..b6fc261d 100644 --- a/charts/nextcloud/templates/deployment.yaml +++ b/charts/nextcloud/templates/deployment.yaml @@ -63,13 +63,13 @@ spec: postStart: exec: command: - {{- toYaml . | nindent 18 -}} + {{- toYaml . | nindent 18 }} {{- end }} {{- with .preStopCommand }} preStop: exec: command: - {{- toYaml . | nindent 18 -}} + {{- toYaml . | nindent 18 }} {{- end }} {{- end }} env: @@ -245,13 +245,13 @@ spec: postStart: exec: command: - {{- toYaml . | nindent 18 -}} + {{- toYaml . | nindent 18 }} {{- end }} {{- with .preStopCommand }} preStop: exec: command: - {{- toYaml . | nindent 18 -}} + {{- toYaml . | nindent 18 }} {{- end }} {{- end }} env: diff --git a/charts/nextcloud/templates/hpa.yaml b/charts/nextcloud/templates/hpa.yaml index 52a30043..d75c611b 100644 --- a/charts/nextcloud/templates/hpa.yaml +++ b/charts/nextcloud/templates/hpa.yaml @@ -1,4 +1,4 @@ -{{- if .Values.hpa.enabled -}} +{{- if .Values.hpa.enabled }} apiVersion: autoscaling/v1 kind: HorizontalPodAutoscaler metadata: @@ -14,7 +14,9 @@ spec: kind: Deployment apiVersion: apps/v1 name: {{ template "nextcloud.fullname" . }} - minReplicas: {{ .Values.hpa.minPods }} - maxReplicas: {{ .Values.hpa.maxPods }} - targetCPUUtilizationPercentage: {{ .Values.hpa.cputhreshold }} -{{- end }} \ No newline at end of file + {{- with .Values.hpa }} + minReplicas: {{ .minPods }} + maxReplicas: {{ .maxPods }} + targetCPUUtilizationPercentage: {{ .cputhreshold }} + {{- end }}{{/* end-with .hpa */}} +{{- end }} diff --git a/charts/nextcloud/templates/ingress.yaml b/charts/nextcloud/templates/ingress.yaml index f26c4d4d..6e90d754 100644 --- a/charts/nextcloud/templates/ingress.yaml +++ b/charts/nextcloud/templates/ingress.yaml @@ -9,16 +9,16 @@ metadata: app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/managed-by: {{ .Release.Service }} app.kubernetes.io/component: app - {{- if .Values.ingress.labels }} -{{ toYaml .Values.ingress.labels | indent 4 }} + {{- with .Values.ingress.labels }} + {{- toYaml . | nindent 4 }} {{- end }} - {{- if .Values.ingress.annotations }} + {{- with .Values.ingress.annotations }} annotations: -{{ toYaml .Values.ingress.annotations | indent 4 }} + {{- toYaml . | nindent 4 }} {{- end }} spec: - {{- if .Values.ingress.className }} - ingressClassName: {{ .Values.ingress.className }} + {{- with .Values.ingress.className }} + ingressClassName: {{ . }} {{- end }} rules: - host: {{ .Values.nextcloud.host }} @@ -38,8 +38,8 @@ spec: serviceName: {{ template "nextcloud.fullname" . }} servicePort: {{ .Values.service.port }} {{- end }} - {{- if .Values.ingress.tls }} + {{- with .Values.ingress.tls }} tls: -{{ toYaml .Values.ingress.tls | indent 4 }} + {{- toYaml . | nindent 4 }} {{- end }} {{- end }} diff --git a/charts/nextcloud/templates/metrics/deployment.yaml b/charts/nextcloud/templates/metrics/deployment.yaml index 1e30c364..6a3e6386 100644 --- a/charts/nextcloud/templates/metrics/deployment.yaml +++ b/charts/nextcloud/templates/metrics/deployment.yaml @@ -23,13 +23,13 @@ spec: 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 }} + {{- with .Values.metrics.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} spec: - {{- if .Values.metrics.image.pullSecrets }} + {{- with .Values.metrics.image.pullSecrets }} imagePullSecrets: - {{- range .Values.metrics.image.pullSecrets }} + {{- range . }} - name: {{ . }} {{- end}} {{- end }} diff --git a/charts/nextcloud/templates/metrics/service.yaml b/charts/nextcloud/templates/metrics/service.yaml index 6544db8d..c9fc72ad 100644 --- a/charts/nextcloud/templates/metrics/service.yaml +++ b/charts/nextcloud/templates/metrics/service.yaml @@ -9,18 +9,20 @@ 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 }} + {{- with .Values.metrics.service.labels }} + {{- toYaml . | nindent 4 }} {{- end -}} - {{- if .Values.metrics.service.annotations }} - annotations: {{ toYaml .Values.metrics.service.annotations | nindent 4 }} + {{- 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 }} - loadBalancerIP: {{ .Values.metrics.service.loadBalancerIP }} - {{ end -}} - {{- end -}} + {{- if eq .Values.metrics.service.type "LoadBalancer" }} + {{- with .Values.metrics.service.loadBalancerIP }} + loadBalancerIP: {{ . }} + {{- end }} + {{- end }} ports: - name: metrics port: 9205 diff --git a/charts/nextcloud/templates/metrics/servicemonitor.yaml b/charts/nextcloud/templates/metrics/servicemonitor.yaml index e007784c..116721b0 100644 --- a/charts/nextcloud/templates/metrics/servicemonitor.yaml +++ b/charts/nextcloud/templates/metrics/servicemonitor.yaml @@ -3,19 +3,15 @@ apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: name: {{ template "nextcloud.fullname" . }} - {{- if .Values.metrics.serviceMonitor.namespace }} - namespace: {{ .Values.metrics.serviceMonitor.namespace | quote }} - {{- else }} - namespace: {{ .Release.Namespace | quote }} - {{- end }} + namespace: {{ .Values.metrics.serviceMonitor.namespace | default .Release.Namespace | quote }} 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 - {{- 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 +26,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 }} diff --git a/charts/nextcloud/templates/nextcloud-data-pvc.yaml b/charts/nextcloud/templates/nextcloud-data-pvc.yaml index 518451d7..a5cad605 100644 --- a/charts/nextcloud/templates/nextcloud-data-pvc.yaml +++ b/charts/nextcloud/templates/nextcloud-data-pvc.yaml @@ -1,5 +1,4 @@ -{{- if and .Values.persistence.enabled .Values.persistence.nextcloudData.enabled -}} -{{- if not .Values.persistence.nextcloudData.existingClaim -}} +{{- if and .Values.persistence.enabled .Values.persistence.nextcloudData.enabled (not .Values.persistence.nextcloudData.existingClaim) }} kind: PersistentVolumeClaim apiVersion: v1 metadata: @@ -10,9 +9,9 @@ metadata: app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/managed-by: {{ .Release.Service }} app.kubernetes.io/component: app - {{- if .Values.persistence.nextcloudData.annotations }} + {{- with .Values.persistence.nextcloudData.annotations }} annotations: -{{ toYaml .Values.persistence.nextcloudData.annotations | indent 4 }} + {{- toYaml . | nindent 4 }} {{- end }} spec: accessModes: @@ -20,12 +19,11 @@ spec: resources: requests: storage: {{ .Values.persistence.nextcloudData.size | quote }} - {{- if .Values.persistence.nextcloudData.storageClass }} - {{- if (eq "-" .Values.persistence.nextcloudData.storageClass) }} + {{- with .Values.persistence.nextcloudData.storageClass }} + {{- if (eq "-" .) }} storageClassName: "" {{- else }} - storageClassName: "{{ .Values.persistence.nextcloudData.storageClass }}" + storageClassName: "{{ . }}" {{- end }} {{- end }} -{{- end -}} -{{- end -}} +{{- end }} diff --git a/charts/nextcloud/templates/nextcloud-pvc.yaml b/charts/nextcloud/templates/nextcloud-pvc.yaml index dc96ba0c..6bdd620b 100644 --- a/charts/nextcloud/templates/nextcloud-pvc.yaml +++ b/charts/nextcloud/templates/nextcloud-pvc.yaml @@ -1,5 +1,4 @@ -{{- if .Values.persistence.enabled -}} -{{- if not .Values.persistence.existingClaim -}} +{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }} kind: PersistentVolumeClaim apiVersion: v1 metadata: @@ -10,9 +9,9 @@ metadata: app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/managed-by: {{ .Release.Service }} app.kubernetes.io/component: app - {{- if .Values.persistence.annotations }} + {{- with .Values.persistence.annotations }} annotations: -{{ toYaml .Values.persistence.annotations | indent 4 }} + {{- toYaml . | nindent 4 }} {{- end }} spec: accessModes: @@ -20,12 +19,11 @@ spec: resources: requests: storage: {{ .Values.persistence.size | quote }} - {{- if .Values.persistence.storageClass }} - {{- if (eq "-" .Values.persistence.storageClass) }} + {{- with .Values.persistence.storageClass }} + {{- if (eq "-" .) }} storageClassName: "" {{- else }} - storageClassName: "{{ .Values.persistence.storageClass }}" + storageClassName: "{{ . }}" {{- end }} {{- end }} -{{- end -}} -{{- end -}} +{{- end }} diff --git a/charts/nextcloud/templates/secrets.yaml b/charts/nextcloud/templates/secrets.yaml index fab8c2c1..be9897d6 100644 --- a/charts/nextcloud/templates/secrets.yaml +++ b/charts/nextcloud/templates/secrets.yaml @@ -11,19 +11,19 @@ metadata: type: Opaque data: nextcloud-username: {{ .Values.nextcloud.username | b64enc | quote }} - {{- if .Values.nextcloud.password }} - nextcloud-password: {{ .Values.nextcloud.password | b64enc | quote }} + {{- with .Values.nextcloud.password }} + nextcloud-password: {{ . | b64enc | quote }} {{- else }} nextcloud-password: {{ randAlphaNum 10 | b64enc | quote }} {{- end }} - {{- if .Values.metrics.token }} - nextcloud-token: {{ .Values.metrics.token | b64enc | quote }} + {{- with .Values.metrics.token }} + nextcloud-token: {{ . | b64enc | quote }} {{- else }} nextcloud-token: {{ randAlphaNum 10 | b64enc | quote }} {{- end }} {{- if .Values.nextcloud.mail.enabled }} - smtp-username: {{ default "" .Values.nextcloud.mail.smtp.name | b64enc | quote }} - smtp-password: {{ default "" .Values.nextcloud.mail.smtp.password | b64enc | quote }} - smtp-host: {{ default "" .Values.nextcloud.mail.smtp.host | b64enc | quote }} + smtp-username: {{ .Values.nextcloud.mail.smtp.name | default "" | b64enc | quote }} + smtp-password: {{ .Values.nextcloud.mail.smtp.password | default "" | b64enc | quote }} + smtp-host: {{ .Values.nextcloud.mail.smtp.host | default "" | b64enc | quote }} {{- end }} {{- end }} diff --git a/charts/nextcloud/templates/service.yaml b/charts/nextcloud/templates/service.yaml index 84f1d2fb..3c10bdc5 100644 --- a/charts/nextcloud/templates/service.yaml +++ b/charts/nextcloud/templates/service.yaml @@ -11,14 +11,14 @@ metadata: spec: type: {{ .Values.service.type }} {{- if and (eq .Values.service.type "LoadBalancer") .Values.service.loadBalancerIP }} - loadBalancerIP: {{ default "" .Values.service.loadBalancerIP }} + loadBalancerIP: {{ .Values.service.loadBalancerIP | default "" }} {{- end }} - {{- if .Values.service.ipFamilies }} + {{- with .Values.service.ipFamilies }} ipFamilies: - {{- toYaml .Values.service.ipFamilies | nindent 4 }} + {{- toYaml . | nindent 4 }} {{- end }} - {{- if .Values.service.ipFamilyPolicy }} - ipFamilyPolicy: {{ .Values.service.ipFamilyPolicy }} + {{- with .Values.service.ipFamilyPolicy }} + ipFamilyPolicy: {{ . }} {{- end }} ports: - port: {{ .Values.service.port }} @@ -26,7 +26,7 @@ spec: protocol: TCP name: http {{- if eq .Values.service.type "NodePort" }} - nodePort: {{ default "" .Values.service.nodePort}} + nodePort: {{ .Values.service.nodePort | default "" }} {{- end }} selector: app.kubernetes.io/name: {{ include "nextcloud.name" . }} diff --git a/charts/nextcloud/templates/serviceaccount.yaml b/charts/nextcloud/templates/serviceaccount.yaml index ea8c0521..132f336b 100644 --- a/charts/nextcloud/templates/serviceaccount.yaml +++ b/charts/nextcloud/templates/serviceaccount.yaml @@ -3,8 +3,8 @@ apiVersion: v1 kind: ServiceAccount metadata: name: {{ .Values.rbac.serviceaccount.name }} - {{- if .Values.rbac.serviceaccount.annotations }} + {{- with .Values.rbac.serviceaccount.annotations }} annotations: - {{- toYaml .Values.rbac.serviceaccount.annotations | nindent 4 }} + {{- toYaml . | nindent 4 }} {{- end }} {{- end }}