Open caermeglaeddyv opened 3 years ago
Interesting, have you also looked into https://helm.sh/docs/chart_template_guide/values_files/#deleting-a-default-key ?
Doing something like helm upgrade [..] --set livenessProbe=null
?
Yes, sure, I knew about that, forgot because not using often. I just think that it's more comfortable for users just to use empty map for that probe. And what about setting completely different values for probes? In your case, if I do that, my values will be added to existing ones. I need also to override them via "--set ..." and then after that I need to use my values file via "-f ..."? What if I use declarative only way to manage helm releases, for example some GitOps tool like GitOps Toolkit (Flux v2) ?
Yep, not disagreeing here! I am no helm chart guru so will let anyone contribute to making this config more flexible :grimacing: .
I think maybe this is related to using "with" instruction of Helm somehow, maybe you can try to replace it with "if" which checks non-emptiness of that variable and then just "toYaml" like the following:
with
is shorthand for if
that also makes .
refer to the object within the block. What’s happening in this case is that Helm is merging the readinessProbe
or livenessProbe
in the defaults with the provided values (rather than replacing the defaults) before they ever reach the template. Maybe the solution is to move the defaults into the template, like this:
{{- with .Values.livenessProbe }}
livenessProbe: {{ toYaml . | nindent 16 }}
{{- else }}
livenessProbe:
httpGet:
path: /health/live
port: 8080
{{- end }}
The only caveat is that I believe it would no longer be possible to turn off the health checks, but that seems unimportant.
my values:
when I create helm templates using that values here's what I get:
When I try to use some custom health check there, it does not replace default one with httpGet, just added to it. I think maybe this is related to using "with" instruction of Helm somehow, maybe you can try to replace it with "if" which checks non-emptiness of that variable and then just "toYaml" like the following: