Skip to content

Commit 5233ba6

Browse files
committed
fix: use a new version for control-plane and worker mutation handlers
Previously, the addition of the noderegistration handler and API defaults caused a rollout of all Machines when CAREN was upgraded.
1 parent e9b3fbe commit 5233ba6

File tree

21 files changed

+129
-29
lines changed

21 files changed

+129
-29
lines changed

README.md

+19
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,23 @@ See [upstream documentation](https://cluster-api.sigs.k8s.io/tasks/experimental-
1111

1212
## Development
1313

14+
### Implementing Topology Mutation Handler
15+
16+
See examples of existing [topology mutation handlers] in the `pkg/handlers/../mutation/` directory.
17+
When adding a new handler, or modifying an existing one, pay close attention to what happens to existing clusters
18+
when a new version of this extension is deployed in the management cluster,
19+
and avoid rollouts of Machines in those existing clusters.
20+
21+
During CAPI provider upgrades, and periodically, all managed clusters are reconciled and mutation handler patches
22+
are applied.
23+
Any new handlers that return a new set of patches, or updated handlers that return a different set of patches,
24+
will be applied causing a rollout of Machines in all managed clusters.
25+
26+
For example, when adding a new handler, a handler that is enabled by default and returns CAPI resources patches,
27+
will cause a rollout of Machines.
28+
Similarly, if a handler is modified to return a different set of patches, it will also cause a rollout of Machines.
29+
30+
### Run Locally
1431
Install tools
1532

1633
- [Devbox](https://github.com/jetpack-io/devbox?tab=readme-ov-file#installing-devbox)
@@ -153,3 +170,5 @@ To delete the dev KinD cluster, run:
153170
```shell
154171
make kind.delete
155172
```
173+
174+
[topology mutation handlers]: https://cluster-api.sigs.k8s.io/tasks/experimental-features/runtime-sdk/implement-topology-mutation-hook#implementing-topology-mutation-hook-runtime-extensions

charts/cluster-api-runtime-extensions-nutanix/defaultclusterclasses/aws-cluster-class.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ spec:
2727
name: cluster-config
2828
- external:
2929
discoverVariablesExtension: awsworkerconfigvars-dv.cluster-api-runtime-extensions-nutanix
30-
generateExtension: awsworkerconfigpatch-gp.cluster-api-runtime-extensions-nutanix
30+
generateExtension: awsworkerv3configpatch-gp.cluster-api-runtime-extensions-nutanix
3131
name: worker-config
3232
- definitions:
3333
- jsonPatches:

charts/cluster-api-runtime-extensions-nutanix/defaultclusterclasses/docker-cluster-class.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ spec:
3535
name: cluster-config
3636
- external:
3737
discoverVariablesExtension: dockerworkerconfigvars-dv.cluster-api-runtime-extensions-nutanix
38-
generateExtension: dockerworkerconfigpatch-gp.cluster-api-runtime-extensions-nutanix
38+
generateExtension: dockerworkerv3configpatch-gp.cluster-api-runtime-extensions-nutanix
3939
name: worker-config
4040
workers:
4141
machineDeployments:

charts/cluster-api-runtime-extensions-nutanix/defaultclusterclasses/nutanix-cluster-class.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ spec:
7171
name: cluster-config
7272
- external:
7373
discoverVariablesExtension: nutanixworkerconfigvars-dv.cluster-api-runtime-extensions-nutanix
74-
generateExtension: nutanixworkerconfigpatch-gp.cluster-api-runtime-extensions-nutanix
74+
generateExtension: nutanixworkerv3configpatch-gp.cluster-api-runtime-extensions-nutanix
7575
name: worker-config
7676
workers:
7777
machineDeployments:

docs/content/getting-started/integrating-with-your-clusterclass/_index.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ The required values are shown below per provider.
2121
patches:
2222
- external:
2323
discoverVariablesExtension: awsclusterconfigvars.cluster-api-runtime-extensions-nutanix
24-
generateExtension: awsclusterconfigpatch.cluster-api-runtime-extensions-nutanix
24+
generateExtension: awsclusterv3configpatch.cluster-api-runtime-extensions-nutanix
2525
name: cluster-config
2626
- external:
2727
discoverVariablesExtension: awsworkerconfigvars.cluster-api-runtime-extensions-nutanix
28-
generateExtension: awsworkerconfigpatch.cluster-api-runtime-extensions-nutanix
28+
generateExtension: awsworkerv3configpatch.cluster-api-runtime-extensions-nutanix
2929
name: worker-config
3030
```
3131
@@ -35,11 +35,11 @@ The required values are shown below per provider.
3535
patches:
3636
- external:
3737
discoverVariablesExtension: nutanixclusterconfigvars.cluster-api-runtime-extensions-nutanix
38-
generateExtension: nutanixclusterconfigpatch.cluster-api-runtime-extensions-nutanix
38+
generateExtension: nutanixclusterv3configpatch.cluster-api-runtime-extensions-nutanix
3939
name: cluster-config
4040
- external:
4141
discoverVariablesExtension: nutanixworkerconfigvars.cluster-api-runtime-extensions-nutanix
42-
generateExtension: nutanixworkerconfigpatch.cluster-api-runtime-extensions-nutanix
42+
generateExtension: nutanixworkerv3configpatch.cluster-api-runtime-extensions-nutanix
4343
name: worker-config
4444
```
4545
@@ -49,11 +49,11 @@ The required values are shown below per provider.
4949
patches:
5050
- external:
5151
discoverVariablesExtension: dockerclusterconfigvars.cluster-api-runtime-extensions-nutanix
52-
generateExtension: dockerclusterconfigpatch.cluster-api-runtime-extensions-nutanix
52+
generateExtension: dockerclusterv3configpatch.cluster-api-runtime-extensions-nutanix
5353
name: cluster-config
5454
- external:
5555
discoverVariablesExtension: dockerworkerconfigvars.cluster-api-runtime-extensions-nutanix
56-
generateExtension: dockerworkerconfigpatch.cluster-api-runtime-extensions-nutanix
56+
generateExtension: dockerworkerv3configpatch.cluster-api-runtime-extensions-nutanix
5757
name: worker-config
5858
```
5959
@@ -63,7 +63,7 @@ The required values are shown below per provider.
6363
patches:
6464
- external:
6565
discoverVariablesExtension: genericclusterconfigvars.cluster-api-runtime-extensions-nutanix
66-
generateExtension: genericclusterconfigpatch.cluster-api-runtime-extensions-nutanix
66+
generateExtension: genericclusterv3configpatch.cluster-api-runtime-extensions-nutanix
6767
name: cluster-config
6868
```
6969

hack/examples/overlays/clusterclasses/aws/kustomization.yaml.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ patches:
2323
discoverVariablesExtension: "awsclusterconfigvars-dv.cluster-api-runtime-extensions-nutanix"
2424
- name: "worker-config"
2525
external:
26-
generateExtension: "awsworkerconfigpatch-gp.cluster-api-runtime-extensions-nutanix"
26+
generateExtension: "awsworkerv3configpatch-gp.cluster-api-runtime-extensions-nutanix"
2727
discoverVariablesExtension: "awsworkerconfigvars-dv.cluster-api-runtime-extensions-nutanix"
2828
- name: identityRef
2929
definitions:

hack/examples/overlays/clusterclasses/docker/kustomization.yaml.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ patches:
2323
discoverVariablesExtension: "dockerclusterconfigvars-dv.cluster-api-runtime-extensions-nutanix"
2424
- name: "worker-config"
2525
external:
26-
generateExtension: "dockerworkerconfigpatch-gp.cluster-api-runtime-extensions-nutanix"
26+
generateExtension: "dockerworkerv3configpatch-gp.cluster-api-runtime-extensions-nutanix"
2727
discoverVariablesExtension: "dockerworkerconfigvars-dv.cluster-api-runtime-extensions-nutanix"

hack/examples/overlays/clusterclasses/nutanix/kustomization.yaml.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ patches:
2323
discoverVariablesExtension: "nutanixclusterconfigvars-dv.cluster-api-runtime-extensions-nutanix"
2424
- name: "worker-config"
2525
external:
26-
generateExtension: "nutanixworkerconfigpatch-gp.cluster-api-runtime-extensions-nutanix"
26+
generateExtension: "nutanixworkerv3configpatch-gp.cluster-api-runtime-extensions-nutanix"
2727
discoverVariablesExtension: "nutanixworkerconfigvars-dv.cluster-api-runtime-extensions-nutanix"

pkg/handlers/aws/handlers.go

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ func (h *Handlers) AllHandlers(mgr manager.Manager) []handlers.Named {
3030
awsmutation.MetaPatchHandler(mgr),
3131
v2awsmutation.MetaPatchHandler(mgr),
3232
awsmutation.MetaWorkerPatchHandler(mgr),
33+
v2awsmutation.MetaWorkerPatchHandler(mgr),
3334
}
3435
}
3536

pkg/handlers/aws/mutation/metapatch_handler.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func MetaWorkerPatchHandler(mgr manager.Manager) handlers.Named {
5252
patchHandlers = append(patchHandlers, genericmutation.WorkerMetaMutators()...)
5353

5454
return mutation.NewMetaGeneratePatchesHandler(
55-
"awsWorkerConfigPatch",
55+
"awsWorkerv3ConfigPatch",
5656
mgr.GetClient(),
5757
patchHandlers...,
5858
)

pkg/handlers/docker/handlers.go

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ func (h *Handlers) AllHandlers(mgr manager.Manager) []handlers.Named {
3030
dockermutation.MetaPatchHandler(mgr),
3131
v2dockermutation.MetaPatchHandler(mgr),
3232
dockermutation.MetaWorkerPatchHandler(mgr),
33+
v2dockermutation.MetaWorkerPatchHandler(mgr),
3334
}
3435
}
3536

pkg/handlers/docker/mutation/metapatch_handler.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func MetaWorkerPatchHandler(mgr manager.Manager) handlers.Named {
3535
patchHandlers = append(patchHandlers, genericmutation.WorkerMetaMutators()...)
3636

3737
return mutation.NewMetaGeneratePatchesHandler(
38-
"dockerWorkerConfigPatch",
38+
"dockerWorkerV3ConfigPatch",
3939
mgr.GetClient(),
4040
patchHandlers...,
4141
)

pkg/handlers/generic/handlers.go

+1
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,6 @@ func (h *Handlers) AllHandlers(mgr manager.Manager) []handlers.Named {
2424
genericmutation.MetaPatchHandler(mgr),
2525
v2genericmutation.MetaPatchHandler(mgr),
2626
genericmutation.MetaWorkerPatchHandler(mgr),
27+
v2genericmutation.MetaWorkerPatchHandler(mgr),
2728
}
2829
}

pkg/handlers/generic/mutation/metapatch_handler.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ func MetaPatchHandler(mgr manager.Manager) handlers.Named {
1515
patchHandlers := MetaMutators(mgr)
1616
patchHandlers = append(patchHandlers, ControlPlaneMetaMutators()...)
1717
return mutation.NewMetaGeneratePatchesHandler(
18-
"genericClusterV2ConfigPatch",
18+
"genericClusterV3ConfigPatch",
1919
mgr.GetClient(),
2020
patchHandlers...,
2121
)
@@ -26,7 +26,7 @@ func MetaWorkerPatchHandler(mgr manager.Manager) handlers.Named {
2626
patchHandlers := WorkerMetaMutators()
2727

2828
return mutation.NewMetaGeneratePatchesHandler(
29-
"genericWorkerConfigPatch",
29+
"genericWorkerV3ConfigPatch",
3030
mgr.GetClient(),
3131
patchHandlers...,
3232
)

pkg/handlers/nutanix/handlers.go

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ func (h *Handlers) AllHandlers(mgr manager.Manager) []handlers.Named {
3636
nutanixmutation.MetaPatchHandler(mgr),
3737
v2nutanixmutation.MetaPatchHandler(mgr, h.controlPlaneVirtualIPConfig),
3838
nutanixmutation.MetaWorkerPatchHandler(mgr),
39+
v2nutanixmutation.MetaWorkerPatchHandler(mgr),
3940
}
4041
}
4142

pkg/handlers/nutanix/mutation/metapatch_handler.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func MetaWorkerPatchHandler(mgr manager.Manager) handlers.Named {
4141
patchHandlers = append(patchHandlers, genericmutation.WorkerMetaMutators()...)
4242

4343
return mutation.NewMetaGeneratePatchesHandler(
44-
"nutanixWorkerConfigPatch",
44+
"nutanixWorkerV3ConfigPatch",
4545
mgr.GetClient(),
4646
patchHandlers...,
4747
)

pkg/handlers/v2/aws/mutation/metapatch_handler.go

+21-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/aws/mutation/network"
1717
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/aws/mutation/region"
1818
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/aws/mutation/securitygroups"
19-
genericmutation "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/generic/mutation"
19+
genericmutationv2 "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/v2/generic/mutation"
2020
)
2121

2222
// MetaPatchHandler returns a meta patch handler for mutating CAPA clusters.
@@ -31,12 +31,30 @@ func MetaPatchHandler(mgr manager.Manager) handlers.Named {
3131
ami.NewControlPlanePatch(),
3232
securitygroups.NewControlPlanePatch(),
3333
}
34-
patchHandlers = append(patchHandlers, genericmutation.MetaMutators(mgr)...)
35-
patchHandlers = append(patchHandlers, genericmutation.ControlPlaneMetaMutators()...)
34+
patchHandlers = append(patchHandlers, genericmutationv2.MetaMutators(mgr)...)
35+
patchHandlers = append(patchHandlers, genericmutationv2.ControlPlaneMetaMutators()...)
3636

3737
return mutation.NewMetaGeneratePatchesHandler(
3838
"awsClusterV2ConfigPatch",
3939
mgr.GetClient(),
4040
patchHandlers...,
4141
)
4242
}
43+
44+
// MetaWorkerPatchHandler returns a meta patch handler for mutating CAPA workers.
45+
func MetaWorkerPatchHandler(mgr manager.Manager) handlers.Named {
46+
patchHandlers := []mutation.MetaMutator{
47+
iaminstanceprofile.NewWorkerPatch(),
48+
instancetype.NewWorkerPatch(),
49+
ami.NewWorkerPatch(),
50+
securitygroups.NewWorkerPatch(),
51+
}
52+
patchHandlers = append(patchHandlers, genericmutationv2.WorkerMetaMutators()...)
53+
54+
// The previous handler did not have "v2" in the name.
55+
return mutation.NewMetaGeneratePatchesHandler(
56+
"awsWorkerConfigPatch",
57+
mgr.GetClient(),
58+
patchHandlers...,
59+
)
60+
}

pkg/handlers/v2/docker/mutation/metapatch_handler.go

+18-3
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,35 @@ import (
99
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/common/pkg/capi/clustertopology/handlers"
1010
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/common/pkg/capi/clustertopology/handlers/mutation"
1111
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/docker/mutation/customimage"
12-
genericmutation "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/generic/mutation"
12+
genericmutationv2 "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/v2/generic/mutation"
1313
)
1414

1515
// MetaPatchHandler returns a meta patch handler for mutating CAPD clusters.
1616
func MetaPatchHandler(mgr manager.Manager) handlers.Named {
1717
patchHandlers := []mutation.MetaMutator{
1818
customimage.NewControlPlanePatch(),
1919
}
20-
patchHandlers = append(patchHandlers, genericmutation.MetaMutators(mgr)...)
21-
patchHandlers = append(patchHandlers, genericmutation.ControlPlaneMetaMutators()...)
20+
patchHandlers = append(patchHandlers, genericmutationv2.MetaMutators(mgr)...)
21+
patchHandlers = append(patchHandlers, genericmutationv2.ControlPlaneMetaMutators()...)
2222

2323
return mutation.NewMetaGeneratePatchesHandler(
2424
"dockerClusterV2ConfigPatch",
2525
mgr.GetClient(),
2626
patchHandlers...,
2727
)
2828
}
29+
30+
// MetaWorkerPatchHandler returns a meta patch handler for mutating CAPD workers.
31+
func MetaWorkerPatchHandler(mgr manager.Manager) handlers.Named {
32+
patchHandlers := []mutation.MetaMutator{
33+
customimage.NewWorkerPatch(),
34+
}
35+
patchHandlers = append(patchHandlers, genericmutationv2.WorkerMetaMutators()...)
36+
37+
// The previous handler did not have "v2" in the name.
38+
return mutation.NewMetaGeneratePatchesHandler(
39+
"dockerWorkerConfigPatch",
40+
mgr.GetClient(),
41+
patchHandlers...,
42+
)
43+
}

pkg/handlers/v2/generic/mutation/handlers.go

+19
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/generic/mutation/imageregistries/credentials"
2222
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/generic/mutation/kubernetesimagerepository"
2323
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/generic/mutation/mirrors"
24+
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/generic/mutation/taints"
2425
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/generic/mutation/users"
2526
)
2627

@@ -54,3 +55,21 @@ func MetaMutators(mgr manager.Manager) []mutation.MetaMutator {
5455
containerdapplypatchesandrestart.NewPatch(),
5556
}
5657
}
58+
59+
func ControlPlaneMetaMutators() []mutation.MetaMutator {
60+
return []mutation.MetaMutator{
61+
taints.NewControlPlanePatch(),
62+
// Intentionally not include this patch as it was not available in previous version the hook,
63+
// and it uses an API is on by default, which causes a rollout of all Machines in all managed clusters.
64+
// noderegistration.NewControlPlanePatch(),
65+
}
66+
}
67+
68+
func WorkerMetaMutators() []mutation.MetaMutator {
69+
return []mutation.MetaMutator{
70+
taints.NewWorkerPatch(),
71+
// Intentionally not include this patch as it was not available in previous version the hook,
72+
// and it uses an API is on by default, which causes a rollout of all Machines in all managed clusters.
73+
// noderegistration.NewControlPlanePatch(),
74+
}
75+
}

pkg/handlers/v2/generic/mutation/metapatch_handler.go

+12-2
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,26 @@ import (
88

99
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/common/pkg/capi/clustertopology/handlers"
1010
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/common/pkg/capi/clustertopology/handlers/mutation"
11-
genericmutation "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/generic/mutation"
1211
)
1312

1413
// MetaPatchHandler returns a meta patch handler for mutating generic Kubernetes clusters.
1514
func MetaPatchHandler(mgr manager.Manager) handlers.Named {
1615
patchHandlers := MetaMutators(mgr)
17-
patchHandlers = append(patchHandlers, genericmutation.ControlPlaneMetaMutators()...)
16+
patchHandlers = append(patchHandlers, ControlPlaneMetaMutators()...)
1817
return mutation.NewMetaGeneratePatchesHandler(
1918
"genericClusterConfigPatch",
2019
mgr.GetClient(),
2120
patchHandlers...,
2221
)
2322
}
23+
24+
// MetaWorkerPatchHandler returns a meta patch handler for mutating generic workers.
25+
func MetaWorkerPatchHandler(mgr manager.Manager) handlers.Named {
26+
patchHandlers := WorkerMetaMutators()
27+
28+
return mutation.NewMetaGeneratePatchesHandler(
29+
"genericWorkerConfigPatch",
30+
mgr.GetClient(),
31+
patchHandlers...,
32+
)
33+
}

pkg/handlers/v2/nutanix/mutation/metapatch_handler.go

+18-3
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ import (
88

99
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/common/pkg/capi/clustertopology/handlers"
1010
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/common/pkg/capi/clustertopology/handlers/mutation"
11-
genericmutation "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/generic/mutation"
1211
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/nutanix/mutation/controlplaneendpoint"
1312
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/nutanix/mutation/machinedetails"
1413
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/nutanix/mutation/prismcentralendpoint"
14+
genericmutationv2 "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/v2/generic/mutation"
1515
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/v2/generic/mutation/controlplanevirtualip"
1616
nutanixcontrolplanevirtualip "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/v2/nutanix/mutation/controlplanevirtualip"
1717
)
@@ -24,12 +24,27 @@ func MetaPatchHandler(mgr manager.Manager, cfg *controlplanevirtualip.Config) ha
2424
prismcentralendpoint.NewPatch(),
2525
machinedetails.NewControlPlanePatch(),
2626
}
27-
patchHandlers = append(patchHandlers, genericmutation.MetaMutators(mgr)...)
28-
patchHandlers = append(patchHandlers, genericmutation.ControlPlaneMetaMutators()...)
27+
patchHandlers = append(patchHandlers, genericmutationv2.MetaMutators(mgr)...)
28+
patchHandlers = append(patchHandlers, genericmutationv2.ControlPlaneMetaMutators()...)
2929

3030
return mutation.NewMetaGeneratePatchesHandler(
3131
"nutanixClusterV2ConfigPatch",
3232
mgr.GetClient(),
3333
patchHandlers...,
3434
)
3535
}
36+
37+
// MetaWorkerPatchHandler returns a meta patch handler for mutating CAPA workers.
38+
func MetaWorkerPatchHandler(mgr manager.Manager) handlers.Named {
39+
patchHandlers := []mutation.MetaMutator{
40+
machinedetails.NewWorkerPatch(),
41+
}
42+
patchHandlers = append(patchHandlers, genericmutationv2.WorkerMetaMutators()...)
43+
44+
// The previous handler did not have "v2" in the name.
45+
return mutation.NewMetaGeneratePatchesHandler(
46+
"nutanixWorkerConfigPatch",
47+
mgr.GetClient(),
48+
patchHandlers...,
49+
)
50+
}

0 commit comments

Comments
 (0)