-
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
Add an option in kustomize lib to suppress the deprecation warnings. #5452
Comments
I think it's fine to add the knob for suppressing warnings to kustomize as a library. I don't think we should add this knob to the kustomize binary, but folks who are integrating kustomize as a library into their own tool may have reasons to suppress these, particularly if the use of kustomize is an implementation detail that they might not want to expose to users. /triage accepted |
@natasha41575: GuidelinesPlease ensure that the issue body includes answers to the following questions:
For more details on the requirements of such an issue, please see here and ensure that they are met. If this request no longer meets these requirements, the label can be removed 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. |
I implemented a code snippet to try to reproduce the warning traces, however this code does not prints any warning:
@natasha41575 Is this the way to import kustomize as a lib? I'm interested on fix this issue Thanks a lot! |
/assign |
I reviewed again the code, and perhaps these flags should be suppressed with a knob when used as lib:
Do you mean these warnings? |
It's emiited in https://github.com/kubernetes-sigs/kustomize/blob/master/api/internal/target/kusttarget.go#L70 and directly to stderr. Ideally it should take a logger (like slog.Logger) and the caller could pass a caller here. |
Ok, I'm going to implement that solution |
This issue has been implemented in this PR: |
Eschewed features
What would you like to have added?
A knob or loger option to suppress the warinning emitted by kustomize lib (not the binary).
Why is this needed?
Currently our binary directly calls kustomize.Build() and each call will write deprecation warning to stderr and our binary calls multiple times of Build(). It looks spamming and probably a bit ominous to our end user.
Can you accomplish the motivating task without this feature, and if so, how?
No, it's hard coded to stderr.
What other solutions have you considered?
The alternative is the deprecation of var but it would take sometime to finish on our side as it's not a full feature parity to repalcements. (We finished the jsonPatch and base to resources pretty quickly.)
Anything else we should know?
No response
Feature ownership
The text was updated successfully, but these errors were encountered: