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

Setting cronjob.jobBackoffLimit to 0 (without quotes) causes it to use the default value #469

Open
jvmdc opened this issue Aug 24, 2023 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@jvmdc
Copy link

jvmdc commented Aug 24, 2023

When setting cronjob.jobBackoffLimit to 0 without quotes, the rendered template contains no backoffLimit key. This is due to the check if .Values.cronjob.jobBackoffLimit interpreting 0 as false as documented here: https://pkg.go.dev/text/template#hdr-Actions

A possible workaround for the end-user is to simply quote the value, i.e.

cronjob:
  jobBackoffLimit: '0'

instead of

cronjob:
  jobBackoffLimit: 0

which will cause the template to render as intended. However this might not be clear for end-users.

I've attempted to fix the issue for this particular variable by changing the check to - if or (.Values.cronjob.jobBackoffLimit) (kindIs "float64" .Values.cronjob.jobBackoffLimit), i.e. checking the value as before, but also checking the kind of the value - an unquoted 0 results in a float64 kind. This feels a bit hacky though.

Any better suggestions or should this simply be left as-is?

(This could also be an issue for other keys, this is just the one I was working with at the moment)

@viceice viceice added enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed labels Aug 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants