Skip to content

Commit 90f9f0b

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 90f9f0b

File tree

21 files changed

+129
-29
lines changed

21 files changed

+129
-29
lines changed

README.md

Lines changed: 19 additions & 0 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 7 additions & 7 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 1 deletion
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
)

0 commit comments

Comments
 (0)