Skip to content
This repository has been archived by the owner on Aug 22, 2022. It is now read-only.

Deprecate "-" globally #19

Closed
dirtycajunrice opened this issue Apr 9, 2021 · 3 comments
Closed

Deprecate "-" globally #19

dirtycajunrice opened this issue Apr 9, 2021 · 3 comments
Labels

Comments

@dirtycajunrice
Copy link
Contributor

dirtycajunrice commented Apr 9, 2021

Nope, the underlying sprig library doesn't differentiate between an empty string and nil (See also Masterminds/sprig#53). Guess we're stuck with - for now.

Originally posted by @bjw-s in #14 (comment)

In the same sprig issue, a proper fix was defined:

Found a solution {{ kindIs "invalid" $value }}

Originally posted by @jkroepke in Masterminds/sprig#53 (comment)

By changing anything that was "-" to a nil value either implicitly or explicitly, you can test for it

implicit:
explicit1: nil
explicit2: ~

This could not only fix the verbosity concern of "-" but additionally allow the common charts that have commented out defaults become uncommented with a nil value to test for existence and optionally requirement

@bjw-s
Copy link
Contributor

bjw-s commented Apr 16, 2021

I couldn't get that kindIs fix to work when I tested it, but I may have been doing it wrong 😅 Will try to get it working once more

@bjw-s
Copy link
Contributor

bjw-s commented Apr 16, 2021

storageClassName: {{ if (kindIs "invalid" $values.storageClass) }}""{{- else }}{{ $values.storageClass | quote }}{{- end }}

If I do this, and provide storageClass: nil in the values.yaml it won't work.
I think it might be due to the way the merging of all the Values dicts works. Beginning to suspect that omits any nil or empty values.

@stale
Copy link

stale bot commented Jun 1, 2021

This Issue has been automatically marked as "stale" because it has not had recent activity (for 45 days). It will be closed if no further activity occurs. Thanks for the feedback.

@stale stale bot added the stale label Jun 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants