Remove k8s.io/kubernetes from kubectl library import path#4756
Draft
avalcepina wants to merge 1 commit into
Draft
Remove k8s.io/kubernetes from kubectl library import path#4756avalcepina wants to merge 1 commit into
avalcepina wants to merge 1 commit into
Conversation
Downstream projects that import pkg/kubectl-argo-rollouts/cmd/* (promote, abort, restart, retry) previously pulled in k8s.io/kubernetes transitively via utils/replicaset. That caused govulncheck to report GO-2025-3547 and GO-2025-3521 even though those findings are not exploitable in client-side library usage. Inline the small controller helpers (ComputeHash, ReplicaSetsByCreationTimestamp, FilterActiveReplicaSets) and PodTemplate defaulting in utils/k8sutil so the kubectl command packages no longer depend on the kubernetes monorepo. The rollouts controller continues to use k8s.io/kubernetes directly. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Contributor
Published E2E Test Results 4 files 4 suites 3h 48m 8s ⏱️ For more details on these failures, see this check. Results for commit dc3eceb. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4756 +/- ##
==========================================
- Coverage 85.01% 85.00% -0.02%
==========================================
Files 164 166 +2
Lines 18989 19036 +47
==========================================
+ Hits 16144 16182 +38
- Misses 1995 1999 +4
- Partials 850 855 +5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
Published Unit Test Results2 472 tests 2 472 ✅ 3m 21s ⏱️ Results for commit dc3eceb. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Downstream projects that import
pkg/kubectl-argo-rollouts/cmd/*(e.g. promote, abort, restart, retry) previously pulled ink8s.io/kubernetestransitively viautils/replicaset. That causesgovulncheckto report GO-2025-3547 and GO-2025-3521 on the kubernetes monorepo even for client-side library usage where those kube-apiserver findings are not exploitable.This change inlines the small helpers those library packages need into a new
utils/k8sutilpackage:ComputeHash(legacy hash compatibility with upstream controller)ReplicaSetsByCreationTimestampFilterActiveReplicaSetsPodTemplateEqualIgnoreHashAfter this change, the kubectl command packages no longer depend on
k8s.io/kubernetes. The rollouts controller continues to import the kubernetes monorepo directly (unchanged).Motivation
circleci/k8s-release-agentimports the kubectl-argo-rollouts command packages as a Go library. After upgrading to argo-rollouts v1.9.0 (PR #791),govulncheck ./...still reports two unfixablek8s.io/kubernetesfindings (GO-2025-3547, GO-2025-3521). Those advisories list all versions as affected with no upstream fix; removing the transitive import path is the practical remediation for library consumers.Verification
go test ./utils/k8sutil/... ./utils/replicaset/...go list -deps ./pkg/kubectl-argo-rollouts/cmd/{promote,abort,restart,retry,undo}→ nok8s.io/kubernetespackagesgovulncheckon the kubectl library packages → GO-2025-3547 / GO-2025-3521 no longer reportedTest plan
utils/k8sutilandutils/replicaset