-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Emit a warning when env loading bug is being relied on #4730
Conversation
@KnVerey: GitHub didn't allow me to request PR reviews from the following users: annasong20. Note that only kubernetes-sigs members and repo collaborators can review this PR, and authors cannot review their own PRs. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
✅ Deploy Preview for kubernetes-sigs-kustomize canceled.
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: KnVerey The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/lgtm I can retag after you fix the lint error |
/lgtm |
BTW, Consider copying that style. |
I don't know the difference between |
This PR does not change behaviour; it simply emits a warning. The provided samples build fine for me with the latest release of Kustomize, and do not hit the warning case in this PR. If you're able to reproduce, please open a new issue and include the Kustomize version and error message. |
This patch changes the kustomize.sh logic, due to an evolution in the kustomize CLI [0] where envvars will not be loaded automatically anymore. Also this adapats simplifies the logic using a single overridden configmap [0] kubernetes-sigs/kustomize#4730 Signed-off-by: Nathan Skrzypczak <[email protected]>
This patch changes the kustomize.sh logic, due to an evolution in the kustomize CLI [0] where envvars will not be loaded automatically anymore. Also this adapats simplifies the logic using a single overridden configmap [0] kubernetes-sigs/kustomize#4730 Signed-off-by: Nathan Skrzypczak <[email protected]>
Problem
It recently came to our attention that the
configMapGenerator
has a bug where it will load values from the environment when a line in an env file has a key but no value. This bug dates back to the origins of Kustomize, when some of the original code was copied out of kubectl, and this undesirable behaviour (for kustomize, not kubectl) went unnoticed in the adaptation.This behaviour is a clear violation of one of Kustomize's core principles, as documented in our Eschewed Features list:
Very unfortunately, someone not only discovered this bug, but made a PR to document it as a feature on kubernetes.io: kubernetes/website#30348. Unfortunately no Kustomize maintainers were tagged on the PR, and it has been live since January 2022. 😞
As stated in Kustomize documentation screenshot above, any need for environment reading should be handled as part of a pre-build workflow. We can consider adding a
kustomize edit
subcommand for this specifically if there is demand from those currently relying on the bug. For example, it could look likekustomize edit add configmap my-configmap --from-env-file=env/path.env --from-env=ONE,TWO
.Proposal
I don't think there's a nice way to unit test the printing to sdterr like this, barring making invasive changes to the kv loader method signatures (lmk if you have an idea for something nice). Here are some manual tests:
/cc @natasha41575 @annasong20