Skip to content

REPLACE-WITH-JIRA-KEY: Bump Kubernetes dependencies to v1.36.2#741

Draft
dfarrell07 wants to merge 10 commits into
openshift:masterfrom
dfarrell07:bump1.36-20260719212714
Draft

REPLACE-WITH-JIRA-KEY: Bump Kubernetes dependencies to v1.36.2#741
dfarrell07 wants to merge 10 commits into
openshift:masterfrom
dfarrell07:bump1.36-20260719212714

Conversation

@dfarrell07

@dfarrell07 dfarrell07 commented Jul 19, 2026

Copy link
Copy Markdown

Summary

  • Bump all k8s.io/* dependencies from v0.35.2 to v0.36.2
  • Bump Go version from 1.25.0 to 1.26.0
  • Bump controller-runtime from v0.23.3 to v0.24.1
  • Bump golangci-lint from v1.54.2 to v2.12.0

What changed

Category Details
Dependencies k8s.io/* v0.35→v0.36, controller-runtime v0.23→v0.24
Go version 1.25.0 → 1.26.0 (Dockerfiles, CI configs, go.mod)
Import migrations klog v1 → v2 (2 files), ioutil → os (2 files)
Duplicate imports Consolidated in 4 files (ebpfsyncer, ebpf loader, k8sreporter, namespaces)
Lint golangci-lint v1→v2, added .golangci.yml, fixed ST1005/SA4010/S1039
Format fix IntOrString.String() for %q verb (Go 1.26 vet strictness)

Commits

0bc48022 webhook: handle tls.Conn.Close return value
4b71874c lint: fix SA4010 unused append and S1039 unnecessary Sprintf
f672109b lint: fix deprecated ioutil, duplicate imports, add golangci config
3f52f276 lint: lowercase error strings for ST1005 compliance
10387274 vendor: sync vendor after klog v1 removal
a490dfb1 Update version references and lint for k8s 1.36
74f4e1b4 Migrate klog v1 to v2 import path
10c41e22 utils: fix IntOrString format verb for k8s 1.36
4ede7003 Update version references for k8s 1.36
2bd94255 Rebase k8s-rebase-1.36.2 to k8s 1.36

First 2 commits are mechanical (dep bump + version refs). The rest are
fixes surfaced by the bumped dependencies and linter.

Verification

  • go build ./... passes (Go 1.26)
  • go vet ./... passes
  • golangci-lint v2.12.0 passes
  • Unit tests pass (6/8 packages; controllers and webhook require envtest binaries)
  • Independent antagonistic review: APPROVED

All commits carry Assisted-by: Claude Code trailers.

Summary by CodeRabbit

  • Build & Compatibility

    • Updated the Go toolchain and container build environments.
    • Refreshed Kubernetes, OpenShift, networking, monitoring, and supporting libraries.
  • Developer Experience

    • Upgraded linting to the latest configuration and tooling.
    • Local linting now works without requiring a container.
    • Updated Kubernetes test assets for newer environment testing.
  • Reliability

    • Improved firewall rule loading, cleanup, error handling, and manifest processing.
    • Modernized supporting integrations and standardized diagnostic messages.

go get k8s.io/api@v0.36.2
go get k8s.io/apiextensions-apiserver@v0.36.2
go get k8s.io/apimachinery@v0.36.2
go get k8s.io/apiserver@v0.36.2
go get k8s.io/client-go@v0.36.2
go get k8s.io/component-base@v0.36.2
go get sigs.k8s.io/controller-runtime@v0.24.1
go get github.com/openshift/api
go get github.com/openshift/library-go
go get k8s.io/klog
go get k8s.io/klog/v2
go get k8s.io/kube-openapi
go get k8s.io/kubernetes
go get k8s.io/utils
go get sigs.k8s.io/apiserver-network-proxy/konnectivity-client
go get sigs.k8s.io/json
go get sigs.k8s.io/randfill
go get sigs.k8s.io/structured-merge-diff/v6
go get sigs.k8s.io/yaml
go mod tidy

Signed-off-by: Daniel Farrell <dfarrell@redhat.com>
Assisted-by: Claude Code <noreply@anthropic.com>
./Dockerfile
./Dockerfile.daemon
Makefile

Signed-off-by: Daniel Farrell <dfarrell@redhat.com>
Assisted-by: Claude Code <noreply@anthropic.com>
IntOrString changed in k8s 1.36 such that %q no longer works
directly on the struct. Use .String() to get the string
representation before formatting.

Signed-off-by: Daniel Farrell <dfarrell@redhat.com>
Assisted-by: Claude Code <noreply@anthropic.com>
Applied: migrate klog v1 imports to klog/v2
Signed-off-by: Daniel Farrell <dfarrell@redhat.com>
Assisted-by: Claude Code <noreply@anthropic.com>
Applied: bump golangci-lint version
Signed-off-by: Daniel Farrell <dfarrell@redhat.com>
Assisted-by: Claude Code <noreply@anthropic.com>
go mod tidy removed the stale k8s.io/klog v1 dependency
after the import migration to klog/v2. go mod vendor
removes the vendored klog v1 files.

Signed-off-by: Daniel Farrell <dfarrell@redhat.com>
Assisted-by: Claude Code <noreply@anthropic.com>
Signed-off-by: Daniel Farrell <dfarrell@redhat.com>
Assisted-by: Claude Code <noreply@anthropic.com>
- Replace io/ioutil with os.ReadFile and os.ReadDir (deprecated
  since Go 1.16)
- Remove duplicate package imports (ST1019) in ebpfsyncer,
  ebpf loader, k8sreporter, and namespaces packages
- Add .golangci.yml with errcheck exclusions for fmt.Fprintf,
  fmt.Fprintln, and Close methods commonly unchecked in tests
  and logging code

Signed-off-by: Daniel Farrell <dfarrell@redhat.com>
Assisted-by: Claude Code <noreply@anthropic.com>
Remove dead code building an unused interfaces slice and
replace unnecessary fmt.Sprintf with a string literal.
Update .golangci.yml to suppress pre-existing style checks
(ST1000 package comments, SA1019 deprecations) that existed
before this rebase.

Signed-off-by: Daniel Farrell <dfarrell@redhat.com>
Assisted-by: Claude Code <noreply@anthropic.com>
Explicitly discard the Close return value to satisfy errcheck.

Signed-off-by: Daniel Farrell <dfarrell@redhat.com>
Assisted-by: Claude Code <noreply@anthropic.com>
@openshift-ci

openshift-ci Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 19, 2026
@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown

Walkthrough

The pull request upgrades the project to Go 1.26, refreshes Kubernetes and related dependencies, migrates linting to golangci-lint v2, updates standard-library and Kubernetes APIs, and adjusts BPF manager controller behavior and error handling.

Changes

Toolchain modernization

Layer / File(s) Summary
Toolchain and lint configuration
.golangci.yml, Dockerfile*, Makefile, go.mod, hack/lint.sh
Build images and module metadata target Go 1.26; Kubernetes envtest and dependencies are refreshed; linting uses golangci-lint v2.12.0 with updated configuration and execution paths.
API and compatibility migrations
pkg/bpf-mgr/*, pkg/ebpf/*, pkg/ebpfsyncer/*, pkg/render/*, pkg/utils/*, pkg/webhook/*, test/e2e/*
Logging imports, Kubernetes type aliases, standard-library file APIs, error text, close handling, and namespace error checks are updated; related method signatures and tests are aligned.
BPF manager controller updates
controllers/ingressnodefirewall_controller.go
The BPF detach path no longer constructs an intermediate interface list, and the attachment error message uses a fixed string.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error, 1 warning)

Check name Status Explanation Resolution
Container-Privileges ❌ Error Dockerfile.daemon still ends in a root runtime image with no non-root USER or justification; this violates the container-privileges check. Add a non-root USER (or document why root is required) in Dockerfile.daemon, and keep K8s securityContext settings non-privileged.
Docstring Coverage ⚠️ Warning Docstring coverage is 71.43% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (13 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the main change: bumping Kubernetes dependencies to v1.36.2.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed Touched Ginkgo titles in pkg/webhook/webhook_suite_test.go are static strings; no generated, timestamped, or otherwise dynamic names were added.
Test Structure And Quality ✅ Passed The only Ginkgo change is closing the TLS conn in BeforeSuite; no new multi-behavior tests, cleanup gaps, or timeout regressions were introduced.
Microshift Test Compatibility ✅ Passed No new Ginkgo e2e tests were added in test/e2e; the diff only changes helper code, so MicroShift-specific API compatibility isn't implicated.
Single Node Openshift (Sno) Test Compatibility ✅ Passed No new Ginkgo It/Describe/Context/When blocks were added; the only e2e changes are helper-only edits in namespaces.go and reporter.go.
Topology-Aware Scheduling Compatibility ✅ Passed No modified manifest or workload scheduling logic was added; the PR is tooling, dependency, and controller/test cleanup only.
Ote Binary Stdout Contract ✅ Passed No stdout writes were added in main/init/BeforeSuite/AfterSuite; the only fmt.Println calls are in reporter helpers, not process-level setup.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed No new Ginkgo test declarations were added; the only test-file change is closing the TLS conn error, so the IPv6/disconnected-network check is not applicable.
No-Weak-Crypto ✅ Passed No MD5/SHA1/DES/RC4/ECB or custom crypto usage found in the modified files; the only crypto import is crypto/tls for webhook readiness.
No-Sensitive-Data-In-Logs ✅ Passed The changed logs only emit interface/rule metadata and errors; no passwords, tokens, PII, session IDs, hostnames, or customer data were found.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@openshift-ci

openshift-ci Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: dfarrell07
Once this PR has been reviewed and has the lgtm label, please assign martinkennelly for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (2)
test/e2e/namespaces/namespaces.go (1)

68-68: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Wrap the error using %w.

Consider using %w instead of %v to properly preserve the original error context for wrapping and unwrapping upstream.

♻️ Proposed refactor
-		return fmt.Errorf("failed to delete pods %v", err)
+		return fmt.Errorf("failed to delete pods: %w", err)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/e2e/namespaces/namespaces.go` at line 68, Update the error construction
in the pod-deletion flow to use the wrapping verb %w instead of %v, preserving
the underlying error for upstream unwrapping while retaining the existing
contextual message.
test/e2e/k8sreporter/reporter.go (1)

145-147: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low value

Pre-allocate the slice to avoid multiple allocations.

Since the total number of containers is known beforehand, you can pre-allocate the slice with the exact capacity. This avoids potential memory reallocations during append.

♻️ Proposed refactor
-		containersToLog := make([]corev1.Container, 0)
+		containersToLog := make([]corev1.Container, 0, len(pod.Spec.Containers)+len(pod.Spec.InitContainers))
		containersToLog = append(containersToLog, pod.Spec.Containers...)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/e2e/k8sreporter/reporter.go` around lines 145 - 147, Update the
containersToLog initialization in the reporter flow to pre-allocate capacity for
len(pod.Spec.Containers)+len(pod.Spec.InitContainers), while retaining the
existing append operations and resulting container order.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@Dockerfile`:
- Line 2: Pin the golang:1.26 base image by appending its verified sha256 digest
in Dockerfile at lines 2-2 and Dockerfile.daemon at lines 1-1; apply the same
digest-pinned reference at both sites and preserve the existing builder
configuration.

In `@Dockerfile.daemon`:
- Line 1: Add a non-root USER directive to the final stage of the Dockerfile,
using a valid non-root UID and placing it after the final-stage setup so the
container does not run as root by default. Leave the builder stage unchanged.

In `@pkg/webhook/webhook_suite_test.go`:
- Line 148: Update the cleanup logic in the Eventually block around conn.Close
so its error return is handled rather than discarded. Return the error from the
callback when conn.Close fails, while preserving the existing successful
teardown behavior.

---

Nitpick comments:
In `@test/e2e/k8sreporter/reporter.go`:
- Around line 145-147: Update the containersToLog initialization in the reporter
flow to pre-allocate capacity for
len(pod.Spec.Containers)+len(pod.Spec.InitContainers), while retaining the
existing append operations and resulting container order.

In `@test/e2e/namespaces/namespaces.go`:
- Line 68: Update the error construction in the pod-deletion flow to use the
wrapping verb %w instead of %v, preserving the underlying error for upstream
unwrapping while retaining the existing contextual message.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

Comment thread Dockerfile
@@ -1,5 +1,5 @@
# Build the manager binary
FROM golang:1.25 as builder
FROM golang:1.26 as builder

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win

Pin non-Red Hat base images by digest.

Both files use the floating tag golang:1.26, which violates the container security path instructions. Non-RH images must be pinned by digest to ensure reproducible and secure builds.

  • Dockerfile#L2-L2: append the @sha256:... digest to the golang:1.26 base image.
  • Dockerfile.daemon#L1-L1: append the @sha256:... digest to the golang:1.26 base image.
📍 Affects 2 files
  • Dockerfile#L2-L2 (this comment)
  • Dockerfile.daemon#L1-L1
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Dockerfile` at line 2, Pin the golang:1.26 base image by appending its
verified sha256 digest in Dockerfile at lines 2-2 and Dockerfile.daemon at lines
1-1; apply the same digest-pinned reference at both sites and preserve the
existing builder configuration.

Source: Path instructions

Comment thread Dockerfile.daemon
@@ -1,4 +1,4 @@
FROM golang:1.25 AS builder
FROM golang:1.26 AS builder

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Specify a non-root user for the final image.

The final container image runs as root by default, which is flagged by the static analysis tools. As per the container security path instructions, never run as root and ensure the image defines a non-root USER.

Although the FROM declaration for the final stage isn't directly modified in this PR, please ensure a USER <uid> directive is added to the final stage of this multi-stage build to comply with the security guidelines.

🧰 Tools
🪛 Trivy (0.72.0)

[error] 1-1: Image user should not be 'root'

Specify at least 1 USER command in Dockerfile with non-root user as argument

Rule: DS-0002

Learn more

(IaC/Dockerfile)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Dockerfile.daemon` at line 1, Add a non-root USER directive to the final
stage of the Dockerfile, using a valid non-root UID and placing it after the
final-stage setup so the container does not run as root by default. Leave the
builder stage unchanged.

Sources: Path instructions, Linters/SAST tools

return err
}
conn.Close()
_ = conn.Close()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Do not ignore error returns.

As per path instructions, never ignore error returns. Even though this is within an Eventually block, explicitly ignoring the conn.Close() error masks potential teardown failures. Please handle the error appropriately by returning it.

🛠️ Proposed fix
-		_ = conn.Close()
-		return nil
+		return conn.Close()
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
_ = conn.Close()
return conn.Close()
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/webhook/webhook_suite_test.go` at line 148, Update the cleanup logic in
the Eventually block around conn.Close so its error return is handled rather
than discarded. Return the error from the callback when conn.Close fails, while
preserving the existing successful teardown behavior.

Source: Path instructions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant