diff --git a/pkg/handlers/nutanix/handlers.go b/pkg/handlers/nutanix/handlers.go index 8115e1745..73825f376 100644 --- a/pkg/handlers/nutanix/handlers.go +++ b/pkg/handlers/nutanix/handlers.go @@ -10,30 +10,23 @@ import ( "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/common/pkg/capi/clustertopology/handlers" nutanixclusterconfig "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/nutanix/clusterconfig" nutanixmutation "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/nutanix/mutation" - "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/nutanix/mutation/controlplaneendpoint" nutanixworkerconfig "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/nutanix/workerconfig" "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/options" ) -type Handlers struct { - nutanixControlPlaneEndpointConfig *controlplaneendpoint.Config -} +type Handlers struct{} func New( - globalOptions *options.GlobalOptions, + _ *options.GlobalOptions, ) *Handlers { - return &Handlers{ - nutanixControlPlaneEndpointConfig: &controlplaneendpoint.Config{ - GlobalOptions: globalOptions, - }, - } + return &Handlers{} } func (h *Handlers) AllHandlers(mgr manager.Manager) []handlers.Named { return []handlers.Named{ nutanixclusterconfig.NewVariable(), nutanixworkerconfig.NewVariable(), - nutanixmutation.MetaPatchHandler(mgr, h.nutanixControlPlaneEndpointConfig), + nutanixmutation.MetaPatchHandler(mgr), nutanixmutation.MetaWorkerPatchHandler(mgr), } } diff --git a/pkg/handlers/nutanix/mutation/controlplaneendpoint/inject.go b/pkg/handlers/nutanix/mutation/controlplaneendpoint/inject.go index 450782488..447058336 100644 --- a/pkg/handlers/nutanix/mutation/controlplaneendpoint/inject.go +++ b/pkg/handlers/nutanix/mutation/controlplaneendpoint/inject.go @@ -22,7 +22,6 @@ import ( "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/common/pkg/capi/clustertopology/patches/selectors" "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/common/pkg/capi/clustertopology/variables" "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/generic/clusterconfig" - "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/options" ) const ( @@ -30,20 +29,13 @@ const ( VariableName = "controlPlaneEndpoint" ) -type Config struct { - *options.GlobalOptions -} - type nutanixControlPlaneEndpoint struct { - config *Config - variableName string variableFieldPath []string } -func NewPatch(cfg *Config) *nutanixControlPlaneEndpoint { +func NewPatch() *nutanixControlPlaneEndpoint { return newNutanixControlPlaneEndpoint( - cfg, clusterconfig.MetaVariableName, v1alpha1.NutanixVariableName, VariableName, @@ -51,12 +43,10 @@ func NewPatch(cfg *Config) *nutanixControlPlaneEndpoint { } func newNutanixControlPlaneEndpoint( - cfg *Config, variableName string, variableFieldPath ...string, ) *nutanixControlPlaneEndpoint { return &nutanixControlPlaneEndpoint{ - config: cfg, variableName: variableName, variableFieldPath: variableFieldPath, } diff --git a/pkg/handlers/nutanix/mutation/controlplaneendpoint/inject_test.go b/pkg/handlers/nutanix/mutation/controlplaneendpoint/inject_test.go index fdcfcdfee..30c61ceb8 100644 --- a/pkg/handlers/nutanix/mutation/controlplaneendpoint/inject_test.go +++ b/pkg/handlers/nutanix/mutation/controlplaneendpoint/inject_test.go @@ -26,7 +26,7 @@ func TestControlPlaneEndpointPatch(t *testing.T) { var _ = Describe("Generate Nutanix ControlPlane endpoint patches", func() { patchGenerator := func() mutation.GeneratePatches { - return mutation.NewMetaGeneratePatchesHandler("", helpers.TestEnv.Client, NewPatch(nil)).(mutation.GeneratePatches) + return mutation.NewMetaGeneratePatchesHandler("", helpers.TestEnv.Client, NewPatch()).(mutation.GeneratePatches) } testDefs := []capitest.PatchTestDef{ diff --git a/pkg/handlers/nutanix/mutation/metapatch_handler.go b/pkg/handlers/nutanix/mutation/metapatch_handler.go index 000919b9b..a0d26af09 100644 --- a/pkg/handlers/nutanix/mutation/metapatch_handler.go +++ b/pkg/handlers/nutanix/mutation/metapatch_handler.go @@ -15,10 +15,10 @@ import ( ) // MetaPatchHandler returns a meta patch handler for mutating CAPX clusters. -func MetaPatchHandler(mgr manager.Manager, cfg *controlplaneendpoint.Config) handlers.Named { +func MetaPatchHandler(mgr manager.Manager) handlers.Named { patchHandlers := append( []mutation.MetaMutator{ - controlplaneendpoint.NewPatch(cfg), + controlplaneendpoint.NewPatch(), prismcentralendpoint.NewPatch(), machinedetails.NewControlPlanePatch(), },