diff --git a/charts/cluster-api-runtime-extensions-nutanix/defaultclusterclasses/aws-cluster-class.yaml b/charts/cluster-api-runtime-extensions-nutanix/defaultclusterclasses/aws-cluster-class.yaml index c8a88077b..95e680206 100644 --- a/charts/cluster-api-runtime-extensions-nutanix/defaultclusterclasses/aws-cluster-class.yaml +++ b/charts/cluster-api-runtime-extensions-nutanix/defaultclusterclasses/aws-cluster-class.yaml @@ -23,7 +23,7 @@ spec: patches: - external: discoverVariablesExtension: awsclusterconfigvars-dv.cluster-api-runtime-extensions-nutanix - generateExtension: awsclusterconfigpatch-gp.cluster-api-runtime-extensions-nutanix + generateExtension: awsclusterv2configpatch-gp.cluster-api-runtime-extensions-nutanix name: cluster-config - external: discoverVariablesExtension: awsworkerconfigvars-dv.cluster-api-runtime-extensions-nutanix diff --git a/charts/cluster-api-runtime-extensions-nutanix/defaultclusterclasses/docker-cluster-class.yaml b/charts/cluster-api-runtime-extensions-nutanix/defaultclusterclasses/docker-cluster-class.yaml index 9c4711a58..b347e2e18 100644 --- a/charts/cluster-api-runtime-extensions-nutanix/defaultclusterclasses/docker-cluster-class.yaml +++ b/charts/cluster-api-runtime-extensions-nutanix/defaultclusterclasses/docker-cluster-class.yaml @@ -31,7 +31,7 @@ spec: patches: - external: discoverVariablesExtension: dockerclusterconfigvars-dv.cluster-api-runtime-extensions-nutanix - generateExtension: dockerclusterconfigpatch-gp.cluster-api-runtime-extensions-nutanix + generateExtension: dockerclusterv2configpatch-gp.cluster-api-runtime-extensions-nutanix name: cluster-config - external: discoverVariablesExtension: dockerworkerconfigvars-dv.cluster-api-runtime-extensions-nutanix diff --git a/hack/examples/overlays/clusterclasses/aws/kustomization.yaml.tmpl b/hack/examples/overlays/clusterclasses/aws/kustomization.yaml.tmpl index 3389a3291..adc35df72 100644 --- a/hack/examples/overlays/clusterclasses/aws/kustomization.yaml.tmpl +++ b/hack/examples/overlays/clusterclasses/aws/kustomization.yaml.tmpl @@ -19,7 +19,7 @@ patches: value: - name: "cluster-config" external: - generateExtension: "awsclusterconfigpatch-gp.cluster-api-runtime-extensions-nutanix" + generateExtension: "awsclusterv2configpatch-gp.cluster-api-runtime-extensions-nutanix" discoverVariablesExtension: "awsclusterconfigvars-dv.cluster-api-runtime-extensions-nutanix" - name: "worker-config" external: diff --git a/hack/examples/overlays/clusterclasses/docker/kustomization.yaml.tmpl b/hack/examples/overlays/clusterclasses/docker/kustomization.yaml.tmpl index 0fc8df299..1210cd5c3 100644 --- a/hack/examples/overlays/clusterclasses/docker/kustomization.yaml.tmpl +++ b/hack/examples/overlays/clusterclasses/docker/kustomization.yaml.tmpl @@ -19,7 +19,7 @@ patches: value: - name: "cluster-config" external: - generateExtension: "dockerclusterconfigpatch-gp.cluster-api-runtime-extensions-nutanix" + generateExtension: "dockerclusterv2configpatch-gp.cluster-api-runtime-extensions-nutanix" discoverVariablesExtension: "dockerclusterconfigvars-dv.cluster-api-runtime-extensions-nutanix" - name: "worker-config" external: diff --git a/pkg/handlers/aws/handlers.go b/pkg/handlers/aws/handlers.go index 11a02d234..7cdf98140 100644 --- a/pkg/handlers/aws/handlers.go +++ b/pkg/handlers/aws/handlers.go @@ -11,6 +11,7 @@ import ( awsclusterconfig "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/aws/clusterconfig" awsmutation "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/aws/mutation" awsworkerconfig "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/aws/workerconfig" + deleteinv0280awsmutation "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/deleteinv0280/aws/mutation" "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/options" ) @@ -27,6 +28,7 @@ func (h *Handlers) AllHandlers(mgr manager.Manager) []handlers.Named { awsclusterconfig.NewVariable(), awsworkerconfig.NewVariable(), awsmutation.MetaPatchHandler(mgr), + deleteinv0280awsmutation.MetaPatchHandler(mgr), awsmutation.MetaWorkerPatchHandler(mgr), } } diff --git a/pkg/handlers/aws/mutation/metapatch_handler.go b/pkg/handlers/aws/mutation/metapatch_handler.go index 1bb2fb89c..3b37737ea 100644 --- a/pkg/handlers/aws/mutation/metapatch_handler.go +++ b/pkg/handlers/aws/mutation/metapatch_handler.go @@ -35,7 +35,7 @@ func MetaPatchHandler(mgr manager.Manager) handlers.Named { patchHandlers = append(patchHandlers, genericmutation.ControlPlaneMetaMutators()...) return mutation.NewMetaGeneratePatchesHandler( - "awsClusterConfigPatch", + "awsClusterV2ConfigPatch", mgr.GetClient(), patchHandlers..., ) diff --git a/pkg/handlers/deleteinv0280/aws/mutation/metapatch_handler.go b/pkg/handlers/deleteinv0280/aws/mutation/metapatch_handler.go new file mode 100644 index 000000000..a844f3673 --- /dev/null +++ b/pkg/handlers/deleteinv0280/aws/mutation/metapatch_handler.go @@ -0,0 +1,43 @@ +// Copyright 2025 Nutanix. All rights reserved. +// SPDX-License-Identifier: Apache-2.0 + +package mutation + +import ( + "sigs.k8s.io/controller-runtime/pkg/manager" + + "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/common/pkg/capi/clustertopology/handlers" + "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/common/pkg/capi/clustertopology/handlers/mutation" + "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/aws/mutation/ami" + "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/aws/mutation/cni/calico" + "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/aws/mutation/controlplaneloadbalancer" + "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/aws/mutation/iaminstanceprofile" + "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/aws/mutation/instancetype" + "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/aws/mutation/network" + "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/aws/mutation/region" + "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/aws/mutation/securitygroups" + deleteinv0280genericmutation "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/deleteinv0280/generic/mutation" + genericmutation "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/generic/mutation" +) + +// MetaPatchHandler returns a meta patch handler for mutating CAPA clusters. +func MetaPatchHandler(mgr manager.Manager) handlers.Named { + patchHandlers := []mutation.MetaMutator{ + calico.NewPatch(), + region.NewPatch(), + network.NewPatch(), + controlplaneloadbalancer.NewPatch(), + iaminstanceprofile.NewControlPlanePatch(), + instancetype.NewControlPlanePatch(), + ami.NewControlPlanePatch(), + securitygroups.NewControlPlanePatch(), + } + patchHandlers = append(patchHandlers, deleteinv0280genericmutation.MetaMutators(mgr)...) + patchHandlers = append(patchHandlers, genericmutation.ControlPlaneMetaMutators()...) + + return mutation.NewMetaGeneratePatchesHandler( + "awsClusterConfigPatch", + mgr.GetClient(), + patchHandlers..., + ) +} diff --git a/pkg/handlers/deleteinv0280/docker/mutation/metapatch_handler.go b/pkg/handlers/deleteinv0280/docker/mutation/metapatch_handler.go new file mode 100644 index 000000000..22efa7b5e --- /dev/null +++ b/pkg/handlers/deleteinv0280/docker/mutation/metapatch_handler.go @@ -0,0 +1,29 @@ +// Copyright 2025 Nutanix. All rights reserved. +// SPDX-License-Identifier: Apache-2.0 + +package mutation + +import ( + "sigs.k8s.io/controller-runtime/pkg/manager" + + "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/common/pkg/capi/clustertopology/handlers" + "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/common/pkg/capi/clustertopology/handlers/mutation" + deleteinv0280genericmutation "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/deleteinv0280/generic/mutation" + "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/docker/mutation/customimage" + genericmutation "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/generic/mutation" +) + +// MetaPatchHandler returns a meta patch handler for mutating CAPD clusters. +func MetaPatchHandler(mgr manager.Manager) handlers.Named { + patchHandlers := []mutation.MetaMutator{ + customimage.NewControlPlanePatch(), + } + patchHandlers = append(patchHandlers, deleteinv0280genericmutation.MetaMutators(mgr)...) + patchHandlers = append(patchHandlers, genericmutation.ControlPlaneMetaMutators()...) + + return mutation.NewMetaGeneratePatchesHandler( + "dockerClusterConfigPatch", + mgr.GetClient(), + patchHandlers..., + ) +} diff --git a/pkg/handlers/deleteinv0280/generic/mutation/metapatch_handler.go b/pkg/handlers/deleteinv0280/generic/mutation/metapatch_handler.go new file mode 100644 index 000000000..d22037a14 --- /dev/null +++ b/pkg/handlers/deleteinv0280/generic/mutation/metapatch_handler.go @@ -0,0 +1,23 @@ +// Copyright 2025 Nutanix. All rights reserved. +// SPDX-License-Identifier: Apache-2.0 + +package mutation + +import ( + "sigs.k8s.io/controller-runtime/pkg/manager" + + "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/common/pkg/capi/clustertopology/handlers" + "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/common/pkg/capi/clustertopology/handlers/mutation" + genericmutation "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/generic/mutation" +) + +// MetaPatchHandler returns a meta patch handler for mutating generic Kubernetes clusters. +func MetaPatchHandler(mgr manager.Manager) handlers.Named { + patchHandlers := MetaMutators(mgr) + patchHandlers = append(patchHandlers, genericmutation.ControlPlaneMetaMutators()...) + return mutation.NewMetaGeneratePatchesHandler( + "genericClusterConfigPatch", + mgr.GetClient(), + patchHandlers..., + ) +} diff --git a/pkg/handlers/docker/handlers.go b/pkg/handlers/docker/handlers.go index d96478af5..da2a60aff 100644 --- a/pkg/handlers/docker/handlers.go +++ b/pkg/handlers/docker/handlers.go @@ -8,6 +8,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/manager" "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/common/pkg/capi/clustertopology/handlers" + deleteinv0280dockermutation "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/deleteinv0280/docker/mutation" dockerclusterconfig "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/docker/clusterconfig" dockermutation "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/docker/mutation" 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 { dockerclusterconfig.NewVariable(), dockerworkerconfig.NewVariable(), dockermutation.MetaPatchHandler(mgr), + deleteinv0280dockermutation.MetaPatchHandler(mgr), dockermutation.MetaWorkerPatchHandler(mgr), } } diff --git a/pkg/handlers/docker/mutation/metapatch_handler.go b/pkg/handlers/docker/mutation/metapatch_handler.go index aef6b54a0..a1c2dc2f4 100644 --- a/pkg/handlers/docker/mutation/metapatch_handler.go +++ b/pkg/handlers/docker/mutation/metapatch_handler.go @@ -21,7 +21,7 @@ func MetaPatchHandler(mgr manager.Manager) handlers.Named { patchHandlers = append(patchHandlers, genericmutation.ControlPlaneMetaMutators()...) return mutation.NewMetaGeneratePatchesHandler( - "dockerClusterConfigPatch", + "dockerClusterV2ConfigPatch", mgr.GetClient(), patchHandlers..., ) diff --git a/pkg/handlers/generic/handlers.go b/pkg/handlers/generic/handlers.go index b8728065d..5d6ce9426 100644 --- a/pkg/handlers/generic/handlers.go +++ b/pkg/handlers/generic/handlers.go @@ -7,6 +7,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/manager" "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/common/pkg/capi/clustertopology/handlers" + deleteinv0280genericmutation "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/deleteinv0280/generic/mutation" genericclusterconfig "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/generic/clusterconfig" genericmutation "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/generic/mutation" ) @@ -21,6 +22,7 @@ func (h *Handlers) AllHandlers(mgr manager.Manager) []handlers.Named { return []handlers.Named{ genericclusterconfig.NewVariable(), genericmutation.MetaPatchHandler(mgr), + deleteinv0280genericmutation.MetaPatchHandler(mgr), genericmutation.MetaWorkerPatchHandler(mgr), } } diff --git a/pkg/handlers/generic/mutation/metapatch_handler.go b/pkg/handlers/generic/mutation/metapatch_handler.go index adff84088..95cdbea04 100644 --- a/pkg/handlers/generic/mutation/metapatch_handler.go +++ b/pkg/handlers/generic/mutation/metapatch_handler.go @@ -15,7 +15,7 @@ func MetaPatchHandler(mgr manager.Manager) handlers.Named { patchHandlers := MetaMutators(mgr) patchHandlers = append(patchHandlers, ControlPlaneMetaMutators()...) return mutation.NewMetaGeneratePatchesHandler( - "genericClusterConfigPatch", + "genericClusterV2ConfigPatch", mgr.GetClient(), patchHandlers..., )