Skip to content

Commit f833b31

Browse files
Merge pull request #380 from slintes/update-deps
Update OCP / K8s dependencies and tool versions
2 parents 5784acc + 4a52856 commit f833b31

File tree

3,202 files changed

+177732
-131001
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,202 files changed

+177732
-131001
lines changed

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ OPERATOR_SDK_VERSION = v1.33.0
66
# https://pkg.go.dev/github.com/operator-framework/operator-registry?tab=versions
77
OPM_VERSION = v1.56.0
88
# https://pkg.go.dev/sigs.k8s.io/controller-tools?tab=versions
9-
CONTROLLER_GEN_VERSION = v0.18.0
9+
CONTROLLER_GEN_VERSION = v0.17.3
1010
# update for major version updates to KUSTOMIZE_VERSION!
1111
KUSTOMIZE_API_VERSION = v5
1212
# https://pkg.go.dev/sigs.k8s.io/kustomize/kustomize/v5?tab=versions
1313
KUSTOMIZE_VERSION = v5.3.0
1414
# https://pkg.go.dev/sigs.k8s.io/controller-runtime/tools/setup-envtest/env?tab=versions
15-
ENVTEST_VERSION = v0.0.0-20240123110158-b88ed7a3602b
15+
ENVTEST_VERSION = v0.0.0-20250813191507-c7df6d0236ed
1616
# https://pkg.go.dev/golang.org/x/tools/cmd/goimports?tab=versions
1717
GOIMPORTS_VERSION = v0.36.0
1818
# https://pkg.go.dev/github.com/slintes/sort-imports?tab=versions
@@ -22,7 +22,7 @@ YQ_API_VERSION = v4
2222
YQ_VERSION = v4.47.1
2323

2424
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
25-
ENVTEST_K8S_VERSION = 1.28
25+
ENVTEST_K8S_VERSION = 1.32
2626

2727
# VERSION defines the project version for the bundle.
2828
# Update this value when you upgrade the version of your project.

bundle/manifests/remediation.medik8s.io_nodehealthchecks.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
22
kind: CustomResourceDefinition
33
metadata:
44
annotations:
5-
controller-gen.kubebuilder.io/version: v0.18.0
5+
controller-gen.kubebuilder.io/version: v0.17.3
66
creationTimestamp: null
77
labels:
88
app.kubernetes.io/name: node-healthcheck-operator
@@ -256,11 +256,13 @@ spec:
256256
items:
257257
type: string
258258
type: array
259+
x-kubernetes-list-type: atomic
259260
required:
260261
- key
261262
- operator
262263
type: object
263264
type: array
265+
x-kubernetes-list-type: atomic
264266
matchLabels:
265267
additionalProperties:
266268
type: string

config/crd/bases/remediation.medik8s.io_nodehealthchecks.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.18.0
6+
controller-gen.kubebuilder.io/version: v0.17.3
77
name: nodehealthchecks.remediation.medik8s.io
88
spec:
99
group: remediation.medik8s.io
@@ -254,11 +254,13 @@ spec:
254254
items:
255255
type: string
256256
type: array
257+
x-kubernetes-list-type: atomic
257258
required:
258259
- key
259260
- operator
260261
type: object
261262
type: array
263+
x-kubernetes-list-type: atomic
262264
matchLabels:
263265
additionalProperties:
264266
type: string

controllers/cluster/capabilities.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,7 @@ func NewCapabilities(config *rest.Config, reader client.Reader, logger logr.Logg
6969
// see https://github.com/openshift/api/blob/c1fdeb0788c16659238d93ec45ce2e798c14eb88/config/v1/types_infrastructure.go#L129-L147
7070
if cpTopology == configv1.HighlyAvailableTopologyMode ||
7171
cpTopology == configv1.SingleReplicaTopologyMode ||
72-
// quick fix without updating openshift/api dependency, it would need too many other updates
73-
// see https://github.com/openshift/api/blob/017e9dd0276e4ed0242a759dffd419d728337876/config/v1/types_infrastructure.go#L142
74-
// update to const once deps are updated
75-
cpTopology == "HighlyAvailableArbiter" ||
72+
cpTopology == configv1.HighlyAvailableArbiterMode ||
7673
cpTopology == configv1.ExternalTopologyMode {
7774

7875
logger.Info("supported control plane topology", "topology", cpTopology)

controllers/featuregates/accessor.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ import (
1313

1414
"k8s.io/client-go/rest"
1515
"k8s.io/client-go/tools/cache"
16+
"k8s.io/utils/clock"
1617
ctrl "sigs.k8s.io/controller-runtime"
1718
"sigs.k8s.io/controller-runtime/pkg/event"
1819

19-
osconfigv1 "github.com/openshift/api/config/v1"
20+
osfeatures "github.com/openshift/api/features"
2021
osclientset "github.com/openshift/client-go/config/clientset/versioned"
2122
configinformersv1 "github.com/openshift/client-go/config/informers/externalversions"
2223
"github.com/openshift/library-go/pkg/operator/configobserver/featuregates"
@@ -81,7 +82,7 @@ func (fga *accessor) Start(ctx context.Context) error {
8182
clusterVersionsInformer := configSharedInformer.Config().V1().ClusterVersions()
8283
featureGatesInformer := configSharedInformer.Config().V1().FeatureGates()
8384

84-
recorder := events.NewLoggingEventRecorder("accessor")
85+
recorder := events.NewLoggingEventRecorder("accessor", clock.RealClock{})
8586

8687
// using the same version for desiredVersion and missingVersion will let the accessor just use
8788
// the current deployed version, which is what we want...
@@ -123,7 +124,7 @@ func (fga *accessor) featureGateChanged(fc featuregates.FeatureChange) {
123124
defer fga.isMaoMhcDisabledLock.Unlock()
124125

125126
for _, fg := range fc.New.Enabled {
126-
if fg == osconfigv1.FeatureGateMachineAPIOperatorDisableMachineHealthCheckController {
127+
if fg == osfeatures.FeatureGateMachineAPIOperatorDisableMachineHealthCheckController {
127128
if !fga.isMaoMhcDisabled {
128129
fga.isMaoMhcDisabled = true
129130
fga.log.Info("MachineAPIOperatorDisableMachineHealthCheckController feature gate is enabled")

controllers/initializer/suite_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import (
3737
"sigs.k8s.io/controller-runtime/pkg/metrics/server"
3838

3939
consolev1 "github.com/openshift/api/console/v1"
40+
_ "github.com/openshift/api/console/v1/zz_generated.crd-manifests"
4041

4142
remediationv1alpha1 "github.com/medik8s/node-healthcheck-operator/api/v1alpha1"
4243
)
@@ -67,7 +68,7 @@ var _ = BeforeSuite(func() {
6768
testEnv = &envtest.Environment{
6869
CRDInstallOptions: envtest.CRDInstallOptions{
6970
Paths: []string{
70-
filepath.Join("..", "..", "vendor", "github.com", "openshift", "api", "console", "v1alpha1"),
71+
filepath.Join("..", "..", "vendor", "github.com", "openshift", "api", "console", "v1", "zz_generated.crd-manifests", "90_consoleplugins.crd.yaml"),
7172
filepath.Join("..", "..", "config", "crd", "bases"),
7273
},
7374
ErrorIfPathMissing: true,

controllers/machinehealthcheck_controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ func (r *MachineHealthCheckReconciler) SetupWithManager(mgr ctrl.Manager) error
9494
handler.EnqueueRequestsFromMapFunc(utils.MHCByMachineMapperFunc(mgr.GetClient(), mgr.GetLogger(), r.FeatureGates)),
9595
)
9696
bldr = bldr.WatchesRawSource(
97-
&source.Channel{Source: r.FeatureGateMHCControllerEvents},
98-
handler.EnqueueRequestsFromMapFunc(utils.MHCByFeatureGateEventMapperFunc(mgr.GetClient(), mgr.GetLogger(), r.FeatureGates)),
97+
source.Channel(r.FeatureGateMHCControllerEvents,
98+
handler.EnqueueRequestsFromMapFunc(utils.MHCByFeatureGateEventMapperFunc(mgr.GetClient(), mgr.GetLogger(), r.FeatureGates))),
9999
)
100100

101101
if controller, err := bldr.Build(r); err == nil {

controllers/machinehealthcheck_controller_test.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ func TestReconcile(t *testing.T) {
166166
ExpectedMachines: pointer.Int(1),
167167
CurrentHealthy: pointer.Int(0),
168168
RemediationsAllowed: 0,
169-
Conditions: machinev1.Conditions{
169+
Conditions: []machinev1.Condition{
170170
remediationAllowedCondition,
171171
},
172172
},
@@ -197,7 +197,7 @@ func TestReconcile(t *testing.T) {
197197
ExpectedMachines: pointer.Int(1),
198198
CurrentHealthy: pointer.Int(1),
199199
RemediationsAllowed: 1,
200-
Conditions: machinev1.Conditions{
200+
Conditions: []machinev1.Condition{
201201
remediationAllowedCondition,
202202
},
203203
},
@@ -219,7 +219,7 @@ func TestReconcile(t *testing.T) {
219219
ExpectedMachines: pointer.Int(1),
220220
CurrentHealthy: pointer.Int(0),
221221
RemediationsAllowed: 0,
222-
Conditions: machinev1.Conditions{
222+
Conditions: []machinev1.Condition{
223223
remediationAllowedCondition,
224224
},
225225
},
@@ -238,7 +238,7 @@ func TestReconcile(t *testing.T) {
238238
ExpectedMachines: pointer.Int(0),
239239
CurrentHealthy: pointer.Int(0),
240240
RemediationsAllowed: 0,
241-
Conditions: machinev1.Conditions{
241+
Conditions: []machinev1.Condition{
242242
remediationAllowedCondition,
243243
},
244244
},
@@ -257,7 +257,7 @@ func TestReconcile(t *testing.T) {
257257
ExpectedMachines: pointer.Int(0),
258258
CurrentHealthy: pointer.Int(0),
259259
RemediationsAllowed: 0,
260-
Conditions: machinev1.Conditions{
260+
Conditions: []machinev1.Condition{
261261
remediationAllowedCondition,
262262
},
263263
},
@@ -276,7 +276,7 @@ func TestReconcile(t *testing.T) {
276276
ExpectedMachines: pointer.Int(1),
277277
CurrentHealthy: pointer.Int(0),
278278
RemediationsAllowed: 0,
279-
Conditions: machinev1.Conditions{
279+
Conditions: []machinev1.Condition{
280280
remediationAllowedCondition,
281281
},
282282
},
@@ -297,7 +297,7 @@ func TestReconcile(t *testing.T) {
297297
ExpectedMachines: pointer.Int(1),
298298
CurrentHealthy: pointer.Int(0),
299299
RemediationsAllowed: 0,
300-
Conditions: machinev1.Conditions{
300+
Conditions: []machinev1.Condition{
301301
remediationAllowedCondition,
302302
},
303303
},
@@ -316,7 +316,7 @@ func TestReconcile(t *testing.T) {
316316
ExpectedMachines: pointer.Int(1),
317317
CurrentHealthy: pointer.Int(0),
318318
RemediationsAllowed: 0,
319-
Conditions: machinev1.Conditions{
319+
Conditions: []machinev1.Condition{
320320
remediationAllowedCondition,
321321
},
322322
},
@@ -335,7 +335,7 @@ func TestReconcile(t *testing.T) {
335335
ExpectedMachines: pointer.Int(1),
336336
CurrentHealthy: pointer.Int(1),
337337
RemediationsAllowed: 0,
338-
Conditions: machinev1.Conditions{
338+
Conditions: []machinev1.Condition{
339339
remediationAllowedCondition,
340340
},
341341
},
@@ -356,7 +356,7 @@ func TestReconcile(t *testing.T) {
356356
ExpectedMachines: pointer.Int(1),
357357
CurrentHealthy: pointer.Int(0),
358358
RemediationsAllowed: 0,
359-
Conditions: machinev1.Conditions{
359+
Conditions: []machinev1.Condition{
360360
{
361361
Type: machinev1.RemediationAllowedCondition,
362362
Status: corev1.ConditionFalse,
@@ -419,7 +419,7 @@ func TestReconcileExternalRemediationTemplate(t *testing.T) {
419419
ExpectedMachines: pointer.Int(1),
420420
CurrentHealthy: pointer.Int(1),
421421
RemediationsAllowed: 1,
422-
Conditions: machinev1.Conditions{
422+
Conditions: []machinev1.Condition{
423423
remediationAllowedCondition,
424424
},
425425
},
@@ -441,7 +441,7 @@ func TestReconcileExternalRemediationTemplate(t *testing.T) {
441441
ExpectedMachines: pointer.Int(1),
442442
CurrentHealthy: pointer.Int(0),
443443
RemediationsAllowed: 0,
444-
Conditions: machinev1.Conditions{
444+
Conditions: []machinev1.Condition{
445445
remediationAllowedCondition,
446446
},
447447
},
@@ -463,7 +463,7 @@ func TestReconcileExternalRemediationTemplate(t *testing.T) {
463463
ExpectedMachines: pointer.Int(1),
464464
CurrentHealthy: pointer.Int(0),
465465
RemediationsAllowed: 0,
466-
Conditions: machinev1.Conditions{
466+
Conditions: []machinev1.Condition{
467467
remediationAllowedCondition,
468468
},
469469
},
@@ -485,7 +485,7 @@ func TestReconcileExternalRemediationTemplate(t *testing.T) {
485485
ExpectedMachines: pointer.Int(1),
486486
CurrentHealthy: pointer.Int(0),
487487
RemediationsAllowed: 0,
488-
Conditions: machinev1.Conditions{
488+
Conditions: []machinev1.Condition{
489489
remediationAllowedCondition,
490490
},
491491
},

controllers/nodehealthcheck_controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ func (r *NodeHealthCheckReconciler) SetupWithManager(mgr ctrl.Manager) error {
109109
),
110110
).
111111
WatchesRawSource(
112-
&source.Channel{Source: r.MHCEvents},
113-
handler.EnqueueRequestsFromMapFunc(utils.NHCByMHCEventMapperFunc(mgr.GetClient(), mgr.GetLogger())),
112+
source.Channel(r.MHCEvents,
113+
handler.EnqueueRequestsFromMapFunc(utils.NHCByMHCEventMapperFunc(mgr.GetClient(), mgr.GetLogger()))),
114114
).
115115
Build(r)
116116

controllers/resources/watch.go

Lines changed: 37 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package resources
22

33
import (
4+
"context"
45
"sync"
56

67
"github.com/go-logr/logr"
@@ -13,6 +14,7 @@ import (
1314
"sigs.k8s.io/controller-runtime/pkg/event"
1415
"sigs.k8s.io/controller-runtime/pkg/handler"
1516
"sigs.k8s.io/controller-runtime/pkg/predicate"
17+
"sigs.k8s.io/controller-runtime/pkg/reconcile"
1618
"sigs.k8s.io/controller-runtime/pkg/source"
1719

1820
"github.com/openshift/api/machine/v1beta1"
@@ -103,16 +105,24 @@ func (wm *watchManager) addRemediationTemplateCRWatch(templateCR *unstructured.U
103105
mapperFunc = utils.MHCByRemediationTemplateCRMapperFunc(wm.client, wm.log)
104106
}
105107

106-
if err := wm.controller.Watch(
107-
source.Kind(wm.cache, templateCR),
108-
handler.EnqueueRequestsFromMapFunc(mapperFunc),
109-
predicate.Funcs{
110-
// we are just interested in update and delete events for now
111-
// template CR updates: validate
112-
// template CR deletion: update NHC/MHC status
113-
CreateFunc: func(_ event.CreateEvent) bool { return false },
114-
GenericFunc: func(_ event.GenericEvent) bool { return false },
108+
// Create typed handler using the mapper function
109+
typedHandler := handler.TypedEnqueueRequestsFromMapFunc[*unstructured.Unstructured](
110+
func(ctx context.Context, obj *unstructured.Unstructured) []reconcile.Request {
111+
return mapperFunc(ctx, obj)
115112
},
113+
)
114+
115+
if err := wm.controller.Watch(
116+
source.Kind(wm.cache, templateCR,
117+
typedHandler,
118+
predicate.TypedFuncs[*unstructured.Unstructured]{
119+
// we are just interested in update and delete events for now
120+
// template CR updates: validate
121+
// template CR deletion: update NHC/MHC status
122+
CreateFunc: func(_ event.TypedCreateEvent[*unstructured.Unstructured]) bool { return false },
123+
GenericFunc: func(_ event.TypedGenericEvent[*unstructured.Unstructured]) bool { return false },
124+
},
125+
),
116126
); err != nil {
117127
return err
118128
}
@@ -130,16 +140,25 @@ func (wm *watchManager) addRemediationCRWatch(remediationCR *unstructured.Unstru
130140
return nil
131141
}
132142

133-
if err := wm.controller.Watch(
134-
source.Kind(wm.cache, remediationCR),
135-
handler.EnqueueRequestsFromMapFunc(utils.RemediationCRMapperFunc(wm.log, watchType)),
136-
predicate.Funcs{
137-
// we are just interested in update and delete events for now
138-
// remediation CR update: watch conditions
139-
// remediation CR deletion: clean up
140-
CreateFunc: func(_ event.CreateEvent) bool { return false },
141-
GenericFunc: func(_ event.GenericEvent) bool { return false },
143+
// Create typed handler using the mapper function
144+
mapperFunc := utils.RemediationCRMapperFunc(wm.log, watchType)
145+
typedHandler := handler.TypedEnqueueRequestsFromMapFunc[*unstructured.Unstructured](
146+
func(ctx context.Context, obj *unstructured.Unstructured) []reconcile.Request {
147+
return mapperFunc(ctx, obj)
142148
},
149+
)
150+
151+
if err := wm.controller.Watch(
152+
source.Kind(wm.cache, remediationCR,
153+
typedHandler,
154+
predicate.TypedFuncs[*unstructured.Unstructured]{
155+
// we are just interested in update and delete events for now
156+
// remediation CR update: watch conditions
157+
// remediation CR deletion: clean up
158+
CreateFunc: func(_ event.TypedCreateEvent[*unstructured.Unstructured]) bool { return false },
159+
GenericFunc: func(_ event.TypedGenericEvent[*unstructured.Unstructured]) bool { return false },
160+
},
161+
),
143162
); err != nil {
144163
return err
145164
}

0 commit comments

Comments
 (0)