Skip to content

Commit 0035206

Browse files
committed
fix: another cleanup and linting (contains move of configfile)
Signed-off-by: WrenIX <[email protected]>
1 parent 006ec0d commit 0035206

File tree

9 files changed

+76
-70
lines changed

9 files changed

+76
-70
lines changed

charts/nextcloud/templates/db-secret.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{{- if or .Values.mariadb.enabled .Values.externalDatabase.enabled .Values.postgresql.enabled }}
22
{{- if not .Values.externalDatabase.existingSecret.enabled }}
3+
---
34
apiVersion: v1
45
kind: Secret
56
metadata:

charts/nextcloud/templates/hpa.yaml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{{- if .Values.hpa.enabled -}}
2+
---
23
apiVersion: autoscaling/v1
34
kind: HorizontalPodAutoscaler
45
metadata:
@@ -14,7 +15,9 @@ spec:
1415
kind: Deployment
1516
apiVersion: apps/v1
1617
name: {{ template "nextcloud.fullname" . }}
17-
minReplicas: {{ .Values.hpa.minPods }}
18-
maxReplicas: {{ .Values.hpa.maxPods }}
19-
targetCPUUtilizationPercentage: {{ .Values.hpa.cputhreshold }}
20-
{{- end }}
18+
{{- with .Values.hpa }}
19+
minReplicas: {{ .minPods }}
20+
maxReplicas: {{ .maxPods }}
21+
targetCPUUtilizationPercentage: {{ .cputhreshold }}
22+
{{- end }}
23+
{{- end }}
Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{{- if .Values.ingress.enabled }}
2+
---
23
apiVersion: {{ include "nextcloud.ingress.apiVersion" . }}
34
kind: Ingress
45
metadata:
@@ -9,27 +10,27 @@ metadata:
910
app.kubernetes.io/instance: {{ .Release.Name }}
1011
app.kubernetes.io/managed-by: {{ .Release.Service }}
1112
app.kubernetes.io/component: app
12-
{{- if .Values.ingress.labels }}
13-
{{ toYaml .Values.ingress.labels | indent 4 }}
14-
{{- end }}
15-
{{- if .Values.ingress.annotations }}
13+
{{- with .Values.ingress.labels }}
14+
{{- toYaml . | nindent 4 }}
15+
{{- end }}
16+
{{- with .Values.ingress.annotations }}
1617
annotations:
17-
{{ toYaml .Values.ingress.annotations | indent 4 }}
18-
{{- end }}
18+
{{- toYaml . | nindent 4 }}
19+
{{- end }}
1920
spec:
20-
{{- if .Values.ingress.className }}
21-
ingressClassName: {{ .Values.ingress.className }}
21+
{{- with .Values.ingress.className }}
22+
ingressClassName: {{ . }}
2223
{{- end }}
2324
rules:
2425
- host: {{ .Values.nextcloud.host }}
2526
http:
2627
paths:
2728
- path: {{ .Values.ingress.path }}
28-
{{- if eq (include "nextcloud.ingress.apiVersion" $) "networking.k8s.io/v1" }}
29+
{{- if (eq (include "nextcloud.ingress.apiVersion" $) "networking.k8s.io/v1") }}
2930
pathType: {{ .Values.ingress.pathType }}
3031
{{- end }}
3132
backend:
32-
{{- if eq (include "nextcloud.ingress.apiVersion" $) "networking.k8s.io/v1" }}
33+
{{- if (eq (include "nextcloud.ingress.apiVersion" $) "networking.k8s.io/v1") }}
3334
service:
3435
name: {{ template "nextcloud.fullname" . }}
3536
port:
@@ -38,8 +39,8 @@ spec:
3839
serviceName: {{ template "nextcloud.fullname" . }}
3940
servicePort: {{ .Values.service.port }}
4041
{{- end }}
41-
{{- if .Values.ingress.tls }}
42+
{{- with .Values.ingress.tls }}
4243
tls:
43-
{{ toYaml .Values.ingress.tls | indent 4 }}
44-
{{- end -}}
44+
{{- toYaml . | nindent 4 }}
45+
{{- end }}
4546
{{- end }}
Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
{{- if and .Values.persistence.enabled .Values.persistence.nextcloudData.enabled -}}
2-
{{- if not .Values.persistence.nextcloudData.existingClaim -}}
1+
{{- if and .Values.persistence.enabled .Values.persistence.nextcloudData.enabled (not .Values.persistence.nextcloudData.existingClaim) }}
2+
---
33
kind: PersistentVolumeClaim
44
apiVersion: v1
55
metadata:
@@ -10,22 +10,21 @@ metadata:
1010
app.kubernetes.io/instance: {{ .Release.Name }}
1111
app.kubernetes.io/managed-by: {{ .Release.Service }}
1212
app.kubernetes.io/component: app
13-
{{- if .Values.persistence.nextcloudData.annotations }}
13+
{{- with .Values.persistence.nextcloudData.annotations }}
1414
annotations:
15-
{{ toYaml .Values.persistence.nextcloudData.annotations | indent 4 }}
16-
{{- end }}
15+
{{- toYaml .Values.persistence.nextcloudData.annotations | nindent 4 }}
16+
{{- end }}
1717
spec:
1818
accessModes:
1919
- {{ .Values.persistence.nextcloudData.accessMode | quote }}
2020
resources:
2121
requests:
2222
storage: {{ .Values.persistence.nextcloudData.size | quote }}
23-
{{- if .Values.persistence.nextcloudData.storageClass }}
24-
{{- if (eq "-" .Values.persistence.nextcloudData.storageClass) }}
23+
{{- with .Values.persistence.nextcloudData.storageClass }}
24+
{{- if (eq "-" .) }}
2525
storageClassName: ""
26-
{{- else }}
27-
storageClassName: "{{ .Values.persistence.nextcloudData.storageClass }}"
28-
{{- end }}
26+
{{- else }}
27+
storageClassName: "{{ . }}"
28+
{{- end }}
29+
{{- end }}
2930
{{- end }}
30-
{{- end -}}
31-
{{- end -}}
Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
{{- if .Values.persistence.enabled -}}
2-
{{- if not .Values.persistence.existingClaim -}}
1+
{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }}
32
kind: PersistentVolumeClaim
43
apiVersion: v1
54
metadata:
@@ -10,22 +9,21 @@ metadata:
109
app.kubernetes.io/instance: {{ .Release.Name }}
1110
app.kubernetes.io/managed-by: {{ .Release.Service }}
1211
app.kubernetes.io/component: app
13-
{{- if .Values.persistence.annotations }}
12+
{{- with .Values.persistence.annotations }}
1413
annotations:
15-
{{ toYaml .Values.persistence.annotations | indent 4 }}
16-
{{- end }}
14+
{{- toYaml . | nindent 4 }}
15+
{{- end }}
1716
spec:
1817
accessModes:
1918
- {{ .Values.persistence.accessMode | quote }}
2019
resources:
2120
requests:
2221
storage: {{ .Values.persistence.size | quote }}
23-
{{- if .Values.persistence.storageClass }}
24-
{{- if (eq "-" .Values.persistence.storageClass) }}
22+
{{- with .Values.persistence.storageClass }}
23+
{{- if (eq "-" .) }}
2524
storageClassName: ""
26-
{{- else }}
27-
storageClassName: "{{ .Values.persistence.storageClass }}"
28-
{{- end }}
25+
{{- else }}
26+
storageClassName: "{{ . }}"
27+
{{- end }}
28+
{{- end }}
2929
{{- end }}
30-
{{- end -}}
31-
{{- end -}}

charts/nextcloud/templates/rbac.yaml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
{{- if .Values.rbac.enabled }}
2+
---
23
apiVersion: rbac.authorization.k8s.io/v1
34
kind: Role
45
metadata:
56
name: {{ template "nextcloud.fullname" . }}-privileged
67
namespace: {{ .Release.Namespace }}
78
rules:
8-
- apiGroups:
9-
- extensions
10-
resourceNames:
11-
- privileged
12-
resources:
13-
- podsecuritypolicies
14-
verbs:
15-
- use
9+
- apiGroups:
10+
- extensions
11+
resourceNames:
12+
- privileged
13+
resources:
14+
- podsecuritypolicies
15+
verbs:
16+
- use
1617
---
1718
apiVersion: rbac.authorization.k8s.io/v1
1819
kind: RoleBinding
Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{{- if not .Values.nextcloud.existingSecret.enabled }}
2+
---
23
apiVersion: v1
34
kind: Secret
45
metadata:
@@ -11,19 +12,19 @@ metadata:
1112
type: Opaque
1213
data:
1314
nextcloud-username: {{ .Values.nextcloud.username | b64enc | quote }}
14-
{{- if .Values.nextcloud.password }}
15-
nextcloud-password: {{ .Values.nextcloud.password | b64enc | quote }}
15+
{{- with .Values.nextcloud.password }}
16+
nextcloud-password: {{ . | b64enc | quote }}
1617
{{- else }}
1718
nextcloud-password: {{ randAlphaNum 10 | b64enc | quote }}
1819
{{- end }}
19-
{{- if .Values.metrics.token }}
20-
nextcloud-token: {{ .Values.metrics.token | b64enc | quote }}
20+
{{- with .Values.metrics.token }}
21+
nextcloud-token: {{ . | b64enc | quote }}
2122
{{- else }}
2223
nextcloud-token: {{ randAlphaNum 10 | b64enc | quote }}
2324
{{- end }}
2425
{{- if .Values.nextcloud.mail.enabled }}
25-
smtp-username: {{ default "" .Values.nextcloud.mail.smtp.name | b64enc | quote }}
26-
smtp-password: {{ default "" .Values.nextcloud.mail.smtp.password | b64enc | quote }}
27-
smtp-host: {{ default "" .Values.nextcloud.mail.smtp.host | b64enc | quote }}
26+
smtp-username: {{ .Values.nextcloud.mail.smtp.name | default "" | b64enc | quote }}
27+
smtp-password: {{ .Values.nextcloud.mail.smtp.password | default "" | b64enc | quote }}
28+
smtp-host: {{ .Values.nextcloud.mail.smtp.host | default "" | b64enc | quote }}
2829
{{- end }}
2930
{{- end }}

charts/nextcloud/templates/service.yaml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
apiVersion: v1
23
kind: Service
34
metadata:
@@ -11,23 +12,23 @@ metadata:
1112
spec:
1213
type: {{ .Values.service.type }}
1314
{{- if and (eq .Values.service.type "LoadBalancer") .Values.service.loadBalancerIP }}
14-
loadBalancerIP: {{ default "" .Values.service.loadBalancerIP }}
15+
loadBalancerIP: {{ .Values.service.loadBalancerIP | default "" }}
1516
{{- end }}
16-
{{- if .Values.service.ipFamilies }}
17+
{{- with .Values.service.ipFamilies }}
1718
ipFamilies:
18-
{{- toYaml .Values.service.ipFamilies | nindent 4 }}
19+
{{- toYaml . | nindent 4 }}
1920
{{- end }}
20-
{{- if .Values.service.ipFamilyPolicy }}
21-
ipFamilyPolicy: {{ .Values.service.ipFamilyPolicy }}
21+
{{- with .Values.service.ipFamilyPolicy }}
22+
ipFamilyPolicy: {{ . }}
2223
{{- end }}
2324
ports:
24-
- port: {{ .Values.service.port }}
25-
targetPort: {{ .Values.nextcloud.containerPort }}
26-
protocol: TCP
27-
name: http
28-
{{- if eq .Values.service.type "NodePort" }}
29-
nodePort: {{ default "" .Values.service.nodePort}}
30-
{{- end }}
25+
- port: {{ .Values.service.port }}
26+
targetPort: {{ .Values.nextcloud.containerPort }}
27+
protocol: TCP
28+
name: http
29+
{{- if (eq .Values.service.type "NodePort") }}
30+
nodePort: {{ .Values.service.nodePort | default "" }}
31+
{{- end }}
3132
selector:
3233
app.kubernetes.io/name: {{ include "nextcloud.name" . }}
3334
app.kubernetes.io/instance: {{ .Release.Name }}
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
{{- if and .Values.rbac.enabled .Values.rbac.serviceaccount.create }}
2+
---
23
apiVersion: v1
34
kind: ServiceAccount
45
metadata:
56
name: {{ .Values.rbac.serviceaccount.name }}
6-
{{- if .Values.rbac.serviceaccount.annotations }}
7+
{{- with .Values.rbac.serviceaccount.annotations }}
78
annotations:
8-
{{- toYaml .Values.rbac.serviceaccount.annotations | nindent 4 }}
9+
{{- toYaml . | nindent 4 }}
910
{{- end }}
1011
{{- end }}

0 commit comments

Comments
 (0)