Skip to content

Commit

Permalink
fix: another cleanup and linting (contains move of configfile)
Browse files Browse the repository at this point in the history
Signed-off-by: WrenIX <[email protected]>
  • Loading branch information
wrenix committed Nov 22, 2023
1 parent 985cc07 commit 4ee95fc
Show file tree
Hide file tree
Showing 9 changed files with 94 additions and 88 deletions.
1 change: 1 addition & 0 deletions charts/nextcloud/templates/db-secret.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
11 changes: 7 additions & 4 deletions charts/nextcloud/templates/hpa.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{- if .Values.hpa.enabled -}}
---
apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
Expand All @@ -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 }}
{{- with .Values.hpa }}
minReplicas: {{ .minPods }}
maxReplicas: {{ .maxPods }}
targetCPUUtilizationPercentage: {{ .cputhreshold }}
{{- end }}
{{- end }}
57 changes: 29 additions & 28 deletions charts/nextcloud/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{- if .Values.ingress.enabled }}
---
apiVersion: {{ include "nextcloud.ingress.apiVersion" . }}
kind: Ingress
metadata:
Expand All @@ -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 }}
23 changes: 11 additions & 12 deletions charts/nextcloud/templates/nextcloud-data-pvc.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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 -}}
22 changes: 10 additions & 12 deletions charts/nextcloud/templates/nextcloud-pvc.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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 -}}
23 changes: 12 additions & 11 deletions charts/nextcloud/templates/rbac.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 }}
15 changes: 8 additions & 7 deletions charts/nextcloud/templates/secrets.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{- if not .Values.nextcloud.existingSecret.enabled }}
---
apiVersion: v1
kind: Secret
metadata:
Expand All @@ -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 }}
25 changes: 13 additions & 12 deletions charts/nextcloud/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
apiVersion: v1
kind: Service
metadata:
Expand All @@ -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 }}
Expand Down
5 changes: 3 additions & 2 deletions charts/nextcloud/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -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 }}

0 comments on commit 4ee95fc

Please sign in to comment.