Skip to content

Conversation

tklauser
Copy link
Member

@tklauser tklauser commented Mar 7, 2025

The k8s package currently is a catch-all package for all kind of k8s-related functionality. By itself it already has a prettly large list of (transitive) dependencies, among them packages specific to the datapath or the underlying operating system. This becomes problematic once cross-built tools such as Cilium CLI or Hubble CLI start depending on pkg/k8s as is the case since the portforward functionality was added in commit ae0d2f3 ("cilium-cli: extract portforward logic into new PortForwarder type") and they transitively start depending on the platform-specific pacakges such as pkg/datapath.

This commit fixes that by moving the portforward functionality to pkg/k8s/portforward which is easy because it doesn't depend on any other code in pkg/k8s. This should help to break these transitive dependencies.

Towards #37598

The k8s package currently is a catch-all package for all kind of
k8s-related functionality. By itself it already has a prettly large list
of (transitive) dependencies, among them packages specific to the
datapath or the underlying operating system. This becomes problematic
once cross-built tools such as Cilium CLI or Hubble CLI start depending
on pkg/k8s as is the case since the portforward functionality was added
in commit ae0d2f3 ("cilium-cli: extract portforward logic into new
PortForwarder type") and they transitively start depending on the
platform-specific pacakges such as pkg/datapath.

This commit fixes that by moving the portforward functionality to
pkg/k8s/portforward which is easy because it doesn't depend on any other
code in pkg/k8s. This should help to break these transitive
dependencies.

Towards #37598

Signed-off-by: Tobias Klauser <tobias@cilium.io>
@tklauser tklauser added the release-note/misc This PR makes changes that have no direct user impact. label Mar 7, 2025
@tklauser tklauser requested review from a team as code owners March 7, 2025 10:41
@tklauser tklauser requested review from tommyp1ckles and kaworu March 7, 2025 10:41
@github-actions github-actions bot added hubble-cli PRs or GitHub issues related with hubble-cli cilium-cli This PR contains changes related with cilium-cli labels Mar 7, 2025
@tklauser
Copy link
Member Author

tklauser commented Mar 7, 2025

/test

@aanm aanm enabled auto-merge March 7, 2025 11:00
Copy link
Contributor

@michi-covalent michi-covalent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

neat

@aanm aanm added this pull request to the merge queue Mar 7, 2025
Merged via the queue into main with commit 5191a24 Mar 7, 2025
299 checks passed
@aanm aanm deleted the pr/tklauser/move-k8s-portforward branch March 7, 2025 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cilium-cli This PR contains changes related with cilium-cli hubble-cli PRs or GitHub issues related with hubble-cli release-note/misc This PR makes changes that have no direct user impact.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants