-
Notifications
You must be signed in to change notification settings - Fork 899
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
WarningHandler cannot be configured when applying #1586
Comments
Thanks for raising this issue. Is it possible to give the link of the WarningHandler to clarify which one we are talking about?. Furthermore, how did you customize it?. |
Hi @ardaguclu, thank you for your reply and sorry I did not make myself clear. The WarningHandler I am referring is in the client-go. And if it is not set, the default WarningHandler will be used which logs the warnings. The customize I mean is to set NewWarningWriter() which outputs warnings to the provided writer. Hope it makes sense. |
Thanks for raising the issue. |
@wangli1030 are you thinking something like this? Regardless, it seems wrong that |
Hi @ah8ad3 and @brianpursley, thank you for your reply and I am sorry if I did not make myself clear. In rest.config, |
I think that this issue should be accepted but I'm having some trouble wrapping my head around it. I think a PR (or even just a branch I can diff against master with) demonstrating the desired outcome would help clarify this for me so we can decide to accept this or not, and what SIG this should belong to. At this point I think this might be API machinery and not CLI. |
Hi @mpuckett159, thank you for looking at it. To be honest, currently I do not know the root cause and how to fix it. The simple way to describe this issue is that I believe this is the real place to apply the resources but it does not use the |
@wangli1030 I investigated this today deeply and I think, I've figured out what is happening. First of all, I'm not sure in what way are you consuming modules in k8s, are you using kubectl programmatically or are you directly relying on client-go's functionality. Why am I asking this because in order to set the The problem is If you are using kubectl functions, I believe that you can customize your specific warning handler by using this function https://github.com/kubernetes/kubernetes/blob/62d379fa5abd4f109b1f1dfe2112feff03c569b4/staging/src/k8s.io/kubectl/pkg/cmd/cmd.go#L326 |
Hi @ardaguclu really appreciate your time for digging into this. In ArgoCD, I believe it does not directly use client-go or kubctl as CLI, but it relies on kubectl ApplyOptions as dependency package to apply the resources. I have tried to use |
I don't think we can offer such granularity per object. But instead of modifying the global default warning handler, I think you can inject your custom warning handler with https://github.com/kubernetes/kubernetes/blob/ebaf49dbd709a94e0c44aa75b4c32b50898a05e3/staging/src/k8s.io/client-go/rest/config.go#L128. Once you set your custom warning handler in |
Hi @ardaguclu, could you show me where I could inject |
ah, now we are on the same page :). Because apply command does not use RestClient to set custom warning handler, instead it uses /triage accepted |
Thanks again @ardaguclu for looking at it. Hope it could be supported soon. Also please let me know if there is anything I could work on. I am more than happy to contribute to it. |
Should we track this in another repo? |
/assign |
What happened:
In Argo project, kubectl client is used to apply the resources and WarningHandler need to be configured in order to expose warning when applying the resources. However, I think WarningHandler cannot be configured when using kubctl client.
What you expected to happen:
WarningHandler should be configured when using kubectl client.
How to reproduce it (as minimally and precisely as possible):
Anything else we need to know?:
Customized WarningHandler will be configured in ApplyOptions and
in this line, it generate the objects but it does not contains the WarningHandler in the ApplyOptions. And the client in generated object is used to communicate with API server in this line, this line and this line. So it means, whatever the user configure the WarningHandler in ApplyOptions, it is not used.
Environment:
kubectl version
):cat /etc/os-release
):The text was updated successfully, but these errors were encountered: