Fix bugsink.secret.create helper always evaluating to true#11
Merged
vanschelven merged 1 commit intoJun 26, 2026
Merged
Conversation
The helper used `ternary true false (...)`, which caused `include` to always return a non-empty string ("true" or "false"). Since `include` always returns a string in Helm, and any non-empty string is truthy in an `if` block, the condition `{{- if (include "bugsink.secret.create" .) }}` always rendered the Secret and its envFrom secretRef, even when all sensitive values were sourced from existing Secrets.
Replace `ternary` with an `if`/`end` block that outputs "true" when the Secret should be created and nothing (empty string) otherwise. Also simplify `(not (not .Values.extraEnv.secrets))` to `.Values.extraEnv.secrets`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi,
while deploying Bugsink in a Kubernetes cluster with strict policies that disallow Secret creation by default, I noticed that the chart always generates a Secret, even when all sensitive values are provided from existing Secrets. In most setups this is likely a cosmetic issue, but in my case it caused the deployment to fail.
The
bugsink.secret.createhelper intemplates/_helpers.tplusedternary true false (...)to signal whether the chart-managed Secret should be created. The problem is thatincludein Helm always returns a string, so both outcomes (booleantrueand booleanfalse) become the strings"true"and"false"respectively. Since any non-empty string is truthy in a Helmifblock, the condition{{- if (include "bugsink.secret.create" .) }}always evaluated to true, unconditionally rendering the Secret and the correspondingenvFrom.secretRef.The fix is to replace
ternarywith anif/endblock that outputs"true"when the Secret should be created and nothing (empty string) otherwise. An empty string is falsy in Helm, which gives the helper the correct semantics. As a minor cleanup, the double negation(not (not .Values.extraEnv.secrets))is simplified to.Values.extraEnv.secrets.To validate the fix, use
helm template. With all existing Secret references configured, no chart-managed Secret orenvFrom.secretRefshould appear in the output: