Skip to content

Commit e3f8bbc

Browse files
committed
fix: Use new patch handler for AWS and Docker ClusterClasses
This means no automatic rollout of clusters using the existing ClusterClasses and will not break any downstream project tests that might be checking for that.
1 parent fd6d3a2 commit e3f8bbc

File tree

13 files changed

+108
-7
lines changed

13 files changed

+108
-7
lines changed

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
@@ -23,7 +23,7 @@ spec:
2323
patches:
2424
- external:
2525
discoverVariablesExtension: awsclusterconfigvars-dv.cluster-api-runtime-extensions-nutanix
26-
generateExtension: awsclusterconfigpatch-gp.cluster-api-runtime-extensions-nutanix
26+
generateExtension: awsclusterv2configpatch-gp.cluster-api-runtime-extensions-nutanix
2727
name: cluster-config
2828
- external:
2929
discoverVariablesExtension: awsworkerconfigvars-dv.cluster-api-runtime-extensions-nutanix

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
@@ -31,7 +31,7 @@ spec:
3131
patches:
3232
- external:
3333
discoverVariablesExtension: dockerclusterconfigvars-dv.cluster-api-runtime-extensions-nutanix
34-
generateExtension: dockerclusterconfigpatch-gp.cluster-api-runtime-extensions-nutanix
34+
generateExtension: dockerclusterv2configpatch-gp.cluster-api-runtime-extensions-nutanix
3535
name: cluster-config
3636
- external:
3737
discoverVariablesExtension: dockerworkerconfigvars-dv.cluster-api-runtime-extensions-nutanix

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ patches:
1919
value:
2020
- name: "cluster-config"
2121
external:
22-
generateExtension: "awsclusterconfigpatch-gp.cluster-api-runtime-extensions-nutanix"
22+
generateExtension: "awsclusterv2configpatch-gp.cluster-api-runtime-extensions-nutanix"
2323
discoverVariablesExtension: "awsclusterconfigvars-dv.cluster-api-runtime-extensions-nutanix"
2424
- name: "worker-config"
2525
external:

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ patches:
1919
value:
2020
- name: "cluster-config"
2121
external:
22-
generateExtension: "dockerclusterconfigpatch-gp.cluster-api-runtime-extensions-nutanix"
22+
generateExtension: "dockerclusterv2configpatch-gp.cluster-api-runtime-extensions-nutanix"
2323
discoverVariablesExtension: "dockerclusterconfigvars-dv.cluster-api-runtime-extensions-nutanix"
2424
- name: "worker-config"
2525
external:

pkg/handlers/aws/handlers.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
awsclusterconfig "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/aws/clusterconfig"
1212
awsmutation "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/aws/mutation"
1313
awsworkerconfig "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/aws/workerconfig"
14+
deleteinv0280awsmutation "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/deleteinv0280/aws/mutation"
1415
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/options"
1516
)
1617

@@ -27,6 +28,7 @@ func (h *Handlers) AllHandlers(mgr manager.Manager) []handlers.Named {
2728
awsclusterconfig.NewVariable(),
2829
awsworkerconfig.NewVariable(),
2930
awsmutation.MetaPatchHandler(mgr),
31+
deleteinv0280awsmutation.MetaPatchHandler(mgr),
3032
awsmutation.MetaWorkerPatchHandler(mgr),
3133
}
3234
}

pkg/handlers/aws/mutation/metapatch_handler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func MetaPatchHandler(mgr manager.Manager) handlers.Named {
3535
patchHandlers = append(patchHandlers, genericmutation.ControlPlaneMetaMutators()...)
3636

3737
return mutation.NewMetaGeneratePatchesHandler(
38-
"awsClusterConfigPatch",
38+
"awsClusterV2ConfigPatch",
3939
mgr.GetClient(),
4040
patchHandlers...,
4141
)
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// Copyright 2023 Nutanix. All rights reserved.
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
package mutation
5+
6+
import (
7+
"sigs.k8s.io/controller-runtime/pkg/manager"
8+
9+
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/common/pkg/capi/clustertopology/handlers"
10+
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/common/pkg/capi/clustertopology/handlers/mutation"
11+
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/aws/mutation/ami"
12+
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/aws/mutation/cni/calico"
13+
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/aws/mutation/controlplaneloadbalancer"
14+
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/aws/mutation/iaminstanceprofile"
15+
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/aws/mutation/instancetype"
16+
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/aws/mutation/network"
17+
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/aws/mutation/region"
18+
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/aws/mutation/securitygroups"
19+
deleteinv0280genericmutation "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/deleteinv0280/generic/mutation"
20+
genericmutation "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/generic/mutation"
21+
)
22+
23+
// MetaPatchHandler returns a meta patch handler for mutating CAPA clusters.
24+
func MetaPatchHandler(mgr manager.Manager) handlers.Named {
25+
patchHandlers := []mutation.MetaMutator{
26+
calico.NewPatch(),
27+
region.NewPatch(),
28+
network.NewPatch(),
29+
controlplaneloadbalancer.NewPatch(),
30+
iaminstanceprofile.NewControlPlanePatch(),
31+
instancetype.NewControlPlanePatch(),
32+
ami.NewControlPlanePatch(),
33+
securitygroups.NewControlPlanePatch(),
34+
}
35+
patchHandlers = append(patchHandlers, deleteinv0280genericmutation.MetaMutators(mgr)...)
36+
patchHandlers = append(patchHandlers, genericmutation.ControlPlaneMetaMutators()...)
37+
38+
return mutation.NewMetaGeneratePatchesHandler(
39+
"awsClusterConfigPatch",
40+
mgr.GetClient(),
41+
patchHandlers...,
42+
)
43+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright 2023 Nutanix. All rights reserved.
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
package mutation
5+
6+
import (
7+
"sigs.k8s.io/controller-runtime/pkg/manager"
8+
9+
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/common/pkg/capi/clustertopology/handlers"
10+
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/common/pkg/capi/clustertopology/handlers/mutation"
11+
deleteinv0280genericmutation "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/deleteinv0280/generic/mutation"
12+
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/docker/mutation/customimage"
13+
genericmutation "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/generic/mutation"
14+
)
15+
16+
// MetaPatchHandler returns a meta patch handler for mutating CAPD clusters.
17+
func MetaPatchHandler(mgr manager.Manager) handlers.Named {
18+
patchHandlers := []mutation.MetaMutator{
19+
customimage.NewControlPlanePatch(),
20+
}
21+
patchHandlers = append(patchHandlers, deleteinv0280genericmutation.MetaMutators(mgr)...)
22+
patchHandlers = append(patchHandlers, genericmutation.ControlPlaneMetaMutators()...)
23+
24+
return mutation.NewMetaGeneratePatchesHandler(
25+
"dockerClusterConfigPatch",
26+
mgr.GetClient(),
27+
patchHandlers...,
28+
)
29+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Copyright 2024 Nutanix. All rights reserved.
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
package mutation
5+
6+
import (
7+
"sigs.k8s.io/controller-runtime/pkg/manager"
8+
9+
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/common/pkg/capi/clustertopology/handlers"
10+
"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"
12+
)
13+
14+
// MetaPatchHandler returns a meta patch handler for mutating generic Kubernetes clusters.
15+
func MetaPatchHandler(mgr manager.Manager) handlers.Named {
16+
patchHandlers := MetaMutators(mgr)
17+
patchHandlers = append(patchHandlers, genericmutation.ControlPlaneMetaMutators()...)
18+
return mutation.NewMetaGeneratePatchesHandler(
19+
"genericClusterConfigPatch",
20+
mgr.GetClient(),
21+
patchHandlers...,
22+
)
23+
}

pkg/handlers/docker/handlers.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"sigs.k8s.io/controller-runtime/pkg/manager"
99

1010
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/common/pkg/capi/clustertopology/handlers"
11+
deleteinv0280dockermutation "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/deleteinv0280/docker/mutation"
1112
dockerclusterconfig "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/docker/clusterconfig"
1213
dockermutation "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/docker/mutation"
1314
dockerworkerconfig "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/docker/workerconfig"
@@ -27,6 +28,7 @@ func (h *Handlers) AllHandlers(mgr manager.Manager) []handlers.Named {
2728
dockerclusterconfig.NewVariable(),
2829
dockerworkerconfig.NewVariable(),
2930
dockermutation.MetaPatchHandler(mgr),
31+
deleteinv0280dockermutation.MetaPatchHandler(mgr),
3032
dockermutation.MetaWorkerPatchHandler(mgr),
3133
}
3234
}

0 commit comments

Comments
 (0)