From c54567c6ff40b5289c192fdb3542ab397891a2ce Mon Sep 17 00:00:00 2001 From: Mytreya Kasturi Date: Fri, 14 Aug 2026 12:04:00 +0530 Subject: [PATCH 1/4] Bump controller-runtime to v0.24.1 and k8s.io/* to v0.36.2 Bumps sigs.k8s.io/controller-runtime v0.21.0 -> v0.24.1 and k8s.io/{api,apiextensions-apiserver,apimachinery,cli-runtime,client-go,kubectl} v0.33.9 -> v0.36.2, plus transitive dependency updates picked up by `go mod tidy`. This is a routine dependency bump with no feature content. It's a prerequisite for downstream distributions that want to adopt github.com/openshift/controller-runtime-common/pkg/tls (which requires controller-runtime >= v0.22.5) or similar packages built against newer controller-runtime/k8s.io APIs. Also fixes fallout the bump surfaces: - internal/olm/client/client_test.go's errClient test double needs a new Apply method to satisfy controller-runtime's client.Client interface (client.Writer gained Apply in this version range). - internal/helm/controller/controller.go:65 and internal/olm/operator/uninstall.go:198 are pre-existing call sites that `make test-sanity`'s golangci-lint now flags as SA1019 (deprecated), because the bump changes what staticcheck can see as deprecated: controller-runtime's GetEventRecorderFor is newly deprecated in this version range (it wasn't in v0.21.0), and k8s.io/kubectl's slice.ContainsString was already deprecated in v0.33.9 but its doc comment didn't follow the convention staticcheck requires until v0.36.2 reformatted it. slice.ContainsString is swapped for the stdlib slices.Contains (identical behavior, no modifier func was used); GetEventRecorderFor is left as-is with a //nolint:staticcheck (matching controller-runtime's own internal usage) since migrating HelmOperatorReconciler off the old events API is a larger, unrelated change. Co-authored-by: Cursor --- go.mod | 54 ++++++------ go.sum | 113 ++++++++++++------------- internal/helm/controller/controller.go | 8 +- internal/olm/client/client_test.go | 4 + internal/olm/operator/uninstall.go | 4 +- 5 files changed, 92 insertions(+), 91 deletions(-) diff --git a/go.mod b/go.mod index c0d44db79d6..f0eef537f92 100644 --- a/go.mod +++ b/go.mod @@ -32,14 +32,14 @@ require ( golang.org/x/tools v0.47.0 gomodules.xyz/jsonpatch/v3 v3.0.1 helm.sh/helm/v3 v3.18.6 - k8s.io/api v0.33.9 - k8s.io/apiextensions-apiserver v0.33.9 - k8s.io/apimachinery v0.33.9 - k8s.io/cli-runtime v0.33.9 - k8s.io/client-go v0.33.9 - k8s.io/kubectl v0.33.9 - k8s.io/utils v0.0.0-20251002143259-bc988d571ff4 - sigs.k8s.io/controller-runtime v0.21.0 + k8s.io/api v0.36.2 + k8s.io/apiextensions-apiserver v0.36.2 + k8s.io/apimachinery v0.36.2 + k8s.io/cli-runtime v0.36.2 + k8s.io/client-go v0.36.2 + k8s.io/kubectl v0.36.2 + k8s.io/utils v0.0.0-20260210185600-b8788abfbbc2 + sigs.k8s.io/controller-runtime v0.24.1 sigs.k8s.io/controller-tools v0.18.0 sigs.k8s.io/kubebuilder/v4 v4.6.0 sigs.k8s.io/yaml v1.6.0 @@ -81,7 +81,7 @@ require ( github.com/containerd/typeurl/v2 v2.2.3 // indirect github.com/containers/libtrust v0.0.0-20230121012942-c1716e8a8d01 // indirect github.com/containers/ocicrypt v1.2.1 // indirect - github.com/coreos/go-systemd/v22 v22.6.0 // indirect + github.com/coreos/go-systemd/v22 v22.7.0 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.7 // indirect github.com/cyberphone/json-canonicalization v0.0.0-20241213102144-19d51d7fe467 // indirect github.com/cyphar/filepath-securejoin v0.6.1 // indirect @@ -97,14 +97,14 @@ require ( github.com/docker/go-events v0.0.0-20250808211157-605354379745 // indirect github.com/docker/go-metrics v0.0.1 // indirect github.com/docker/go-units v0.5.0 // indirect - github.com/emicklei/go-restful/v3 v3.12.2 // indirect + github.com/emicklei/go-restful/v3 v3.13.0 // indirect github.com/evanphx/json-patch v5.9.11+incompatible // indirect github.com/evanphx/json-patch/v5 v5.9.11 // indirect github.com/exponent-io/jsonpath v0.0.0-20210407135951-1de76d718b3f // indirect github.com/fatih/color v1.18.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.10.1 // indirect - github.com/fxamacker/cbor/v2 v2.8.0 // indirect + github.com/fxamacker/cbor/v2 v2.9.0 // indirect github.com/go-errors/errors v1.4.2 // indirect github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect github.com/go-git/go-billy/v5 v5.9.0 // indirect @@ -129,17 +129,15 @@ require ( github.com/golang/protobuf v1.5.4 // indirect github.com/google/btree v1.1.3 // indirect github.com/google/cel-go v0.26.0 // indirect - github.com/google/gnostic-models v0.6.9 // indirect + github.com/google/gnostic-models v0.7.0 // indirect github.com/google/go-cmp v0.7.0 // indirect github.com/google/go-containerregistry v0.21.5 // indirect github.com/google/pprof v0.0.0-20260402051712-545e8a4df936 // indirect - github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect github.com/google/uuid v1.6.0 // indirect github.com/gorilla/handlers v1.5.2 // indirect github.com/gorilla/mux v1.8.1 // indirect github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 // indirect github.com/gosuri/uitable v0.0.4 // indirect - github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.29.0 // indirect github.com/h2non/filetype v1.1.3 // indirect github.com/h2non/go-is-svg v0.0.0-20160927212452-35e8c4b0612c // indirect @@ -181,10 +179,9 @@ require ( github.com/moby/sys/userns v0.1.0 // indirect github.com/moby/term v0.5.2 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect - github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect - github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect github.com/nxadm/tail v1.4.11 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.1.1 // indirect @@ -225,8 +222,6 @@ require ( github.com/x448/float16 v0.8.4 // indirect github.com/xlab/treeprint v1.2.0 // indirect go.etcd.io/bbolt v1.4.3 // indirect - go.etcd.io/etcd/client/pkg/v3 v3.6.8 // indirect - go.etcd.io/etcd/client/v3 v3.6.8 // indirect go.opencensus.io v0.24.0 // indirect go.opentelemetry.io/auto/sdk v1.2.1 // indirect go.opentelemetry.io/contrib/bridges/prometheus v0.67.0 // indirect @@ -272,21 +267,22 @@ require ( google.golang.org/genproto/googleapis/api v0.0.0-20260414002931-afd174a4e478 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20260511170946-3700d4141b60 // indirect google.golang.org/grpc v1.81.1 // indirect - google.golang.org/protobuf v1.36.11 // indirect - gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect + google.golang.org/protobuf v1.36.12-0.20260120151049-f2248ac996af // indirect + gopkg.in/evanphx/json-patch.v4 v4.13.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - k8s.io/apiserver v0.33.9 // indirect - k8s.io/component-base v0.33.9 // indirect - k8s.io/klog/v2 v2.130.1 // indirect - k8s.io/kube-openapi v0.0.0-20250610211856-8b98d1ed966a // indirect + k8s.io/apiserver v0.36.2 // indirect + k8s.io/component-base v0.36.2 // indirect + k8s.io/klog/v2 v2.140.0 // indirect + k8s.io/kube-openapi v0.0.0-20260317180543-43fb72c5454a // indirect + k8s.io/streaming v0.36.2 // indirect oras.land/oras-go/v2 v2.6.1 // indirect - sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.33.0 // indirect - sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect - sigs.k8s.io/kustomize/api v0.19.0 // indirect - sigs.k8s.io/kustomize/kyaml v0.19.0 // indirect + sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.34.0 // indirect + sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect + sigs.k8s.io/kustomize/api v0.21.1 // indirect + sigs.k8s.io/kustomize/kyaml v0.21.1 // indirect sigs.k8s.io/randfill v1.0.0 // indirect - sigs.k8s.io/structured-merge-diff/v4 v4.7.0 // indirect + sigs.k8s.io/structured-merge-diff/v6 v6.3.2 // indirect ) diff --git a/go.sum b/go.sum index 8fde735cd0c..52f325f8808 100644 --- a/go.sum +++ b/go.sum @@ -94,8 +94,8 @@ github.com/containers/ocicrypt v1.2.1 h1:0qIOTT9DoYwcKmxSt8QJt+VzMY18onl9jUXsxpV github.com/containers/ocicrypt v1.2.1/go.mod h1:aD0AAqfMp0MtwqWgHM1bUwe1anx0VazI108CRrSKINQ= github.com/coreos/go-semver v0.3.1 h1:yi21YpKnrx1gt5R+la8n5WgS0kCrsPp33dmEyHReZr4= github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03VsM8rvUec= -github.com/coreos/go-systemd/v22 v22.6.0 h1:aGVa/v8B7hpb0TKl0MWoAavPDmHvobFe5R5zn0bCJWo= -github.com/coreos/go-systemd/v22 v22.6.0/go.mod h1:iG+pp635Fo7ZmV/j14KUcmEyWF+0X7Lua8rrTWzYgWU= +github.com/coreos/go-systemd/v22 v22.7.0 h1:LAEzFkke61DFROc7zNLX/WA2i5J8gYqe0rSj9KI28KA= +github.com/coreos/go-systemd/v22 v22.7.0/go.mod h1:xNUYtjHu2EDXbsxz1i41wouACIwT7Ybq9o0BQhMwD0w= github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/cpuguy83/go-md2man/v2 v2.0.7 h1:zbFlGlXEAKlwXpmvle3d8Oe3YnkKIK4xSRTd3sHPnBo= github.com/cpuguy83/go-md2man/v2 v2.0.7/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= @@ -134,8 +134,8 @@ github.com/docker/go-metrics v0.0.1 h1:AgB/0SvBxihN0X8OR4SjsblXkbMvalQ8cjmtKQ2rQ github.com/docker/go-metrics v0.0.1/go.mod h1:cG1hvH2utMXtqgqqYE9plW6lDxS3/5ayHzueweSI3Vw= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= -github.com/emicklei/go-restful/v3 v3.12.2 h1:DhwDP0vY3k8ZzE0RunuJy8GhNpPL6zqLkDf9B/a0/xU= -github.com/emicklei/go-restful/v3 v3.12.2/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= +github.com/emicklei/go-restful/v3 v3.13.0 h1:C4Bl2xDndpU6nJ4bc1jXd+uTmYPVUwkD6bFY/oTyCes= +github.com/emicklei/go-restful/v3 v3.13.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= @@ -160,8 +160,8 @@ github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7z github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= github.com/fsnotify/fsnotify v1.10.1 h1:b0/UzAf9yR5rhf3RPm9gf3ehBPpf0oZKIjtpKrx59Ho= github.com/fsnotify/fsnotify v1.10.1/go.mod h1:TLheqan6HD6GBK6PrDWyDPBaEV8LspOxvPSjC+bVfgo= -github.com/fxamacker/cbor/v2 v2.8.0 h1:fFtUGXUzXPHTIUdne5+zzMPTfffl3RD5qYnkY40vtxU= -github.com/fxamacker/cbor/v2 v2.8.0/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj23V5ytsSxQ= +github.com/fxamacker/cbor/v2 v2.9.0 h1:NpKPmjDBgUfBms6tr6JZkTHtfFGcMKsw3eGcmD/sapM= +github.com/fxamacker/cbor/v2 v2.9.0/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj23V5ytsSxQ= github.com/gkampitakis/ciinfo v0.3.2 h1:JcuOPk8ZU7nZQjdUhctuhQofk7BGHuIy0c9Ez8BNhXs= github.com/gkampitakis/ciinfo v0.3.2/go.mod h1:1NIwaOcFChN4fa/B0hEBdAb6npDlFL8Bwx4dfRLRqAo= github.com/gkampitakis/go-diff v1.3.2 h1:Qyn0J9XJSDTgnsgHRdz9Zp24RaJeKMUHg2+PDZZdC4M= @@ -242,15 +242,14 @@ github.com/google/btree v1.1.3 h1:CVpQJjYgC4VbzxeGVHfvZrv1ctoYCAI8vbl07Fcxlyg= github.com/google/btree v1.1.3/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= github.com/google/cel-go v0.26.0 h1:DPGjXackMpJWH680oGY4lZhYjIameYmR+/6RBdDGmaI= github.com/google/cel-go v0.26.0/go.mod h1:A9O8OU9rdvrK5MQyrqfIxo1a0u4g3sF8KB6PUIaryMM= -github.com/google/gnostic-models v0.6.9 h1:MU/8wDLif2qCXZmzncUQ/BOfxWfthHi63KqpoNbWqVw= -github.com/google/gnostic-models v0.6.9/go.mod h1:CiWsm0s6BSQd1hRn8/QmxqB6BesYcbSZxsz9b0KuDBw= +github.com/google/gnostic-models v0.7.0 h1:qwTtogB15McXDaNqTZdzPJRHvaVJlAl+HVQnLmJEJxo= +github.com/google/gnostic-models v0.7.0/go.mod h1:whL5G0m6dmc5cPxKc5bdKdEN3UjI7OUGxBlw57miDrQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= @@ -261,8 +260,6 @@ github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/pprof v0.0.0-20260402051712-545e8a4df936 h1:EwtI+Al+DeppwYX2oXJCETMO23COyaKGP6fHVpkpWpg= github.com/google/pprof v0.0.0-20260402051712-545e8a4df936/go.mod h1:MxpfABSjhmINe3F1It9d+8exIHFvUqtLIRCdOGNXqiI= -github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4= -github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -274,10 +271,11 @@ github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 h1:JeSE6pjso5T github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674/go.mod h1:r4w70xmWCQKmi1ONH4KIaBptdivuRPyosB9RmPlGEwA= github.com/gosuri/uitable v0.0.4 h1:IG2xLKRvErL3uhY6e1BylFzG+aJiwQviDDTfOKeKTpY= github.com/gosuri/uitable v0.0.4/go.mod h1:tKR86bXuXPZazfOTG1FIzvjIdXzd0mo4Vtn16vt0PJo= -github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 h1:+ngKgrYPPJrOjhax5N+uePQ0Fh1Z7PheYoUI/0nzkPA= -github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= -github.com/grpc-ecosystem/go-grpc-prometheus v1.2.1-0.20210315223345-82c243799c99 h1:JYghRBlGCZyCF2wNUJ8W0cwaQdtpcssJ4CgC406g+WU= -github.com/grpc-ecosystem/go-grpc-prometheus v1.2.1-0.20210315223345-82c243799c99/go.mod h1:3bDW6wMZJB7tiONtC/1Xpicra6Wp5GgbTbQWCbI5fkc= +github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 h1:UH//fgunKIs4JdUbpDl1VZCDaL56wXCB/5+wF6uHfaI= +github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.1.0 h1:QGLs/O40yoNK9vmy4rhUGBVyMf1lISBGtXRpsu/Qu/o= +github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.1.0/go.mod h1:hM2alZsMUni80N33RBe6J0e423LB+odMj7d3EMP9l20= +github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.3 h1:B+8ClL/kCQkRiU82d9xajRPKYMrB7E0MbtzWVi1K4ns= +github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.3/go.mod h1:NbCUVmiS4foBGBHOYlCT25+YmGpJ32dZPi75pGEUpj4= github.com/grpc-ecosystem/grpc-gateway/v2 v2.29.0 h1:5VipnvEpbqr2gA2VbM+nYVbkIF28c5ZQfqCBQ5g2xfk= github.com/grpc-ecosystem/grpc-gateway/v2 v2.29.0/go.mod h1:Hyl3n6Twe1hvtd9XUXDec4pTvgMSEixRuQKPTMH2bNs= github.com/h2non/filetype v1.1.3 h1:FKkx9QbD7HR/zjK1Ia5XiBsq9zdLi5Kf3zGyFTAFkGg= @@ -394,15 +392,14 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee h1:W5t00kpgFdJifH4BDsTlE89Zl93FEloxaWZfGcifgq8= +github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 h1:n6/2gBQ3RWajuToeY6ZtZTIKv2v7ThUy5KKusIT0yc0= github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00/go.mod h1:Pm3mSP3c5uWn86xMLZ5Sa7JB9GsEZySvHYXCTK4E9q4= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f h1:y5//uYreIhSUg3J1GEMiLbxo1LJaP8RfCpH6pymGZus= -github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= github.com/nxadm/tail v1.4.11 h1:8feyoE3OzPrcshW5/MJ4sGESc5cqmGkGCWlco4l0bqY= github.com/nxadm/tail v1.4.11/go.mod h1:OTaG3NK980DZzxbRq6lEuzgU+mug70nY11sMd4JXXHc= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= @@ -815,15 +812,15 @@ google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= -google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= +google.golang.org/protobuf v1.36.12-0.20260120151049-f2248ac996af h1:+5/Sw3GsDNlEmu7TfklWKPdQ0Ykja5VEmq2i817+jbI= +google.golang.org/protobuf v1.36.12-0.20260120151049-f2248ac996af/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/evanphx/json-patch.v4 v4.12.0 h1:n6jtcsulIzXPJaxegRbvFNNrZDjbij7ny3gmSPG+6V4= -gopkg.in/evanphx/json-patch.v4 v4.12.0/go.mod h1:p8EYWUEYMpynmqDbY58zCKCFZw8pRWMG4EsWvDvM72M= +gopkg.in/evanphx/json-patch.v4 v4.13.0 h1:czT3CmqEaQ1aanPc5SdlgQrrEIb8w/wwCvWWnfEbYzo= +gopkg.in/evanphx/json-patch.v4 v4.13.0/go.mod h1:p8EYWUEYMpynmqDbY58zCKCFZw8pRWMG4EsWvDvM72M= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= @@ -843,49 +840,49 @@ helm.sh/helm/v3 v3.18.6 h1:S/2CqcYnNfLckkHLI0VgQbxgcDaU3N4A/46E3n9wSNY= helm.sh/helm/v3 v3.18.6/go.mod h1:L/dXDR2r539oPlFP1PJqKAC1CUgqHJDLkxKpDGrWnyg= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -k8s.io/api v0.33.9 h1:QoLQgQzazgHUK3C7SzakD+QlfgSoppNNStUXHPRFAg0= -k8s.io/api v0.33.9/go.mod h1:bzXsnmnU3fJS7sqS0/B7yuR++M0VEEcb0xbntSxLrzU= -k8s.io/apiextensions-apiserver v0.33.9 h1:p5Ao3yrNWmdoVtqEdfhU9ujTNde7PtSgxPPTOh/jHEA= -k8s.io/apiextensions-apiserver v0.33.9/go.mod h1:LqqV//JrmiZ3k5EX8loTQFELYROprV0bZcstPi16fso= -k8s.io/apimachinery v0.33.9 h1:axzrsWm3cbGIlzMAMrN+FY0VZ3Y/0zGJLVBdge1GUMo= -k8s.io/apimachinery v0.33.9/go.mod h1:BHW0YOu7n22fFv/JkYOEfkUYNRN0fj0BlvMFWA7b+SM= -k8s.io/apiserver v0.33.9 h1:7pVTaj4Llf652oHZEA1WaWwTkVIRbZwZkjeSOU1CHV0= -k8s.io/apiserver v0.33.9/go.mod h1:uwDR3UtZ201iSNiEnFay8huQtccygneqWjnzsUzzWjo= -k8s.io/cli-runtime v0.33.9 h1:+wfn402vwycirwoUgi1Qhkv/66ZFXCY0QZ1/o1gl/j0= -k8s.io/cli-runtime v0.33.9/go.mod h1:sKkwL+mK4yBcQMBkj0oRMkr8MICb2vmIo+W6LbcTN6A= -k8s.io/client-go v0.33.9 h1:eKERuku85ZVS2vatHNvbGZBSjUN0b3aDBZZwG/8pSzs= -k8s.io/client-go v0.33.9/go.mod h1:GR4liooJGOd/cQrYpohyOWaoZbE4l9oPw2KZzpUZA74= -k8s.io/component-base v0.33.9 h1:hE7jBcCH43udsELSJxfN4JEKR/WkFP6REUHe2+ZyWME= -k8s.io/component-base v0.33.9/go.mod h1:ptjJCkb60xUJ3cAWtuqi5bWYXKqF/cwHnc/2eT9qzak= -k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= -k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= -k8s.io/kube-openapi v0.0.0-20250610211856-8b98d1ed966a h1:ZV3Zr+/7s7aVbjNGICQt+ppKWsF1tehxggNfbM7XnG8= -k8s.io/kube-openapi v0.0.0-20250610211856-8b98d1ed966a/go.mod h1:5jIi+8yX4RIb8wk3XwBo5Pq2ccx4FP10ohkbSKCZoK8= -k8s.io/kubectl v0.33.9 h1:E2TxYlknKaSQWK/fVyuU9v67/BC1YWGzHHaU6NLOrnk= -k8s.io/kubectl v0.33.9/go.mod h1:ezz1y1xXaQ+NL10iGl9lk9IQU5ZB5K4fHVlNRxwTdEc= -k8s.io/utils v0.0.0-20251002143259-bc988d571ff4 h1:SjGebBtkBqHFOli+05xYbK8YF1Dzkbzn+gDM4X9T4Ck= -k8s.io/utils v0.0.0-20251002143259-bc988d571ff4/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +k8s.io/api v0.36.2 h1:TF6YDLIzKfccK7cq9YpTcGX8TJmEkHVRv78DM51fRYY= +k8s.io/api v0.36.2/go.mod h1:F4LbMO4brjZYh7yFkXWhynSvtB7YauxV4c+HHkNRGNg= +k8s.io/apiextensions-apiserver v0.36.2 h1:3O5gqOj/dt2XWWbpMe+TXWpE9yU6pjM/tXxtHHJT/K4= +k8s.io/apiextensions-apiserver v0.36.2/go.mod h1:cL1tBWe8XSaP1H30iWKGo7hf6iAUUUJPEU70dskmAnA= +k8s.io/apimachinery v0.36.2 h1:0PE/W/WNy1UX61NLbXY5TMbJ6UwLL6E6lAPkYrKFxbQ= +k8s.io/apimachinery v0.36.2/go.mod h1:fvf/HOLXq9RId0rnDIbN1OEBvHXdQbLMM8nu0LcBUf4= +k8s.io/apiserver v0.36.2 h1:6vMnkmHZPeBloNkHUhmZYq7Ylv8WIB8xjyEl+eSt26E= +k8s.io/apiserver v0.36.2/go.mod h1:9PoQ2ikCytrZyZg11mGhLEF5m8Rgsb5FJmYJ4Wvnl1k= +k8s.io/cli-runtime v0.36.2 h1:CconTvEeV4DJs4ZX3HQKCFbFRGsm6OtuBM9yjmMP2VM= +k8s.io/cli-runtime v0.36.2/go.mod h1:LddcjiMf4YlnHO7c1Y7rEtDqL84FyiYVLco7V679GUU= +k8s.io/client-go v0.36.2 h1:bfgxmFKc9CgqsgX4xKLAAdmTQlWee7Ob/HlDOrJ5TBI= +k8s.io/client-go v0.36.2/go.mod h1:1vgO4OAlfPnoLcb+Rze2GF5rAr14w8qjrYMoyXJzQj0= +k8s.io/component-base v0.36.2 h1:Z0VH80O7Ng0HDZnZj3WRR3urEGa0kTwmO8CwEwjVK1w= +k8s.io/component-base v0.36.2/go.mod h1:mGfFOA7Gwpdm1VW2cwSQYbiDIlz8GD2WGwH88QSeCyA= +k8s.io/klog/v2 v2.140.0 h1:Tf+J3AH7xnUzZyVVXhTgGhEKnFqye14aadWv7bzXdzc= +k8s.io/klog/v2 v2.140.0/go.mod h1:o+/RWfJ6PwpnFn7OyAG3QnO47BFsymfEfrz6XyYSSp0= +k8s.io/kube-openapi v0.0.0-20260317180543-43fb72c5454a h1:xCeOEAOoGYl2jnJoHkC3hkbPJgdATINPMAxaynU2Ovg= +k8s.io/kube-openapi v0.0.0-20260317180543-43fb72c5454a/go.mod h1:uGBT7iTA6c6MvqUvSXIaYZo9ukscABYi2btjhvgKGZ0= +k8s.io/kubectl v0.36.2 h1:rpUGGpeL09XVOLep2yle5jrtk//JA1L6ZHfkQQtVEwk= +k8s.io/kubectl v0.36.2/go.mod h1:gVbQ3B/yb4bSR2ggQ7rd0W6icUSWs7sduH4e16Vii+0= +k8s.io/streaming v0.36.2 h1:NSKthPPg9UFSKsRauVJUVGH2Dvn8fhKmY4qrMkw/p98= +k8s.io/streaming v0.36.2/go.mod h1:z6fV3D+NVkoeqRMtWwlUZK6U17SY/LqNzOxWL6GyR/s= +k8s.io/utils v0.0.0-20260210185600-b8788abfbbc2 h1:AZYQSJemyQB5eRxqcPky+/7EdBj0xi3g0ZcxxJ7vbWU= +k8s.io/utils v0.0.0-20260210185600-b8788abfbbc2/go.mod h1:xDxuJ0whA3d0I4mf/C4ppKHxXynQ+fxnkmQH0vTHnuk= oras.land/oras-go/v2 v2.6.1 h1:bonOEkjLfp8tt6qXWRRWP6p1F+9octchOf2EqnWB4Zs= oras.land/oras-go/v2 v2.6.1/go.mod h1:dhtFrFOuZuDtAVeZ9FUnaa5zfzplG3ZnFX9/uH1J/Yk= -sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.33.0 h1:qPrZsv1cwQiFeieFlRqT627fVZ+tyfou/+S5S0H5ua0= -sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.33.0/go.mod h1:Ve9uj1L+deCXFrPOk1LpFXqTg7LCFzFso6PA48q/XZw= -sigs.k8s.io/controller-runtime v0.21.0 h1:CYfjpEuicjUecRk+KAeyYh+ouUBn4llGyDYytIGcJS8= -sigs.k8s.io/controller-runtime v0.21.0/go.mod h1:OSg14+F65eWqIu4DceX7k/+QRAbTTvxeQSNSOQpukWM= +sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.34.0 h1:hSfpvjjTQXQY2Fol2CS0QHMNs/WI1MOSGzCm1KhM5ec= +sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.34.0/go.mod h1:Ve9uj1L+deCXFrPOk1LpFXqTg7LCFzFso6PA48q/XZw= +sigs.k8s.io/controller-runtime v0.24.1 h1:miPEwrmirImAvgME1L9qebGHrOnGJoVmVdtOU9fRfo4= +sigs.k8s.io/controller-runtime v0.24.1/go.mod h1:vFkfY5fGt5xAC/sKb8IBFKgWPNKG9OUG29dR8Y2wImw= sigs.k8s.io/controller-tools v0.18.0 h1:rGxGZCZTV2wJreeRgqVoWab/mfcumTMmSwKzoM9xrsE= sigs.k8s.io/controller-tools v0.18.0/go.mod h1:gLKoiGBriyNh+x1rWtUQnakUYEujErjXs9pf+x/8n1U= -sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 h1:gBQPwqORJ8d8/YNZWEjoZs7npUVDpVXUUOFfW6CgAqE= -sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8/go.mod h1:mdzfpAEoE6DHQEN0uh9ZbOCuHbLK5wOm7dK4ctXE9Tg= +sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 h1:IpInykpT6ceI+QxKBbEflcR5EXP7sU1kvOlxwZh5txg= +sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730/go.mod h1:mdzfpAEoE6DHQEN0uh9ZbOCuHbLK5wOm7dK4ctXE9Tg= sigs.k8s.io/kubebuilder/v4 v4.6.0 h1:SBc37jghs3L2UaEL91A1t5K5dANrEviUDuNic9hMQSw= sigs.k8s.io/kubebuilder/v4 v4.6.0/go.mod h1:zlXrnLiJPDPpK4hKCUrlgzzLOusfA8Sd8tpYGIrvD00= -sigs.k8s.io/kustomize/api v0.19.0 h1:F+2HB2mU1MSiR9Hp1NEgoU2q9ItNOaBJl0I4Dlus5SQ= -sigs.k8s.io/kustomize/api v0.19.0/go.mod h1:/BbwnivGVcBh1r+8m3tH1VNxJmHSk1PzP5fkP6lbL1o= -sigs.k8s.io/kustomize/kyaml v0.19.0 h1:RFge5qsO1uHhwJsu3ipV7RNolC7Uozc0jUBC/61XSlA= -sigs.k8s.io/kustomize/kyaml v0.19.0/go.mod h1:FeKD5jEOH+FbZPpqUghBP8mrLjJ3+zD3/rf9NNu1cwY= -sigs.k8s.io/randfill v0.0.0-20250304075658-069ef1bbf016/go.mod h1:XeLlZ/jmk4i1HRopwe7/aU3H5n1zNUcX6TM94b3QxOY= +sigs.k8s.io/kustomize/api v0.21.1 h1:lzqbzvz2CSvsjIUZUBNFKtIMsEw7hVLJp0JeSIVmuJs= +sigs.k8s.io/kustomize/api v0.21.1/go.mod h1:f3wkKByTrgpgltLgySCntrYoq5d3q7aaxveSagwTlwI= +sigs.k8s.io/kustomize/kyaml v0.21.1 h1:IVlbmhC076nf6foyL6Taw4BkrLuEsXUXNpsE+ScX7fI= +sigs.k8s.io/kustomize/kyaml v0.21.1/go.mod h1:hmxADesM3yUN2vbA5z1/YTBnzLJ1dajdqpQonwBL1FQ= sigs.k8s.io/randfill v1.0.0 h1:JfjMILfT8A6RbawdsK2JXGBR5AQVfd+9TbzrlneTyrU= sigs.k8s.io/randfill v1.0.0/go.mod h1:XeLlZ/jmk4i1HRopwe7/aU3H5n1zNUcX6TM94b3QxOY= -sigs.k8s.io/structured-merge-diff/v4 v4.7.0 h1:qPeWmscJcXP0snki5IYF79Z8xrl8ETFxgMd7wez1XkI= -sigs.k8s.io/structured-merge-diff/v4 v4.7.0/go.mod h1:dDy58f92j70zLsuZVuUX5Wp9vtxXpaZnkPGWeqDfCps= -sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= +sigs.k8s.io/structured-merge-diff/v6 v6.3.2 h1:kwVWMx5yS1CrnFWA/2QHyRVJ8jM6dBA80uLmm0wJkk8= +sigs.k8s.io/structured-merge-diff/v6 v6.3.2/go.mod h1:M3W8sfWvn2HhQDIbGWj3S099YozAsymCo/wrT5ohRUE= sigs.k8s.io/yaml v1.6.0 h1:G8fkbMSAFqgEFgh4b1wmtzDnioxFCUgTZhlbj5P9QYs= sigs.k8s.io/yaml v1.6.0/go.mod h1:796bPqUfzR/0jLAl6XjHl3Ck7MiyVv8dbTdyT3/pMf4= diff --git a/internal/helm/controller/controller.go b/internal/helm/controller/controller.go index f846037f4d4..edafc118f8a 100644 --- a/internal/helm/controller/controller.go +++ b/internal/helm/controller/controller.go @@ -61,8 +61,12 @@ func Add(mgr manager.Manager, options WatchOptions) error { controllerName := fmt.Sprintf("%v-controller", strings.ToLower(options.GVK.Kind)) r := &HelmOperatorReconciler{ - Client: mgr.GetClient(), - EventRecorder: mgr.GetEventRecorderFor(controllerName), + Client: mgr.GetClient(), + // HelmOperatorReconciler.EventRecorder is the old-style + // record.EventRecorder; migrating to the new events API + // (mgr.GetEventRecorder) requires changing that field's type and both + // call sites' Eventf signature, which is out of scope here. + EventRecorder: mgr.GetEventRecorderFor(controllerName), //nolint:staticcheck GVK: options.GVK, ManagerFactory: options.ManagerFactory, ReconcilePeriod: options.ReconcilePeriod, diff --git a/internal/olm/client/client_test.go b/internal/olm/client/client_test.go index 2f7a3e382b5..85aa629b77a 100644 --- a/internal/olm/client/client_test.go +++ b/internal/olm/client/client_test.go @@ -365,6 +365,10 @@ func (c *errClient) Get(ctx context.Context, key client.ObjectKey, obj client.Ob func (c *errClient) List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error { return c.cli.List(ctx, list, opts...) } +func (c *errClient) Apply(ctx context.Context, obj runtime.ApplyConfiguration, opts ...client.ApplyOption) error { + return c.cli.Apply(ctx, obj, opts...) +} + func (c *errClient) Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) error { switch obj.GetName() { case "no-match": diff --git a/internal/olm/operator/uninstall.go b/internal/olm/operator/uninstall.go index 8288930632c..0541592809c 100644 --- a/internal/olm/operator/uninstall.go +++ b/internal/olm/operator/uninstall.go @@ -17,6 +17,7 @@ package operator import ( "context" "fmt" + "slices" "strings" "time" @@ -29,7 +30,6 @@ import ( "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/wait" - "k8s.io/kubectl/pkg/util/slice" "sigs.k8s.io/controller-runtime/pkg/client" ) @@ -195,7 +195,7 @@ func (u *Uninstall) deleteOperatorGroup(ctx context.Context) error { return fmt.Errorf("list operatorgroups: %v", err) } for _, og := range ogs.Items { - if len(u.DeleteOperatorGroupNames) == 0 || slice.ContainsString(u.DeleteOperatorGroupNames, og.GetName(), nil) { + if len(u.DeleteOperatorGroupNames) == 0 || slices.Contains(u.DeleteOperatorGroupNames, og.GetName()) { if err := u.deleteObjects(ctx, false, &og); err != nil { return err } From d8ed560c0472db466d0b28f19f69e0e179d773b7 Mon Sep 17 00:00:00 2001 From: Mytreya Kasturi Date: Fri, 14 Aug 2026 13:34:02 +0530 Subject: [PATCH 2/4] Migrate helm-operator EventRecorder off deprecated events API The prior commit left HelmOperatorReconciler.EventRecorder on the deprecated Manager.GetEventRecorderFor/record.EventRecorder pair, suppressed with a //nolint:staticcheck, calling the full migration a larger, unrelated change. Do that migration now, as its own commit, so staticcheck (SA1019) stays clean without a nolint annotation. Switch HelmOperatorReconciler.EventRecorder to k8s.io/client-go/tools/events.EventRecorder (populated via the new Manager.GetEventRecorder) and update both Eventf call sites to the new signature: Eventf(regarding, related, eventtype, reason, action, note, args...). The related object is always nil here since there's no separate related object modeled for override-value events. The reason string ("OverrideValuesInUse") is reused as the action value since this code doesn't otherwise model a distinct action; happy to adjust if maintainers prefer a different action string. No go.mod/go.sum/vendor changes: k8s.io/client-go/tools/events is already a transitive dependency via controller-runtime's Manager.GetEventRecorder. Co-authored-by: Cursor --- internal/helm/controller/controller.go | 8 ++------ internal/helm/controller/reconcile.go | 8 ++++---- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/internal/helm/controller/controller.go b/internal/helm/controller/controller.go index edafc118f8a..79c14e7c2da 100644 --- a/internal/helm/controller/controller.go +++ b/internal/helm/controller/controller.go @@ -61,12 +61,8 @@ func Add(mgr manager.Manager, options WatchOptions) error { controllerName := fmt.Sprintf("%v-controller", strings.ToLower(options.GVK.Kind)) r := &HelmOperatorReconciler{ - Client: mgr.GetClient(), - // HelmOperatorReconciler.EventRecorder is the old-style - // record.EventRecorder; migrating to the new events API - // (mgr.GetEventRecorder) requires changing that field's type and both - // call sites' Eventf signature, which is out of scope here. - EventRecorder: mgr.GetEventRecorderFor(controllerName), //nolint:staticcheck + Client: mgr.GetClient(), + EventRecorder: mgr.GetEventRecorder(controllerName), GVK: options.GVK, ManagerFactory: options.ManagerFactory, ReconcilePeriod: options.ReconcilePeriod, diff --git a/internal/helm/controller/reconcile.go b/internal/helm/controller/reconcile.go index ec9a77ef90e..b8e021ebd2c 100644 --- a/internal/helm/controller/reconcile.go +++ b/internal/helm/controller/reconcile.go @@ -29,7 +29,7 @@ import ( "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/util/wait" - "k8s.io/client-go/tools/record" + "k8s.io/client-go/tools/events" "k8s.io/client-go/util/retry" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" @@ -49,7 +49,7 @@ type ReleaseHookFunc func(*rpb.Release) error // HelmOperatorReconciler reconciles custom resources as Helm releases. type HelmOperatorReconciler struct { Client client.Client - EventRecorder record.EventRecorder + EventRecorder events.EventRecorder GVK schema.GroupVersionKind ManagerFactory release.ManagerFactory ReconcilePeriod time.Duration @@ -239,7 +239,7 @@ func (r HelmOperatorReconciler) Reconcile(ctx context.Context, request reconcile if r.SuppressOverrideValues { v = "****" } - r.EventRecorder.Eventf(o, "Warning", "OverrideValuesInUse", + r.EventRecorder.Eventf(o, nil, "Warning", "OverrideValuesInUse", "OverrideValuesInUse", "Chart value %q overridden to %q by operator's watches.yaml", k, v) } installedRelease, err := manager.InstallRelease() @@ -310,7 +310,7 @@ func (r HelmOperatorReconciler) Reconcile(ctx context.Context, request reconcile if r.SuppressOverrideValues { v = "****" } - r.EventRecorder.Eventf(o, "Warning", "OverrideValuesInUse", + r.EventRecorder.Eventf(o, nil, "Warning", "OverrideValuesInUse", "OverrideValuesInUse", "Chart value %q overridden to %q by operator's watches.yaml", k, v) } force := hasAnnotation(helmUpgradeForceAnnotation, o) From d15c90a3920040d630c8089bffc409d2a821b0d3 Mon Sep 17 00:00:00 2001 From: Mytreya Kasturi Date: Fri, 14 Aug 2026 11:48:15 +0530 Subject: [PATCH 3/4] Add pluggable ClusterTLSPolicy extension point Adds internal/cmd/helm-operator/run/tlspolicy.go, defining a generic ClusterTLSPolicy interface (Apply/Watch) and RegisterClusterTLSPolicy, plus minimal hook call-sites in cmd.go. This lets a distribution of the helm-operator plug in centrally-managed TLS configuration (e.g. sourced from cluster-wide config) without operator-sdk itself knowing about any specific source. No implementation is registered by default, so this is a no-op for anyone who doesn't call RegisterClusterTLSPolicy: safe, backward compatible, and free of new dependencies. For example, an OpenShift distribution can register an implementation that reads apiservers.config.openshift.io/cluster and applies its TLS security profile to the metrics server, watching for changes to trigger a graceful restart. Co-authored-by: Cursor --- internal/cmd/helm-operator/run/cmd.go | 30 ++++++++++++- internal/cmd/helm-operator/run/tlspolicy.go | 50 +++++++++++++++++++++ 2 files changed, 78 insertions(+), 2 deletions(-) create mode 100644 internal/cmd/helm-operator/run/tlspolicy.go diff --git a/internal/cmd/helm-operator/run/cmd.go b/internal/cmd/helm-operator/run/cmd.go index f42a8b62590..4e77cbfb4c2 100644 --- a/internal/cmd/helm-operator/run/cmd.go +++ b/internal/cmd/helm-operator/run/cmd.go @@ -15,6 +15,7 @@ package run import ( + "context" "errors" "flag" "fmt" @@ -160,12 +161,33 @@ func run(cmd *cobra.Command, f *flags.Flags) { options.NewClient = client.New } + ctx, cancel := context.WithCancel(signals.SetupSignalHandler()) + defer cancel() + + // If a distribution registered a ClusterTLSPolicy (see tlspolicy.go), + // give it a chance to augment the manager options (e.g. metrics TLS + // settings) before the manager is constructed. Nothing is registered + // by default, so this is a no-op for upstream operator-sdk builds. + if registeredTLSPolicy != nil { + options, err = registeredTLSPolicy.Apply(ctx, cfg, options) + if err != nil { + log.Error(err, "Failed to apply cluster TLS policy; continuing with unmodified TLS settings.") + } + } + mgr, err := manager.New(cfg, options) if err != nil { log.Error(err, "Failed to create a new manager.") os.Exit(1) } + if registeredTLSPolicy != nil { + if err := registeredTLSPolicy.Watch(ctx, mgr, cancel); err != nil { + log.Error(err, "Failed to start cluster TLS policy watch.") + os.Exit(1) + } + } + if err := mgr.AddHealthzCheck("healthz", healthz.Ping); err != nil { log.Error(err, "Unable to set up health check") os.Exit(1) @@ -204,8 +226,12 @@ func run(cmd *cobra.Command, f *flags.Flags) { } } - // Start the Cmd - if err = mgr.Start(signals.SetupSignalHandler()); err != nil { + // Start the Cmd. ctx is cancelled either by an OS signal, or by a + // registered ClusterTLSPolicy's Watch reacting to a policy change + // (see tlspolicy.go); either way this triggers a graceful shutdown, + // and the surrounding Deployment/container restart re-applies + // startup-time policy on the next boot. + if err = mgr.Start(ctx); err != nil { log.Error(err, "Manager exited non-zero.") os.Exit(1) } diff --git a/internal/cmd/helm-operator/run/tlspolicy.go b/internal/cmd/helm-operator/run/tlspolicy.go new file mode 100644 index 00000000000..85867799bd5 --- /dev/null +++ b/internal/cmd/helm-operator/run/tlspolicy.go @@ -0,0 +1,50 @@ +// Copyright 2026 The Operator-SDK Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package run + +import ( + "context" + + "k8s.io/client-go/rest" + "sigs.k8s.io/controller-runtime/pkg/manager" +) + +// ClusterTLSPolicy is an extension point that lets a distribution or +// deployment of the helm-operator enforce a centralized TLS policy (for +// example, one derived from cluster-wide configuration) on top of the +// manager's default TLS settings. operator-sdk ships no implementation; +// it is nil unless a build registers one via RegisterClusterTLSPolicy. +type ClusterTLSPolicy interface { + // Apply augments manager options (e.g. options.Metrics.TLSOpts) with + // any policy-driven TLS configuration. Implementations must return + // promptly and should fail open (return the input options unchanged + // on error) so a missing/unreachable policy source never blocks + // operator startup. + Apply(ctx context.Context, cfg *rest.Config, options manager.Options) (manager.Options, error) + + // Watch is invoked once after the manager is constructed, for + // implementations that need to react to policy changes at runtime + // (e.g. triggering a graceful restart via cancel). + Watch(ctx context.Context, mgr manager.Manager, cancel context.CancelFunc) error +} + +var registeredTLSPolicy ClusterTLSPolicy + +// RegisterClusterTLSPolicy installs a ClusterTLSPolicy implementation. +// Intended to be called from an init() in a distribution-specific package, +// wired in via a blank import in cmd/helm-operator/main.go. +func RegisterClusterTLSPolicy(p ClusterTLSPolicy) { + registeredTLSPolicy = p +} From 2ae8cb2a1133a95b7c819988a4f1dfb55b8ef6bc Mon Sep 17 00:00:00 2001 From: Mytreya Kasturi Date: Fri, 14 Aug 2026 11:47:47 +0530 Subject: [PATCH 4/4] Add unit tests for ClusterTLSPolicy extension point Covers registration, overwrite behavior, and the fail-open contract documented on ClusterTLSPolicy.Apply. Co-authored-by: Cursor --- .../cmd/helm-operator/run/tlspolicy_test.go | 95 +++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 internal/cmd/helm-operator/run/tlspolicy_test.go diff --git a/internal/cmd/helm-operator/run/tlspolicy_test.go b/internal/cmd/helm-operator/run/tlspolicy_test.go new file mode 100644 index 00000000000..ce14515e5f1 --- /dev/null +++ b/internal/cmd/helm-operator/run/tlspolicy_test.go @@ -0,0 +1,95 @@ +// Copyright 2026 The Operator-SDK Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package run + +import ( + "context" + "errors" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "k8s.io/client-go/rest" + "sigs.k8s.io/controller-runtime/pkg/manager" +) + +// stubTLSPolicy is a minimal ClusterTLSPolicy used to verify the +// registration/hook contract without depending on any real implementation +// (e.g. the downstream-only openshifttls package). +type stubTLSPolicy struct { + applyCalled, watchCalled bool + applyErr, watchErr error +} + +func (s *stubTLSPolicy) Apply(_ context.Context, _ *rest.Config, options manager.Options) (manager.Options, error) { + s.applyCalled = true + return options, s.applyErr +} + +func (s *stubTLSPolicy) Watch(_ context.Context, _ manager.Manager, _ context.CancelFunc) error { + s.watchCalled = true + return s.watchErr +} + +// withRegisteredTLSPolicy registers p for the duration of the test and +// restores the previous value on cleanup, so tests don't leak global state +// into each other or into non-TLS-policy tests in this package. +func withRegisteredTLSPolicy(t *testing.T, p ClusterTLSPolicy) { + t.Helper() + previous := registeredTLSPolicy + t.Cleanup(func() { registeredTLSPolicy = previous }) + registeredTLSPolicy = p +} + +func TestNoClusterTLSPolicyRegisteredByDefault(t *testing.T) { + // Guards the upstream operator-sdk default: without a distribution + // registering an implementation (e.g. via a blank import of an + // OpenShift-specific package), the hook must be a no-op. + assert.Nil(t, registeredTLSPolicy) +} + +func TestRegisterClusterTLSPolicy(t *testing.T) { + require.Nil(t, registeredTLSPolicy) + + policy := &stubTLSPolicy{} + withRegisteredTLSPolicy(t, policy) + + assert.Same(t, ClusterTLSPolicy(policy), registeredTLSPolicy) +} + +func TestRegisterClusterTLSPolicy_Overwrites(t *testing.T) { + first := &stubTLSPolicy{} + withRegisteredTLSPolicy(t, first) + + second := &stubTLSPolicy{} + RegisterClusterTLSPolicy(second) + + assert.Same(t, ClusterTLSPolicy(second), registeredTLSPolicy) +} + +func TestClusterTLSPolicy_ApplyFailsOpen(t *testing.T) { + // Documents the interface contract: Apply may return an error, and + // callers (cmd.go's run()) are expected to log and continue with the + // input options unchanged rather than fail startup. + policy := &stubTLSPolicy{applyErr: errors.New("profile source unreachable")} + withRegisteredTLSPolicy(t, policy) + + in := manager.Options{} + out, err := registeredTLSPolicy.Apply(context.Background(), &rest.Config{}, in) + + require.Error(t, err) + assert.True(t, policy.applyCalled) + assert.Equal(t, in, out) +}