Skip to content

Commit 556e5d3

Browse files
authored
Merge pull request #11679 from mboersma/remove-infra-machine-naming
⚠️ Remove deprecated flag for old infra machine naming
2 parents da9bc79 + f54d6f8 commit 556e5d3

File tree

9 files changed

+42
-81
lines changed

9 files changed

+42
-81
lines changed

config/manager/manager.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ spec:
2323
- "--leader-elect"
2424
- "--diagnostics-address=${CAPI_DIAGNOSTICS_ADDRESS:=:8443}"
2525
- "--insecure-diagnostics=${CAPI_INSECURE_DIAGNOSTICS:=false}"
26-
- "--use-deprecated-infra-machine-naming=${CAPI_USE_DEPRECATED_INFRA_MACHINE_NAMING:=false}"
2726
- "--feature-gates=MachinePool=${EXP_MACHINE_POOL:=true},ClusterResourceSet=${EXP_CLUSTER_RESOURCE_SET:=true},ClusterTopology=${CLUSTER_TOPOLOGY:=false},RuntimeSDK=${EXP_RUNTIME_SDK:=false},MachineSetPreflightChecks=${EXP_MACHINE_SET_PREFLIGHT_CHECKS:=true},MachineWaitForVolumeDetachConsiderVolumeAttachments=${EXP_MACHINE_WAITFORVOLUMEDETACH_CONSIDER_VOLUMEATTACHMENTS:=true},PriorityQueue=${EXP_PRIORITY_QUEUE:=false}"
2827
image: controller:latest
2928
name: manager

controllers/alias.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,18 +92,14 @@ type MachineSetReconciler struct {
9292

9393
// WatchFilterValue is the label value used to filter events prior to reconciliation.
9494
WatchFilterValue string
95-
96-
// Deprecated: DeprecatedInfraMachineNaming. Name the InfraStructureMachines after the InfraMachineTemplate.
97-
DeprecatedInfraMachineNaming bool
9895
}
9996

10097
func (r *MachineSetReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, options controller.Options) error {
10198
return (&machinesetcontroller.Reconciler{
102-
Client: r.Client,
103-
APIReader: r.APIReader,
104-
ClusterCache: r.ClusterCache,
105-
WatchFilterValue: r.WatchFilterValue,
106-
DeprecatedInfraMachineNaming: r.DeprecatedInfraMachineNaming,
99+
Client: r.Client,
100+
APIReader: r.APIReader,
101+
ClusterCache: r.ClusterCache,
102+
WatchFilterValue: r.WatchFilterValue,
107103
}).SetupWithManager(ctx, mgr, options)
108104
}
109105

controlplane/kubeadm/config/manager/manager.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ spec:
2222
- "--leader-elect"
2323
- "--diagnostics-address=${CAPI_DIAGNOSTICS_ADDRESS:=:8443}"
2424
- "--insecure-diagnostics=${CAPI_INSECURE_DIAGNOSTICS:=false}"
25-
- "--use-deprecated-infra-machine-naming=${CAPI_USE_DEPRECATED_INFRA_MACHINE_NAMING:=false}"
2625
- "--feature-gates=MachinePool=${EXP_MACHINE_POOL:=true},ClusterTopology=${CLUSTER_TOPOLOGY:=false},KubeadmBootstrapFormatIgnition=${EXP_KUBEADM_BOOTSTRAP_FORMAT_IGNITION:=false},PriorityQueue=${EXP_PRIORITY_QUEUE:=false}"
2726
image: controller:latest
2827
name: manager

controlplane/kubeadm/controllers/alias.go

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,17 @@ type KubeadmControlPlaneReconciler struct {
4141
WatchFilterValue string
4242

4343
RemoteConditionsGracePeriod time.Duration
44-
45-
// Deprecated: DeprecatedInfraMachineNaming. Name the InfraStructureMachines after the InfraMachineTemplate.
46-
DeprecatedInfraMachineNaming bool
4744
}
4845

4946
// SetupWithManager sets up the reconciler with the Manager.
5047
func (r *KubeadmControlPlaneReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, options controller.Options) error {
5148
return (&kubeadmcontrolplanecontrollers.KubeadmControlPlaneReconciler{
52-
Client: r.Client,
53-
SecretCachingClient: r.SecretCachingClient,
54-
ClusterCache: r.ClusterCache,
55-
EtcdDialTimeout: r.EtcdDialTimeout,
56-
EtcdCallTimeout: r.EtcdCallTimeout,
57-
WatchFilterValue: r.WatchFilterValue,
58-
RemoteConditionsGracePeriod: r.RemoteConditionsGracePeriod,
59-
DeprecatedInfraMachineNaming: r.DeprecatedInfraMachineNaming,
49+
Client: r.Client,
50+
SecretCachingClient: r.SecretCachingClient,
51+
ClusterCache: r.ClusterCache,
52+
EtcdDialTimeout: r.EtcdDialTimeout,
53+
EtcdCallTimeout: r.EtcdCallTimeout,
54+
WatchFilterValue: r.WatchFilterValue,
55+
RemoteConditionsGracePeriod: r.RemoteConditionsGracePeriod,
6056
}).SetupWithManager(ctx, mgr, options)
6157
}

controlplane/kubeadm/internal/controllers/controller.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,6 @@ type KubeadmControlPlaneReconciler struct {
9191

9292
RemoteConditionsGracePeriod time.Duration
9393

94-
// Deprecated: DeprecatedInfraMachineNaming. Name the InfraStructureMachines after the InfraMachineTemplate.
95-
DeprecatedInfraMachineNaming bool
96-
9794
managementCluster internal.ManagementCluster
9895
managementClusterUncached internal.ManagementCluster
9996
ssaCache ssa.Cache

controlplane/kubeadm/internal/controllers/helpers.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import (
2828
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
2929
"k8s.io/apimachinery/pkg/types"
3030
kerrors "k8s.io/apimachinery/pkg/util/errors"
31-
"k8s.io/apiserver/pkg/storage/names"
3231
ctrl "sigs.k8s.io/controller-runtime"
3332
"sigs.k8s.io/controller-runtime/pkg/client"
3433

@@ -200,17 +199,12 @@ func (r *KubeadmControlPlaneReconciler) cloneConfigsAndGenerateMachine(ctx conte
200199
UID: kcp.UID,
201200
}
202201

203-
infraMachineName := machine.Name
204-
if r.DeprecatedInfraMachineNaming {
205-
infraMachineName = names.SimpleNameGenerator.GenerateName(kcp.Spec.MachineTemplate.InfrastructureRef.Name + "-")
206-
}
207-
208202
// Clone the infrastructure template
209203
infraRef, err := external.CreateFromTemplate(ctx, &external.CreateFromTemplateInput{
210204
Client: r.Client,
211205
TemplateRef: &kcp.Spec.MachineTemplate.InfrastructureRef,
212206
Namespace: kcp.Namespace,
213-
Name: infraMachineName,
207+
Name: machine.Name,
214208
OwnerRef: infraCloneOwner,
215209
ClusterName: cluster.Name,
216210
Labels: internal.ControlPlaneMachineLabelsForCluster(kcp, cluster.Name),

controlplane/kubeadm/main.go

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,11 @@ var (
9393
managerOptions = flags.ManagerOptions{}
9494
logOptions = logs.NewOptions()
9595
// KCP specific flags.
96-
remoteConditionsGracePeriod time.Duration
97-
kubeadmControlPlaneConcurrency int
98-
clusterCacheConcurrency int
99-
etcdDialTimeout time.Duration
100-
etcdCallTimeout time.Duration
101-
useDeprecatedInfraMachineNaming bool
96+
remoteConditionsGracePeriod time.Duration
97+
kubeadmControlPlaneConcurrency int
98+
clusterCacheConcurrency int
99+
etcdDialTimeout time.Duration
100+
etcdCallTimeout time.Duration
102101
)
103102

104103
func init() {
@@ -186,10 +185,6 @@ func InitFlags(fs *pflag.FlagSet) {
186185
fs.DurationVar(&etcdCallTimeout, "etcd-call-timeout-duration", etcd.DefaultCallTimeout,
187186
"Duration that the etcd client waits at most for read and write operations to etcd.")
188187

189-
fs.BoolVar(&useDeprecatedInfraMachineNaming, "use-deprecated-infra-machine-naming", false,
190-
"Use the deprecated naming convention for infra machines where they are named after the InfraMachineTemplate.")
191-
_ = fs.MarkDeprecated("use-deprecated-infra-machine-naming", "This flag will be removed in v1.10.")
192-
193188
flags.AddManagerOptions(fs, &managerOptions)
194189

195190
feature.MutableGates.AddFlag(fs)
@@ -393,14 +388,13 @@ func setupReconcilers(ctx context.Context, mgr ctrl.Manager) {
393388
}
394389

395390
if err := (&kubeadmcontrolplanecontrollers.KubeadmControlPlaneReconciler{
396-
Client: mgr.GetClient(),
397-
SecretCachingClient: secretCachingClient,
398-
ClusterCache: clusterCache,
399-
WatchFilterValue: watchFilterValue,
400-
EtcdDialTimeout: etcdDialTimeout,
401-
EtcdCallTimeout: etcdCallTimeout,
402-
RemoteConditionsGracePeriod: remoteConditionsGracePeriod,
403-
DeprecatedInfraMachineNaming: useDeprecatedInfraMachineNaming,
391+
Client: mgr.GetClient(),
392+
SecretCachingClient: secretCachingClient,
393+
ClusterCache: clusterCache,
394+
WatchFilterValue: watchFilterValue,
395+
EtcdDialTimeout: etcdDialTimeout,
396+
EtcdCallTimeout: etcdCallTimeout,
397+
RemoteConditionsGracePeriod: remoteConditionsGracePeriod,
404398
}).SetupWithManager(ctx, mgr, concurrency(kubeadmControlPlaneConcurrency)); err != nil {
405399
setupLog.Error(err, "unable to create controller", "controller", "KubeadmControlPlane")
406400
os.Exit(1)

internal/controllers/machineset/machineset_controller.go

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ import (
3434
"k8s.io/apimachinery/pkg/util/intstr"
3535
"k8s.io/apimachinery/pkg/util/sets"
3636
"k8s.io/apimachinery/pkg/util/wait"
37-
"k8s.io/apiserver/pkg/storage/names"
3837
"k8s.io/client-go/tools/record"
3938
"k8s.io/klog/v2"
4039
"k8s.io/utils/ptr"
@@ -98,9 +97,6 @@ type Reconciler struct {
9897
// WatchFilterValue is the label value used to filter events prior to reconciliation.
9998
WatchFilterValue string
10099

101-
// Deprecated: DeprecatedInfraMachineNaming. Name the InfraStructureMachines after the InfraMachineTemplate.
102-
DeprecatedInfraMachineNaming bool
103-
104100
ssaCache ssa.Cache
105101
recorder record.EventRecorder
106102
}
@@ -754,16 +750,12 @@ func (r *Reconciler) syncReplicas(ctx context.Context, s *scope) (ctrl.Result, e
754750
log = log.WithValues(bootstrapRef.Kind, klog.KRef(bootstrapRef.Namespace, bootstrapRef.Name))
755751
}
756752

757-
infraMachineName := machine.Name
758-
if r.DeprecatedInfraMachineNaming {
759-
infraMachineName = names.SimpleNameGenerator.GenerateName(ms.Spec.Template.Spec.InfrastructureRef.Name + "-")
760-
}
761753
// Create the InfraMachine.
762754
infraRef, err = external.CreateFromTemplate(ctx, &external.CreateFromTemplateInput{
763755
Client: r.Client,
764756
TemplateRef: &ms.Spec.Template.Spec.InfrastructureRef,
765757
Namespace: machine.Namespace,
766-
Name: infraMachineName,
758+
Name: machine.Name,
767759
ClusterName: machine.Spec.ClusterName,
768760
Labels: machine.Labels,
769761
Annotations: machine.Annotations,

main.go

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -112,20 +112,19 @@ var (
112112
managerOptions = flags.ManagerOptions{}
113113
logOptions = logs.NewOptions()
114114
// core Cluster API specific flags.
115-
remoteConnectionGracePeriod time.Duration
116-
remoteConditionsGracePeriod time.Duration
117-
clusterTopologyConcurrency int
118-
clusterCacheConcurrency int
119-
clusterClassConcurrency int
120-
clusterConcurrency int
121-
extensionConfigConcurrency int
122-
machineConcurrency int
123-
machineSetConcurrency int
124-
machineDeploymentConcurrency int
125-
machinePoolConcurrency int
126-
clusterResourceSetConcurrency int
127-
machineHealthCheckConcurrency int
128-
useDeprecatedInfraMachineNaming bool
115+
remoteConnectionGracePeriod time.Duration
116+
remoteConditionsGracePeriod time.Duration
117+
clusterTopologyConcurrency int
118+
clusterCacheConcurrency int
119+
clusterClassConcurrency int
120+
clusterConcurrency int
121+
extensionConfigConcurrency int
122+
machineConcurrency int
123+
machineSetConcurrency int
124+
machineDeploymentConcurrency int
125+
machinePoolConcurrency int
126+
clusterResourceSetConcurrency int
127+
machineHealthCheckConcurrency int
129128
)
130129

131130
func init() {
@@ -252,10 +251,6 @@ func InitFlags(fs *pflag.FlagSet) {
252251
fs.StringVar(&healthAddr, "health-addr", ":9440",
253252
"The address the health endpoint binds to.")
254253

255-
fs.BoolVar(&useDeprecatedInfraMachineNaming, "use-deprecated-infra-machine-naming", false,
256-
"Use deprecated infrastructure machine naming")
257-
_ = fs.MarkDeprecated("use-deprecated-infra-machine-naming", "This flag will be removed in v1.10.")
258-
259254
flags.AddManagerOptions(fs, &managerOptions)
260255

261256
feature.MutableGates.AddFlag(fs)
@@ -575,11 +570,10 @@ func setupReconcilers(ctx context.Context, mgr ctrl.Manager, watchNamespaces map
575570
os.Exit(1)
576571
}
577572
if err := (&controllers.MachineSetReconciler{
578-
Client: mgr.GetClient(),
579-
APIReader: mgr.GetAPIReader(),
580-
ClusterCache: clusterCache,
581-
WatchFilterValue: watchFilterValue,
582-
DeprecatedInfraMachineNaming: useDeprecatedInfraMachineNaming,
573+
Client: mgr.GetClient(),
574+
APIReader: mgr.GetAPIReader(),
575+
ClusterCache: clusterCache,
576+
WatchFilterValue: watchFilterValue,
583577
}).SetupWithManager(ctx, mgr, concurrency(machineSetConcurrency)); err != nil {
584578
setupLog.Error(err, "Unable to create controller", "controller", "MachineSet")
585579
os.Exit(1)

0 commit comments

Comments
 (0)