@@ -18,19 +18,14 @@ import (
1818 azuretypes "github.com/gardener/gardener-extension-provider-azure/pkg/azure"
1919)
2020
21- // MutateFunc is a function that can perform a mutation on Infrastructure objects.
22- type MutateFunc func (ctx context.Context , logger logr.Logger , new , old * extensionsv1alpha1.Infrastructure ) error
23-
2421type layoutMutator struct {
25- logger logr.Logger
26- mutateFunc MutateFunc
22+ logger logr.Logger
2723}
2824
29- // NewLayoutMutator returns a new Infrastructure layoutMutator that uses mutateFunc to perform the mutation.
30- func NewLayoutMutator (logger logr.Logger , mutateFunc MutateFunc ) extensionswebhook.Mutator {
25+ // newLayoutMutator returns a new Infrastructure layoutMutator
26+ func newLayoutMutator (logger logr.Logger ) extensionswebhook.Mutator {
3127 return & layoutMutator {
32- logger : logger ,
33- mutateFunc : mutateFunc ,
28+ logger : logger ,
3429 }
3530}
3631
@@ -58,11 +53,11 @@ func (m *layoutMutator) Mutate(ctx context.Context, new, old client.Object) erro
5853 return fmt .Errorf ("could not mutate: object is not of type Infrastructure" )
5954 }
6055
61- return m . mutateFunc (ctx , m .logger , newInfra , oldInfra )
56+ return mutate (ctx , m .logger , newInfra , oldInfra )
6257}
6358
64- // NetworkLayoutMigrationMutate annotates the infrastructure object with additonal information that are necessary during the reconciliation when migrating to a new network layout.
65- func NetworkLayoutMigrationMutate (_ context.Context , logger logr.Logger , newInfra , oldInfra * extensionsv1alpha1.Infrastructure ) error {
59+ // mutate annotates the infrastructure object with additional information that are necessary during the reconciliation when migrating to a new network layout.
60+ func mutate (_ context.Context , logger logr.Logger , newInfra , oldInfra * extensionsv1alpha1.Infrastructure ) error {
6661 var (
6762 newProviderCfg , oldProviderCfg * azure.InfrastructureConfig
6863 oldProviderStatus * azure.InfrastructureStatus
@@ -78,8 +73,8 @@ func NetworkLayoutMigrationMutate(_ context.Context, logger logr.Logger, newInfr
7873 return fmt .Errorf ("could not mutate object: %v" , err )
7974 }
8075
81- // if newInfra already contains the zone migration annotation, check if it is still necessary. Otherwise, remove the
82- // the annotation.
76+ // if newInfra already contains the zone migration annotation, check if it is still necessary.
77+ // Otherwise, remove the annotation.
8378 if z , ok := newInfra .Annotations [azuretypes .NetworkLayoutZoneMigrationAnnotation ]; ok {
8479 findMatchingZone := false
8580 for _ , zone := range newProviderCfg .Networks .Zones {
0 commit comments