From c27140c4cb39a5ffadfe693da7bcc7d9529bf6f2 Mon Sep 17 00:00:00 2001 From: justusbunsi Date: Thu, 23 Dec 2021 00:25:32 +0800 Subject: [PATCH] Add deprecation fail-safe for Chart templating (#269) With release 5.0.0 there are so many deprecations and breaking changes that it is probably a good way to assist the users with values migration before breaking their environments. This adds another template file that doesn't render anything but ensures the removal of dropped or deprecated settings from customized values files. For when it is necessary, this check can be disabled via new setting `checkDeprecation`. Reviewed-on: https://gitea.com/gitea/helm-chart/pulls/269 Reviewed-by: luhahn Reviewed-by: wxiaoguang Co-authored-by: justusbunsi Co-committed-by: justusbunsi --- .drone.yml | 8 ++++++++ templates/gitea/deprecation.yaml | 34 ++++++++++++++++++++++++++++++++ values.yaml | 4 ++++ 3 files changed, 46 insertions(+) create mode 100644 templates/gitea/deprecation.yaml diff --git a/.drone.yml b/.drone.yml index 55272c7..d1f2138 100644 --- a/.drone.yml +++ b/.drone.yml @@ -15,6 +15,14 @@ steps: - apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/testing helm - helm lint +- name: helm template + pull: always + image: alpine:3.13 + commands: + - apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/testing helm + - helm dependency update + - helm template --debug gitea-helm . + - name: markdown lint pull: always image: docker.io/volkerraschek/markdownlint:latest diff --git a/templates/gitea/deprecation.yaml b/templates/gitea/deprecation.yaml new file mode 100644 index 0000000..057c5bd --- /dev/null +++ b/templates/gitea/deprecation.yaml @@ -0,0 +1,34 @@ +{{- if .Values.checkDeprecation -}} + {{/* CUSTOM PROBES */}} + {{- if .Values.gitea.customLivenessProbe -}} + {{- fail "`gitea.customLivenessProbe` does no longer exist. Please refer to the changelog and configure `gitea.livenessProbe` instead." -}} + {{- end -}} + {{- if .Values.gitea.customReadinessProbe -}} + {{- fail "`gitea.customReadinessProbe` does no longer exist. Please refer to the changelog and configure `gitea.readinessProbe` instead." -}} + {{- end -}} + {{- if .Values.gitea.customStartupProbe -}} + {{- fail "`gitea.customStartupProbe` does no longer exist. Please refer to the changelog and configure `gitea.startupProbe` instead." -}} + {{- end -}} + + {{/* LDAP SOURCES */}} + {{- if kindIs "map" .Values.gitea.ldap -}} + {{- fail "You can configure multiple LDAP sources. Please refer to the changelog and switch `gitea.ldap` from object to array notation." -}} + {{- end -}} + + {{/* OAUTH SOURCES */}} + {{- if kindIs "map" .Values.gitea.oauth -}} + {{- fail "You can configure multiple OAuth sources. Please refer to the changelog and switch `gitea.oauth` from object to array notation." -}} + {{- end -}} + + {{/* BUILTIN */}} + {{- if .Values.gitea.cache -}} + {{- if .Values.gitea.cache.builtIn -}} + {{- fail "`gitea.cache.builtIn` does no longer exist. Please use `memcached` at root level instead." -}} + {{- end -}} + {{- end -}} + {{- if .Values.gitea.database -}} + {{- if .Values.gitea.database.builtIn -}} + {{- fail "`gitea.database.builtIn` does no longer exist. Builtin databases can be configured inside the dependencies itself. Please refer to the changelog." -}} + {{- end -}} + {{- end -}} +{{- end -}} diff --git a/values.yaml b/values.yaml index 11cc183..18a8f20 100644 --- a/values.yaml +++ b/values.yaml @@ -284,3 +284,7 @@ mariadb: port: 3306 persistence: size: 10Gi + +# By default, removed or moved settings that still remain in a user defined values.yaml will cause Helm to fail running the install/update. +# Set it to false to skip this basic validation check. +checkDeprecation: true