Add deprecation fail-safe for Chart templating #269

Merged
luhahn merged 2 commits from justusbunsi/helm-chart:prevent-deprecation-breakage into master 2021-12-22 16:25:34 +00:00
Member

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.

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`.
justusbunsi added this to the 5.0.0 milestone 2021-12-21 13:10:37 +00:00
luhahn approved these changes 2021-12-21 14:47:06 +00:00
luhahn left a comment
Member

LGTM build will succeed if #240 and #268 are merged

LGTM build will succeed if #240 and #268 are merged
Contributor

I'm merging this PR and PR #268 in an integration branch to play with them.

When running the "helm template" command, I get an error:

Error: template: templates/gitea/deprecation.yaml:24:16: executing "templates/gitea/deprecation.yaml" at <.Values.gitea.cache.builtIn>: nil pointer evaluating interface {}.builtIn

Before digging too much into this, do you have any clue why it fails ? Does it work on your side ?

I'm merging this PR and PR #268 in an integration branch to play with them. When running the "helm template" command, I get an error: ``` Error: template: templates/gitea/deprecation.yaml:24:16: executing "templates/gitea/deprecation.yaml" at <.Values.gitea.cache.builtIn>: nil pointer evaluating interface {}.builtIn ``` Before digging too much into this, do you have any clue why it fails ? Does it work on your side ?
Author
Member

I'm merging this PR and PR #268 in an integration branch to play with them.

When running the "helm template" command, I get an error:

Error: template: templates/gitea/deprecation.yaml:24:16: executing "templates/gitea/deprecation.yaml" at <.Values.gitea.cache.builtIn>: nil pointer evaluating interface {}.builtIn

Before digging too much into this, do you have any clue why it fails ? Does it work on your side ?

I'm guessing its a side-effect from the not yet merged #268. I have a similar error when just commenting out the gitea.cache.builtIn without having changed any access to it. Similar failure in Drone build.

> I'm merging this PR and PR #268 in an integration branch to play with them. > > When running the "helm template" command, I get an error: > > ``` > Error: template: templates/gitea/deprecation.yaml:24:16: executing "templates/gitea/deprecation.yaml" at <.Values.gitea.cache.builtIn>: nil pointer evaluating interface {}.builtIn > ``` > > Before digging too much into this, do you have any clue why it fails ? Does it work on your side ? I'm guessing its a side-effect from the not yet merged #268. I have a similar error when just commenting out the `gitea.cache.builtIn` without having changed any access to it. Similar failure in Drone build.
Member

@nmasse-itix good catch. I saw the error as well and ignored it because i did not rebase onto 240/268. However the error comes up because .Values.gitea.cache does not exist anymore and we try to go even deeper down to builtIn.

@nmasse-itix good catch. I saw the error as well and ignored it because i did not rebase onto 240/268. However the error comes up because .Values.gitea.cache does not exist anymore and we try to go even deeper down to builtIn.
luhahn requested changes 2021-12-21 17:38:42 +00:00
luhahn left a comment
Member

.Values.gitea.cache.builtIn needs .Values.gitea.cache to be checked first

.Values.gitea.cache.builtIn needs .Values.gitea.cache to be checked first
luhahn requested changes 2021-12-21 17:46:32 +00:00
@ -0,0 +24,4 @@
{{- if .Values.gitea.cache.builtIn -}}
{{- fail "`gitea.cache.builtIn` does no longer exist. Please use `memcached` at root level instead." -}}
{{- end -}}
{{- if .Values.database.builtIn -}}
Member

this should be .Values.gitea.database -> the gitea is missing

this should be .Values.gitea.database -> the gitea is missing
justusbunsi marked this conversation as resolved
@ -0,0 +25,4 @@
{{- fail "`gitea.cache.builtIn` does no longer exist. Please use `memcached` at root level instead." -}}
{{- end -}}
{{- if .Values.database.builtIn -}}
{{- fail "`database.builtIn` does no longer exist. Builtin databases can be configured inside the dependencies itself. Please refer to the changelog." -}}
Member

this should do the trick:

  {{/* 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 "`database.builtIn` does no longer exist. Builtin databases can be configured inside the dependencies itself. Please refer to the changelog." -}}
    {{- end -}}
  {{- end -}}
{{- end -}}
this should do the trick: ```yaml {{/* 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 "`database.builtIn` does no longer exist. Builtin databases can be configured inside the dependencies itself. Please refer to the changelog." -}} {{- end -}} {{- end -}} {{- end -}} ```
justusbunsi marked this conversation as resolved
Author
Member

Why is ci passing? The logs clearly state linting failures. ?

Why is ci passing? The logs clearly state linting failures. ?
Author
Member

Why is ci passing? The logs clearly state linting failures. ?

For the record: Helm changed the behavior with https://github.com/helm/helm/issues/8973. I used an older helm version locally and it failed. Newer versions just log that as info.

> Why is ci passing? The logs clearly state linting failures. ? For the record: Helm changed the behavior with https://github.com/helm/helm/issues/8973. I used an older helm version locally and it failed. Newer versions just log that as info.
justusbunsi force-pushed prevent-deprecation-breakage from a7668fdf9e to fc5716bd4d 2021-12-21 18:18:14 +00:00 Compare
luhahn approved these changes 2021-12-21 18:18:43 +00:00
luhahn left a comment
Member

All good now :)

All good now :)
Author
Member

Thanks @nmasse-itix for digging into this PR. There was a lot more to fix.

Thanks @nmasse-itix for digging into this PR. There was a lot more to fix.
wxiaoguang approved these changes 2021-12-22 16:19:32 +00:00
luhahn merged commit c27140c4cb into master 2021-12-22 16:25:34 +00:00
justusbunsi deleted branch prevent-deprecation-breakage 2021-12-22 16:32:31 +00:00
Sign in to join this conversation.
No description provided.