-
Notifications
You must be signed in to change notification settings - Fork 456
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
Clarification: nil vs empty string #53
Comments
OK, I found the relevant helm issue: helm/helm#2600 But just checking here, is there really no way for sprig to differentiate the difference between |
Wow. That issue actually helped me nail down an issue I was seeing in a local PVC! Ha! Okay, so an It might be nice to be able to test whether something is Does that answer your question, or am I misunderstanding. |
@technosophos If something is a string, isn't the initialized value on a struct I imagine I'm missing something which is why I ask. |
Found a solution |
@scottrigby @technosophos Here's an example of the previous comment... https://play.golang.org/p/9yJW5iGT4qa When I looked at this in the past I'd not thought of this. Thanks @jkroepke |
Love it 😄 |
add missing bpf.hostLegacyRouting, bpf.tproxy, bpf.vlanBypass in helm reference and helm documents. remove bpf.lbBypassFIBLookup, hostRouting when original commented helm option is uncommented, the helm template generated manifest will include the new uncommented helm option even helm template does not specify the new uncommented option, this behavior could affect unknown effect, see cilium#21195 (comment) For bool type helm option, gandro suggested (not (eq nil $value)) check, but it didn't work. see cilium#21195 (comment) Eventually gandro suggested the {{- if (not (kindIs "invalid" .Values.bpf.tproxy)) }} trick found in Masterminds/sprig#53 (comment) see: cilium#21195 (comment) cilium#21195 (comment) Signed-off-by: Vincent Li <v.li@f5.com>
add missing bpf.hostLegacyRouting, bpf.tproxy, bpf.vlanBypass in helm reference and helm documents. remove bpf.lbBypassFIBLookup, hostRouting when original commented helm option is uncommented, the helm template generated manifest will include the new uncommented helm option even helm template does not specify the new uncommented option, this behavior could affect unknown effect, see #21195 (comment) For bool type helm option, gandro suggested (not (eq nil $value)) check, but it didn't work. see #21195 (comment) Eventually gandro suggested the {{- if (not (kindIs "invalid" .Values.bpf.tproxy)) }} trick found in Masterminds/sprig#53 (comment) see: #21195 (comment) #21195 (comment) Signed-off-by: Vincent Li <v.li@f5.com>
@jkroepke While this solution might work, I imagine there are other cases where the "kind" of something might be "invalid" without it being I think better option is to use a direct equality check against
PS: the reason that the kind of |
Hello!
While reviewing recent charts PRs (example: helm/charts#2004), I see this interesting pattern:
The explanation is:
My question was, since the template-rendered YAML will either be a storage class name, an empty string (to disable dynamic provisioning), or not set at all, can't we just do this instead?
Then the template logic could be simplified to:
But this would only work if an empty string is different from not set (
nil
) when checkingif .Values.some.value
in go template. Can someone help clarify this for me, or point to the relevant part of the docs? I seem to not be able to find this info.Thanks!
The text was updated successfully, but these errors were encountered: