-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Extract k8s package out of cilium-cli into pkg/cli/k8s #35482
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
Extract k8s package out of cilium-cli into pkg/cli/k8s #35482
Conversation
62c396c
to
cd078b9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feels pretty reasonable. I don't have a strong opinion on where to put the package, but other maintainers might.
One suggestion of where to put the common library might be under |
That's fair. My first inclination was to put it under Any suggestion on a path/package rename ? |
yeah that would be a bit redundant. One thing I'm wondering is the code in this library is that this code isn't supposed to be a general k8s client library used by the agent daemon, but rather is more specific to things like cilium/hubble cli. Maybe k8s is just not a good package name for this anymore following the cli being moved to cilium/cilium? Anyway I don't feel that strongly about this, so I'll approve for sig-k8s. Maybe one of the other reviewers will have some thoughts. |
I agree that this package is more a high-level k8s-related helper client and therefore If someone else can propose a better alternative, I'd be happy to make the change. Otherwise we could wing it for now and revisit later if desired. |
cd078b9
to
1da56e9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems reasonable. One alternative name could be pkg/cli
(for packages used by the CLIs) since pkg/common
seems a bit overly generic
I like it. Let me update the PR to reflect the change to use: |
Signed-off-by: Alexandre Barone <abalexandrebarone@gmail.com>
1da56e9
to
900b35a
Compare
I'm not completely convinced yet. The cilium-cli client still is pretty well coupled to cilium-cli --
Plus it's all a bit heavyweight. If the goal is a functional port-forwarding implementation, then let's extract that, and have it take a k8s.ClientSet instead. |
I think that's fair @squeed. In the following branch I moved the port-forwarding logic that already exists on the client into a new Let me know what you think. If this is more inline with what you had in mind, and others agree, I can move on into rebasing the other PR and closing this one. Thanks for the review! |
Closing in favour of introducing a new PortForwarder type that takes in a Kubernetes clientset. |
This will allow us to re-use the same high-level k8s client in Hubble and replace the current kubectl-based port-forwarding commands with a native implementation (CFP #34935, discussed in #35353, used in #35483).
I chose an arbitrary location but feel free to propose a different one and/or a package rename.
EDIT: after discussion, we landed on
pkg/cli/k8s
as a good compromise that avoids a package rename while making it clear it is meant to be used by CLIs.