Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: lint all templates to fix indentation and update style #465

Merged
merged 11 commits into from
Nov 18, 2023
2 changes: 1 addition & 1 deletion charts/nextcloud/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: nextcloud
version: 4.5.0
version: 4.5.1
appVersion: 27.1.3
description: A file sharing server that puts the control and security of your own data back into your hands.
keywords:
Expand Down
68 changes: 34 additions & 34 deletions charts/nextcloud/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Create a default fully qualified redis app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "nextcloud.redis.fullname" -}}
{{- printf "%s-%s" .Release.Name "redis" | trunc 63 | trimSuffix "-" -}}
{{- printf "%s-redis" .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Expand Down Expand Up @@ -80,13 +80,13 @@ Create environment variables used to configure the nextcloud container as well a
- name: MYSQL_USER
valueFrom:
secretKeyRef:
name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-%s" .Release.Name "db") }}
key: {{ .Values.externalDatabase.existingSecret.usernameKey | default "db-username" }}
name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-db" .Release.Name) }}
key: {{ .Values.externalDatabase.existingSecret.usernameKey }}
- name: MYSQL_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-%s" .Release.Name "db") }}
key: {{ .Values.externalDatabase.existingSecret.passwordKey | default "db-password" }}
name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-db" .Release.Name) }}
key: {{ .Values.externalDatabase.existingSecret.passwordKey }}
{{- else if .Values.postgresql.enabled }}
- name: POSTGRES_HOST
value: {{ template "postgresql.v1.primary.fullname" .Subcharts.postgresql }}
Expand All @@ -99,20 +99,20 @@ Create environment variables used to configure the nextcloud container as well a
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-%s" .Release.Name "db") }}
key: {{ .Values.externalDatabase.existingSecret.usernameKey | default "db-username" }}
name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-db" .Release.Name) }}
key: {{ .Values.externalDatabase.existingSecret.usernameKey }}
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-%s" .Release.Name "db") }}
key: {{ .Values.externalDatabase.existingSecret.passwordKey | default "db-password" }}
name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-db" .Release.Name) }}
key: {{ .Values.externalDatabase.existingSecret.passwordKey }}
{{- else }}
{{- if eq .Values.externalDatabase.type "postgresql" }}
- name: POSTGRES_HOST
{{- if .Values.externalDatabase.existingSecret.hostKey }}
valueFrom:
secretKeyRef:
name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-%s" .Release.Name "db") }}
name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-db" .Release.Name) }}
key: {{ .Values.externalDatabase.existingSecret.hostKey }}
{{- else }}
value: {{ .Values.externalDatabase.host | quote }}
Expand All @@ -121,27 +121,27 @@ Create environment variables used to configure the nextcloud container as well a
{{- if .Values.externalDatabase.existingSecret.databaseKey }}
valueFrom:
secretKeyRef:
name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-%s" .Release.Name "db") }}
name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-db" .Release.Name) }}
key: {{ .Values.externalDatabase.existingSecret.databaseKey }}
{{- else }}
value: {{ .Values.externalDatabase.database | quote }}
{{- end }}
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-%s" .Release.Name "db") }}
key: {{ .Values.externalDatabase.existingSecret.usernameKey | default "db-username" }}
name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-db" .Release.Name) }}
key: {{ .Values.externalDatabase.existingSecret.usernameKey }}
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-%s" .Release.Name "db") }}
key: {{ .Values.externalDatabase.existingSecret.passwordKey | default "db-password" }}
name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-db" .Release.Name) }}
key: {{ .Values.externalDatabase.existingSecret.passwordKey }}
{{- else }}
- name: MYSQL_HOST
{{- if .Values.externalDatabase.existingSecret.hostKey }}
valueFrom:
secretKeyRef:
name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-%s" .Release.Name "db") }}
name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-db" .Release.Name) }}
key: {{ .Values.externalDatabase.existingSecret.hostKey }}
{{- else }}
value: {{ .Values.externalDatabase.host | quote }}
Expand All @@ -150,33 +150,33 @@ Create environment variables used to configure the nextcloud container as well a
{{- if .Values.externalDatabase.existingSecret.databaseKey }}
valueFrom:
secretKeyRef:
name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-%s" .Release.Name "db") }}
name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-db" .Release.Name) }}
key: {{ .Values.externalDatabase.existingSecret.databaseKey }}
{{- else }}
value: {{ .Values.externalDatabase.database | quote }}
{{- end }}
- name: MYSQL_USER
valueFrom:
secretKeyRef:
name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-%s" .Release.Name "db") }}
key: {{ .Values.externalDatabase.existingSecret.usernameKey | default "db-username" }}
name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-db" .Release.Name) }}
key: {{ .Values.externalDatabase.existingSecret.usernameKey }}
- name: MYSQL_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-%s" .Release.Name "db") }}
key: {{ .Values.externalDatabase.existingSecret.passwordKey | default "db-password" }}
name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-db" .Release.Name) }}
key: {{ .Values.externalDatabase.existingSecret.passwordKey }}
{{- end }}
{{- end }}
- name: NEXTCLOUD_ADMIN_USER
valueFrom:
secretKeyRef:
name: {{ .Values.nextcloud.existingSecret.secretName | default (include "nextcloud.fullname" .) }}
key: {{ .Values.nextcloud.existingSecret.usernameKey | default "nextcloud-username" }}
key: {{ .Values.nextcloud.existingSecret.usernameKey }}
- name: NEXTCLOUD_ADMIN_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.nextcloud.existingSecret.secretName | default (include "nextcloud.fullname" .) }}
key: {{ .Values.nextcloud.existingSecret.passwordKey | default "nextcloud-password" }}
key: {{ .Values.nextcloud.existingSecret.passwordKey }}
- name: NEXTCLOUD_TRUSTED_DOMAINS
value: {{ .Values.nextcloud.host }}
{{- if ne (int .Values.nextcloud.update) 0 }}
Expand All @@ -200,17 +200,17 @@ Create environment variables used to configure the nextcloud container as well a
valueFrom:
secretKeyRef:
name: {{ .Values.nextcloud.existingSecret.secretName | default (include "nextcloud.fullname" .) }}
key: {{ .Values.nextcloud.existingSecret.smtpHostKey | default "smtp-host" }}
key: {{ .Values.nextcloud.existingSecret.smtpHostKey }}
- name: SMTP_NAME
valueFrom:
secretKeyRef:
name: {{ .Values.nextcloud.existingSecret.secretName | default (include "nextcloud.fullname" .) }}
key: {{ .Values.nextcloud.existingSecret.smtpUsernameKey | default "smtp-username" }}
key: {{ .Values.nextcloud.existingSecret.smtpUsernameKey }}
- name: SMTP_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.nextcloud.existingSecret.secretName | default (include "nextcloud.fullname" .) }}
key: {{ .Values.nextcloud.existingSecret.smtpPasswordKey | default "smtp-password" }}
key: {{ .Values.nextcloud.existingSecret.smtpPasswordKey }}
{{- end }}
{{- if .Values.redis.enabled }}
- name: REDIS_HOST
Expand Down Expand Up @@ -242,31 +242,31 @@ Create volume mounts for the nextcloud container as well as the cron sidecar con
{{- define "nextcloud.volumeMounts" -}}
- name: nextcloud-main
mountPath: /var/www/
subPath: {{ ternary "root" (printf "%s/%s" .Values.nextcloud.persistence.subPath "root") (empty .Values.nextcloud.persistence.subPath) }}
subPath: {{ ternary "root" (printf "%s/root" .Values.nextcloud.persistence.subPath) (empty .Values.nextcloud.persistence.subPath) }}
- name: nextcloud-main
mountPath: /var/www/html
subPath: {{ ternary "html" (printf "%s/%s" .Values.nextcloud.persistence.subPath "html") (empty .Values.nextcloud.persistence.subPath) }}
subPath: {{ ternary "html" (printf "%s/html" .Values.nextcloud.persistence.subPath) (empty .Values.nextcloud.persistence.subPath) }}
{{- if and .Values.persistence.nextcloudData.enabled .Values.persistence.enabled }}
- name: nextcloud-data
mountPath: {{ .Values.nextcloud.datadir }}
subPath: {{ ternary "data" (printf "%s/%s" .Values.persistence.nextcloudData.subPath "data") (empty .Values.persistence.nextcloudData.subPath) }}
subPath: {{ ternary "data" (printf "%s/data" .Values.persistence.nextcloudData.subPath) (empty .Values.persistence.nextcloudData.subPath) }}
{{- else }}
- name: nextcloud-main
mountPath: {{ .Values.nextcloud.datadir }}
subPath: {{ ternary "data" (printf "%s/%s" .Values.persistence.subPath "data") (empty .Values.persistence.subPath) }}
subPath: {{ ternary "data" (printf "%s/data" .Values.persistence.subPath) (empty .Values.persistence.subPath) }}
{{- end }}
- name: nextcloud-main
mountPath: /var/www/html/config
subPath: {{ ternary "config" (printf "%s/%s" .Values.nextcloud.persistence.subPath "config") (empty .Values.nextcloud.persistence.subPath) }}
subPath: {{ ternary "config" (printf "%s/config" .Values.nextcloud.persistence.subPath) (empty .Values.nextcloud.persistence.subPath) }}
- name: nextcloud-main
mountPath: /var/www/html/custom_apps
subPath: {{ ternary "custom_apps" (printf "%s/%s" .Values.nextcloud.persistence.subPath "custom_apps") (empty .Values.nextcloud.persistence.subPath) }}
subPath: {{ ternary "custom_apps" (printf "%s/custom_apps" .Values.nextcloud.persistence.subPath) (empty .Values.nextcloud.persistence.subPath) }}
- name: nextcloud-main
mountPath: /var/www/tmp
subPath: {{ ternary "tmp" (printf "%s/%s" .Values.nextcloud.persistence.subPath "tmp") (empty .Values.nextcloud.persistence.subPath) }}
subPath: {{ ternary "tmp" (printf "%s/tmp" .Values.nextcloud.persistence.subPath) (empty .Values.nextcloud.persistence.subPath) }}
- name: nextcloud-main
mountPath: /var/www/html/themes
subPath: {{ ternary "themes" (printf "%s/%s" .Values.nextcloud.persistence.subPath "themes") (empty .Values.nextcloud.persistence.subPath) }}
subPath: {{ ternary "themes" (printf "%s/themes" .Values.nextcloud.persistence.subPath) (empty .Values.nextcloud.persistence.subPath) }}
{{- range $key, $value := .Values.nextcloud.configs }}
- name: nextcloud-config
mountPath: /var/www/html/config/{{ $key }}
Expand Down
44 changes: 22 additions & 22 deletions charts/nextcloud/templates/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ metadata:
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
data:
{{- range $key, $value := .Values.nextcloud.configs }}
{{- range $key, $value := .Values.nextcloud.configs }}
{{ $key }}: |-
{{ $value | indent 4 }}
{{- end }}
{{- if .Values.nextcloud.defaultConfigs }}
{{- if index .Values.nextcloud.defaultConfigs ".htaccess" }}
{{ $value | nindent 4 }}
{{- end }}
{{- if .Values.nextcloud.defaultConfigs }}
{{- if index .Values.nextcloud.defaultConfigs ".htaccess" }}
.htaccess: |-
# line below if for Apache 2.4
<ifModule mod_authz_core.c>
Expand All @@ -28,8 +28,8 @@ data:
<ifModule mod_autoindex.c>
IndexIgnore *
</ifModule>
{{- end }}
{{- if index .Values.nextcloud.defaultConfigs "redis.config.php" }}
{{- end }}
{{- if index .Values.nextcloud.defaultConfigs "redis.config.php" }}
redis.config.php: |-
<?php
if (getenv('REDIS_HOST')) {
Expand All @@ -39,28 +39,28 @@ data:
'redis' => array(
'host' => getenv('REDIS_HOST'),
'port' => getenv('REDIS_HOST_PORT') ?: 6379,
{{- if .Values.redis.auth.enabled }}
{{- if .Values.redis.auth.enabled }}
'password' => getenv('REDIS_HOST_PASSWORD'),
{{- end }}
{{- end }}
),
);
}
{{- end }}
{{- if index .Values.nextcloud.defaultConfigs "apache-pretty-urls.config.php" }}
{{- end }}
{{- if index .Values.nextcloud.defaultConfigs "apache-pretty-urls.config.php" }}
apache-pretty-urls.config.php: |-
<?php
$CONFIG = array (
'htaccess.RewriteBase' => '/',
);
{{- end }}
{{- if index .Values.nextcloud.defaultConfigs "apcu.config.php" }}
{{- end }}
{{- if index .Values.nextcloud.defaultConfigs "apcu.config.php" }}
apcu.config.php: |-
<?php
$CONFIG = array (
'memcache.local' => '\OC\Memcache\APCu',
);
{{- end }}
{{- if index .Values.nextcloud.defaultConfigs "apps.config.php" }}
{{- end }}
{{- if index .Values.nextcloud.defaultConfigs "apps.config.php" }}
apps.config.php: |-
<?php
$CONFIG = array (
Expand All @@ -77,8 +77,8 @@ data:
),
),
);
{{- end }}
{{- if index .Values.nextcloud.defaultConfigs "autoconfig.php" }}
{{- end }}
{{- if index .Values.nextcloud.defaultConfigs "autoconfig.php" }}
autoconfig.php: |-
<?php
$autoconfig_enabled = false;
Expand All @@ -104,8 +104,8 @@ data:
if ($autoconfig_enabled) {
$AUTOCONFIG["directory"] = getenv('NEXTCLOUD_DATA_DIR') ?: "/var/www/html/data";
}
{{- end }}
{{- if index .Values.nextcloud.defaultConfigs "smtp.config.php" }}
{{- end }}
{{- if index .Values.nextcloud.defaultConfigs "smtp.config.php" }}
smtp.config.php: |-
<?php
if (getenv('SMTP_HOST') && getenv('MAIL_FROM_ADDRESS') && getenv('MAIL_DOMAIN')) {
Expand All @@ -122,6 +122,6 @@ data:
'mail_domain' => getenv('MAIL_DOMAIN'),
);
}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}{{/* end-if defaultConfigs */}}
{{- end }}{{/* end-if configs */}}
14 changes: 7 additions & 7 deletions charts/nextcloud/templates/db-secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ printf "%s-%s" .Release.Name "db" }}
name: {{ .Release.Name }}-db
labels:
app.kubernetes.io/name: {{ include "nextcloud.name" . }}
helm.sh/chart: {{ include "nextcloud.chart" . }}
Expand All @@ -12,14 +12,14 @@ metadata:
type: Opaque
data:
{{- if .Values.mariadb.enabled }}
db-password: {{ default "" .Values.mariadb.auth.password | b64enc | quote }}
db-username: {{ default "" .Values.mariadb.auth.username | b64enc | quote }}
db-username: {{ .Values.mariadb.auth.username | b64enc | quote }}
db-password: {{ .Values.mariadb.auth.password | b64enc | quote }}
{{- else if .Values.postgresql.enabled }}
db-password: {{ default "" .Values.postgresql.global.postgresql.auth.password | b64enc | quote }}
db-username: {{ default "" .Values.postgresql.global.postgresql.auth.username | b64enc | quote }}
db-username: {{ .Values.postgresql.global.postgresql.auth.username | b64enc | quote }}
db-password: {{ .Values.postgresql.global.postgresql.auth.password | b64enc | quote }}
{{- else }}
db-password: {{ default "" .Values.externalDatabase.password | b64enc | quote }}
db-username: {{ default "" .Values.externalDatabase.user | b64enc | quote }}
db-username: {{ .Values.externalDatabase.user | b64enc | quote }}
db-password: {{ .Values.externalDatabase.password | b64enc | quote }}
{{- end }}
{{- end }}
{{- end }}
Loading