diff --git a/charts/nextcloud/templates/db-secret.yaml b/charts/nextcloud/templates/db-secret.yaml index dcc3129a..491c460d 100644 --- a/charts/nextcloud/templates/db-secret.yaml +++ b/charts/nextcloud/templates/db-secret.yaml @@ -1,5 +1,6 @@ {{- if or .Values.mariadb.enabled .Values.externalDatabase.enabled .Values.postgresql.enabled }} {{- if not .Values.externalDatabase.existingSecret.enabled }} +--- apiVersion: v1 kind: Secret metadata: diff --git a/charts/nextcloud/templates/hpa.yaml b/charts/nextcloud/templates/hpa.yaml index 52a30043..21d51d62 100644 --- a/charts/nextcloud/templates/hpa.yaml +++ b/charts/nextcloud/templates/hpa.yaml @@ -1,4 +1,5 @@ {{- if .Values.hpa.enabled -}} +--- apiVersion: autoscaling/v1 kind: HorizontalPodAutoscaler metadata: @@ -14,7 +15,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 }} diff --git a/charts/nextcloud/templates/ingress.yaml b/charts/nextcloud/templates/ingress.yaml index 9f93c2e8..51a1e9d8 100644 --- a/charts/nextcloud/templates/ingress.yaml +++ b/charts/nextcloud/templates/ingress.yaml @@ -1,4 +1,5 @@ {{- if .Values.ingress.enabled }} +--- apiVersion: {{ include "nextcloud.ingress.apiVersion" . }} kind: Ingress metadata: @@ -9,37 +10,37 @@ 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 }} -{{- end }} -{{- if .Values.ingress.annotations }} + {{- with .Values.ingress.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with .Values.ingress.annotations }} annotations: -{{ toYaml .Values.ingress.annotations | indent 4 }} -{{- end }} + {{- toYaml . | nindent 4 }} + {{- end }} spec: - {{- if .Values.ingress.className }} - ingressClassName: {{ .Values.ingress.className }} + {{- with .Values.ingress.className }} + ingressClassName: {{ . }} {{- end }} rules: - - host: {{ .Values.nextcloud.host }} - http: - paths: - - path: {{ .Values.ingress.path }} - {{- if eq (include "nextcloud.ingress.apiVersion" $) "networking.k8s.io/v1" }} - pathType: {{ .Values.ingress.pathType }} - {{- end }} - backend: - {{- if eq (include "nextcloud.ingress.apiVersion" $) "networking.k8s.io/v1" }} - service: - name: {{ template "nextcloud.fullname" . }} - port: - number: {{ .Values.service.port }} - {{- else }} - serviceName: {{ template "nextcloud.fullname" . }} - servicePort: {{ .Values.service.port }} - {{- end }} -{{- if .Values.ingress.tls }} + - host: {{ .Values.nextcloud.host }} + http: + paths: + - path: {{ .Values.ingress.path }} + {{- if (eq (include "nextcloud.ingress.apiVersion" $) "networking.k8s.io/v1") }} + pathType: {{ .Values.ingress.pathType }} + {{- end }} + backend: + {{- if (eq (include "nextcloud.ingress.apiVersion" $) "networking.k8s.io/v1") }} + service: + name: {{ template "nextcloud.fullname" . }} + port: + number: {{ .Values.service.port }} + {{- else }} + serviceName: {{ template "nextcloud.fullname" . }} + servicePort: {{ .Values.service.port }} + {{- end }} + {{- with .Values.ingress.tls }} tls: -{{ toYaml .Values.ingress.tls | indent 4 }} -{{- end -}} + {{- toYaml . | nindent 4 }} + {{- end }} {{- end }} diff --git a/charts/nextcloud/templates/nextcloud-data-pvc.yaml b/charts/nextcloud/templates/nextcloud-data-pvc.yaml index 7c2febc3..a8efca56 100644 --- a/charts/nextcloud/templates/nextcloud-data-pvc.yaml +++ b/charts/nextcloud/templates/nextcloud-data-pvc.yaml @@ -1,5 +1,5 @@ -{{- 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,22 +10,21 @@ 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 }} -{{- end }} + {{- toYaml .Values.persistence.nextcloudData.annotations | nindent 4 }} + {{- end }} spec: accessModes: - {{ .Values.persistence.nextcloudData.accessMode | quote }} 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 }}" -{{- end }} + {{- else }} + storageClassName: "{{ . }}" + {{- end }} + {{- end }} {{- end }} -{{- end -}} -{{- end -}} diff --git a/charts/nextcloud/templates/nextcloud-pvc.yaml b/charts/nextcloud/templates/nextcloud-pvc.yaml index 8c1789af..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,22 +9,21 @@ 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 }} -{{- end }} + {{- toYaml . | nindent 4 }} + {{- end }} spec: accessModes: - {{ .Values.persistence.accessMode | quote }} 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 }}" -{{- end }} + {{- else }} + storageClassName: "{{ . }}" + {{- end }} + {{- end }} {{- end }} -{{- end -}} -{{- end -}} diff --git a/charts/nextcloud/templates/rbac.yaml b/charts/nextcloud/templates/rbac.yaml index 6a1c9fab..e6b6a11a 100644 --- a/charts/nextcloud/templates/rbac.yaml +++ b/charts/nextcloud/templates/rbac.yaml @@ -1,18 +1,19 @@ {{- if .Values.rbac.enabled }} +--- apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: name: {{ template "nextcloud.fullname" . }}-privileged namespace: {{ .Release.Namespace }} rules: -- apiGroups: - - extensions - resourceNames: - - privileged - resources: - - podsecuritypolicies - verbs: - - use + - apiGroups: + - extensions + resourceNames: + - privileged + resources: + - podsecuritypolicies + verbs: + - use --- apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding @@ -24,7 +25,7 @@ roleRef: kind: Role name: {{ template "nextcloud.fullname" . }}-privileged subjects: -- kind: ServiceAccount - name: {{ .Values.rbac.serviceaccount.name }} - namespace: {{ .Release.Namespace }} + - kind: ServiceAccount + name: {{ .Values.rbac.serviceaccount.name }} + namespace: {{ .Release.Namespace }} {{- end }} diff --git a/charts/nextcloud/templates/secrets.yaml b/charts/nextcloud/templates/secrets.yaml index fab8c2c1..9b3ed4f9 100644 --- a/charts/nextcloud/templates/secrets.yaml +++ b/charts/nextcloud/templates/secrets.yaml @@ -1,4 +1,5 @@ {{- if not .Values.nextcloud.existingSecret.enabled }} +--- apiVersion: v1 kind: Secret metadata: @@ -11,19 +12,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 eb9fcd39..2526c291 100644 --- a/charts/nextcloud/templates/service.yaml +++ b/charts/nextcloud/templates/service.yaml @@ -1,3 +1,4 @@ +--- apiVersion: v1 kind: Service metadata: @@ -11,23 +12,23 @@ 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 }} - targetPort: {{ .Values.nextcloud.containerPort }} - protocol: TCP - name: http - {{- if eq .Values.service.type "NodePort" }} - nodePort: {{ default "" .Values.service.nodePort}} - {{- end }} + - port: {{ .Values.service.port }} + targetPort: {{ .Values.nextcloud.containerPort }} + protocol: TCP + name: http + {{- if (eq .Values.service.type "NodePort") }} + nodePort: {{ .Values.service.nodePort | default "" }} + {{- end }} selector: app.kubernetes.io/name: {{ include "nextcloud.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} diff --git a/charts/nextcloud/templates/serviceaccount.yaml b/charts/nextcloud/templates/serviceaccount.yaml index ea8c0521..84989dc0 100644 --- a/charts/nextcloud/templates/serviceaccount.yaml +++ b/charts/nextcloud/templates/serviceaccount.yaml @@ -1,10 +1,11 @@ {{- if and .Values.rbac.enabled .Values.rbac.serviceaccount.create }} +--- 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 }}