Skip to content

Zenithar/chaos controller/kubernetes 1 35 support#1047

Draft
Zenithar wants to merge 10 commits intomainfrom
zenithar/chaos-controller/kubernetes_1_35_support
Draft

Zenithar/chaos controller/kubernetes 1 35 support#1047
Zenithar wants to merge 10 commits intomainfrom
zenithar/chaos-controller/kubernetes_1_35_support

Conversation

@Zenithar
Copy link
Contributor

[Kubernetes] Update to Kubernetes 1.35 and controller-runtime v0.23.1

Summary

This PR upgrades the chaos-controller to support Kubernetes 1.35 by bumping all core k8s.io/* dependencies to v0.35.0 and sigs.k8s.io/controller-runtime to v0.23.1. The upgrade required adopting the kubebuilder v4 project layout (moving controllers to internal/controller/, entrypoint to cmd/main.go) and migrating webhooks to the new typed generics API (admission.Defaulter[T] / admission.Validator[T]). CI workflows were hardened by pinning all GitHub Actions to commit SHAs, and the generated protobuf code was regenerated with modern tooling.

Changes

Domain Logic / Webhooks:

  • Migrated Disruption webhook from webhook.CustomDefaulter / webhook.CustomValidator to typed admission.Defaulter[*Disruption] / admission.Validator[*Disruption] -- eliminates runtime type assertions
  • Migrated DisruptionCron webhook with the same typed generics pattern
  • Updated ctrl.NewWebhookManagedBy() call signature: object passed as argument, .For() removed
  • Replaced deprecated k8s.io/api/authentication/v1beta1.UserInfo with authV1.UserInfo

Project Layout (kubebuilder v4):

  • Renamed package controllers -> internal/controller (all source + test files)
  • Moved entrypoint main.go -> cmd/main.go
  • Updated PROJECT file layout from go.kubebuilder.io/v3 to go.kubebuilder.io/v4
  • Updated .goreleaser.yml to set main: ./cmd
  • Updated bin/manager/Dockerfile build path to ./cmd
  • Updated mockery config to reference internal/controller

Dependencies (go.mod):

  • k8s.io/api, k8s.io/apimachinery, k8s.io/client-go, k8s.io/cli-runtime: v0.34.3 -> v0.35.0
  • k8s.io/apiextensions-apiserver: v0.33.0 -> v0.35.0
  • sigs.k8s.io/controller-runtime: v0.21.0 -> v0.23.1
  • controller-gen: v0.19.0 -> v0.20.1 (CRD manifests regenerated)
  • Transitive bumps: prometheus, otelhttp, json-patch, structured-merge-diff, etc.

Mocks:

  • Added Apply method mock to K8SClientMock (new in client.Client interface)
  • Added GetEventRecorder and GetConverterRegistry method mocks to ManagerMock (new in manager.Manager interface)

Generated Protobuf Code:

  • Regenerated chaosdogfood and disruptionlistener protobuf/gRPC stubs with protoc-gen-go v1.36.11 / protoc v6.33.4 / protoc-gen-go-grpc v1.6.1
  • Migrated to protogen:"open.v1" struct layout, removed legacy protoimpl.UnsafeEnabled guards
  • gRPC stubs now use SupportPackageIsVersion9, grpc.StaticMethod(), and exported FullMethodName constants
  • UnimplementedServer types now embed by value with testEmbeddedByValue() safety check

CI/CD Hardening (GitHub Actions pinned to SHA):

  • actions/checkout -> @34e114876b0b11c390a56381ad16ebd13914f8d5 (v4.3.1)
  • actions/setup-go -> @40f1582b2485089dde7abd97c1529aa768e1baff (v5.6.0)
  • actions/upload-artifact -> @ea165f8d65b6e75b540449e92b4886f43607fa02 (v4.6.2)
  • actions/download-artifact -> @d3f86a106a0bac45b974a628896c90dbdf5c8093 (v4.3.0)
  • goreleaser/goreleaser-action -> @e435ccd777264be153ace6237001ef4d979d3a7a (v6.4.0)
  • azure/setup-helm -> @1a275c3b69536ee54be43f2070a358922e12c8d4 (v4.3.1)
  • DataDog/dd-sts-action@main replaced by DataDog/dd-octo-sts-action@acaa02eee7e3bb0839e4272dacb37b8f3b58ba80 (v1.0.3)

CI/CD Tooling Updates:

  • Release workflow: replaced git fetch --prune --unshallow with fetch-depth: 0, use go-version-file
  • Helm v3.6.3 -> v3.19.0
  • protoc: 3.17.3 -> 29.6, protoc-gen-go: v1.27.1 -> v1.36.11, protoc-gen-go-grpc: v1.1.0 -> v1.6.1
  • yamlfmt: v0.9.0 -> v0.21.0
  • cert-manager: v1.9.1 -> v1.19.3
  • longhorn: v1.4.0 -> v1.11.0

Lint/Format/Licenses:

  • Import ordering fixed in cmd/main.go
  • LICENSE-3rdparty.csv updated to reflect new/changed transitive dependencies (storagemigration v1alpha1 -> v1beta1, new entries for events, watchlist, version, kyaml, conversion/metrics, etc.)

Infrastructure (Lima/k3s):

  • k3s version in lima.yaml: v1.26.3+k3s1 -> v1.35.1+k3s1
  • Kubernetes target version in Makefile: 1.28 -> 1.35

Testing

Unit Tests:

  • All controller tests relocated to internal/controller/ with package rename
  • Relative file paths in test fixtures adjusted

E2E Tests:

  • Makefile e2e target updated to reference new package path
  • k3s provisioning updated to Kubernetes 1.35 for integration environment

Breaking Changes

No breaking changes -- this is a dependency and internal layout update. The CRD API surface (v1beta1) is unchanged. All external interfaces (CRDs, webhook paths, CLI flags) remain the same.

Dependencies

  • Updated (direct):
    • k8s.io/api v0.34.3 -> v0.35.0
    • k8s.io/apimachinery v0.34.3 -> v0.35.0
    • k8s.io/client-go v0.34.3 -> v0.35.0
    • k8s.io/cli-runtime v0.33.3 -> v0.35.0
    • sigs.k8s.io/controller-runtime v0.21.0 -> v0.23.1
  • Updated (indirect/transitive): prometheus stack, otelhttp, json-patch, structured-merge-diff, yaml, kube-openapi, and others (see go.sum diff)

Checklist

  • Code follows Go idioms and project conventions
  • Webhook interfaces migrated to typed generics (no more runtime.Object assertions)
  • Generated CRD manifests regenerated with controller-gen v0.20.1
  • Generated protobuf/gRPC stubs regenerated with modern tooling
  • Mocks updated to satisfy new interface methods
  • CI workflows hardened with SHA-pinned GitHub Actions
  • Third-party license file updated
  • No sensitive information in logs
  • kubebuilder v4 layout adopted (internal/controller/, cmd/main.go)

@Zenithar Zenithar self-assigned this Feb 27, 2026
Zenithar and others added 2 commits February 27, 2026 16:05
Package was declared as `controllers` instead of `controller`, causing
a build failure across all CI jobs (fmt, lint, test, docker-build,
codegen validation).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@datadog-official
Copy link

datadog-official bot commented Feb 27, 2026

✅ Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

🎯 Code Coverage (details)
Patch Coverage: 31.58%
Overall Coverage: 39.88% (+0.08%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: cb5c492 | Docs | Datadog PR Page | Was this helpful? React with 👍/👎 or give us feedback!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant