Skip to content

Commit e4bd10f

Browse files
Merge pull request #1346 from vr4manta/SPLAT-2078
SPLAT-2078: Removed VSphereStaticIPs feature gate
2 parents b3dc35f + 8941861 commit e4bd10f

File tree

7 files changed

+21
-60
lines changed

7 files changed

+21
-60
lines changed

cmd/machineset/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ func main() {
112112

113113
// Sets up feature gates
114114
defaultMutableGate := feature.DefaultMutableFeatureGate
115-
gateOpts, err := features.NewFeatureGateOptions(defaultMutableGate, apifeatures.SelfManaged, apifeatures.FeatureGateVSphereStaticIPs, apifeatures.FeatureGateMachineAPIMigration, apifeatures.FeatureGateVSphereHostVMGroupZonal, apifeatures.FeatureGateVSphereMultiDisk)
115+
gateOpts, err := features.NewFeatureGateOptions(defaultMutableGate, apifeatures.SelfManaged, apifeatures.FeatureGateMachineAPIMigration, apifeatures.FeatureGateVSphereHostVMGroupZonal, apifeatures.FeatureGateVSphereMultiDisk)
116116
if err != nil {
117117
klog.Fatalf("Error setting up feature gates: %v", err)
118118
}

cmd/vsphere/main.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ func main() {
9393

9494
// Sets up feature gates
9595
defaultMutableGate := feature.DefaultMutableFeatureGate
96-
gateOpts, err := features.NewFeatureGateOptions(defaultMutableGate, apifeatures.SelfManaged, apifeatures.FeatureGateVSphereStaticIPs, apifeatures.FeatureGateMachineAPIMigration, apifeatures.FeatureGateVSphereHostVMGroupZonal, apifeatures.FeatureGateVSphereMultiDisk)
96+
gateOpts, err := features.NewFeatureGateOptions(defaultMutableGate, apifeatures.SelfManaged, apifeatures.FeatureGateMachineAPIMigration, apifeatures.FeatureGateVSphereHostVMGroupZonal, apifeatures.FeatureGateVSphereMultiDisk)
9797
if err != nil {
9898
klog.Fatalf("Error setting up feature gates: %v", err)
9999
}
@@ -151,8 +151,6 @@ func main() {
151151

152152
klog.Infof("FeatureGateMachineAPIMigration initialised: %t", defaultMutableGate.Enabled(featuregate.Feature(apifeatures.FeatureGateMachineAPIMigration)))
153153

154-
staticIPFeatureGateEnabled := defaultMutableGate.Enabled(featuregate.Feature(apifeatures.FeatureGateVSphereStaticIPs))
155-
klog.Infof("FeatureGateVSphereStaticIPs initialised: %t", staticIPFeatureGateEnabled)
156154
hostVMGroupZonalFeatureGateEnabled := defaultMutableGate.Enabled(featuregate.Feature(apifeatures.FeatureGateVSphereHostVMGroupZonal))
157155
klog.Infof("FeatureGateVSphereHostVMGroupZonal initialised %t", hostVMGroupZonalFeatureGateEnabled)
158156
multiDiskFeatureGateEnabled := defaultMutableGate.Enabled(featuregate.Feature(apifeatures.FeatureGateVSphereMultiDisk))

pkg/controller/vsphere/reconciler.go

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,6 @@ func (r *Reconciler) create() error {
9696
}
9797

9898
if ipam.HasStaticIPConfiguration(r.providerSpec) {
99-
if !r.featureGates.Enabled(featuregate.Feature(apifeatures.FeatureGateVSphereStaticIPs)) {
100-
return fmt.Errorf("%v: static IP/IPAM configuration is only available with the VSphereStaticIPs feature gate", r.machine.GetName())
101-
}
102-
10399
outstandingClaims, err := ipam.HasOutstandingIPAddressClaims(
104100
r.Context,
105101
r.client,
@@ -417,13 +413,13 @@ func (r *Reconciler) delete() error {
417413
return err
418414
}
419415
klog.Infof("%v: vm does not exist", r.machine.GetName())
420-
if r.featureGates.Enabled(featuregate.Feature(apifeatures.FeatureGateVSphereStaticIPs)) {
421-
// remove any finalizers for IPAddressClaims which may be associated with the machine
422-
err = ipam.RemoveFinalizersForIPAddressClaims(r.Context, r.client, *r.machine)
423-
if err != nil {
424-
return fmt.Errorf("unable to remove finalizer for IP address claims: %w", err)
425-
}
416+
417+
// remove any finalizers for IPAddressClaims which may be associated with the machine
418+
err = ipam.RemoveFinalizersForIPAddressClaims(r.Context, r.client, *r.machine)
419+
if err != nil {
420+
return fmt.Errorf("unable to remove finalizer for IP address claims: %w", err)
426421
}
422+
427423
return nil
428424
}
429425

@@ -1031,18 +1027,16 @@ func clone(s *machineScope) (string, error) {
10311027
Value: "TRUE",
10321028
})
10331029

1034-
if s.featureGates.Enabled(featuregate.Feature(apifeatures.FeatureGateVSphereStaticIPs)) {
1035-
if ipam.HasStaticIPConfiguration(s.providerSpec) {
1036-
networkKargs, err := constructKargsFromNetworkConfig(s)
1037-
if err != nil {
1038-
return "", err
1039-
}
1040-
if len(networkKargs) > 0 {
1041-
extraConfig = append(extraConfig, &types.OptionValue{
1042-
Key: GuestInfoNetworkKargs,
1043-
Value: networkKargs,
1044-
})
1045-
}
1030+
if ipam.HasStaticIPConfiguration(s.providerSpec) {
1031+
networkKargs, err := constructKargsFromNetworkConfig(s)
1032+
if err != nil {
1033+
return "", err
1034+
}
1035+
if len(networkKargs) > 0 {
1036+
extraConfig = append(extraConfig, &types.OptionValue{
1037+
Key: GuestInfoNetworkKargs,
1038+
Value: networkKargs,
1039+
})
10461040
}
10471041
}
10481042

pkg/controller/vsphere/reconciler_test.go

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2755,33 +2755,7 @@ func TestCreate(t *testing.T) {
27552755
expectedError: errors.New("could not update VM Group membership: *types.InvalidArgument"),
27562756
},
27572757
{
2758-
name: "Fail to create machine with static IP when tech preview not enabled",
2759-
machineName: "test-2",
2760-
providerSpec: machinev1.VSphereMachineProviderSpec{
2761-
Template: vmName,
2762-
Workspace: &machinev1.Workspace{
2763-
Server: host,
2764-
},
2765-
CredentialsSecret: &corev1.LocalObjectReference{
2766-
Name: "test",
2767-
},
2768-
DiskGiB: 10,
2769-
UserDataSecret: &corev1.LocalObjectReference{
2770-
Name: userDataSecretName,
2771-
},
2772-
Network: machinev1.NetworkSpec{
2773-
Devices: staticIpAddressClaim,
2774-
},
2775-
},
2776-
featureGatesEnabled: func() map[string]bool {
2777-
fg := make(map[string]bool)
2778-
fg[string(features.FeatureGateVSphereStaticIPs)] = false
2779-
return fg
2780-
}(),
2781-
expectedError: errors.New("test-2: static IP/IPAM configuration is only available with the VSphereStaticIPs feature gate"),
2782-
},
2783-
{
2784-
name: "Successfully create machine with static IP address claims when tech preview enabled",
2758+
name: "Successfully create machine with static IP address claims",
27852759
machineName: "test-3",
27862760
providerSpec: machinev1.VSphereMachineProviderSpec{
27872761
Template: vmName,
@@ -2803,7 +2777,7 @@ func TestCreate(t *testing.T) {
28032777
ipAddress: ipAddress,
28042778
},
28052779
{
2806-
name: "Successfully create machine with static IP addresses when tech preview enabled",
2780+
name: "Successfully create machine with static IP addresses",
28072781
machineName: "test-4",
28082782
providerSpec: machinev1.VSphereMachineProviderSpec{
28092783
Template: vmName,
@@ -2823,7 +2797,7 @@ func TestCreate(t *testing.T) {
28232797
},
28242798
},
28252799
{
2826-
name: "Failed to create machine with static IP address claim when tech preview enabled due to waiting for IP",
2800+
name: "Failed to create machine with static IP address claim due to waiting for IP",
28272801
machineName: "test-5",
28282802
providerSpec: machinev1.VSphereMachineProviderSpec{
28292803
Template: vmName,

pkg/operator/operator.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,6 @@ func (optr *Operator) maoConfigFromInfrastructure() (*OperatorConfig, error) {
475475
// as args)
476476
features := map[string]bool{
477477
string(apifeatures.FeatureGateMachineAPIMigration): featureGates.Enabled(apifeatures.FeatureGateMachineAPIMigration),
478-
string(apifeatures.FeatureGateVSphereStaticIPs): featureGates.Enabled(apifeatures.FeatureGateVSphereStaticIPs),
479478
string(apifeatures.FeatureGateGCPLabelsTags): featureGates.Enabled(apifeatures.FeatureGateGCPLabelsTags),
480479
string(apifeatures.FeatureGateAzureWorkloadIdentity): featureGates.Enabled(apifeatures.FeatureGateAzureWorkloadIdentity),
481480
string(apifeatures.FeatureGateVSphereMultiDisk): featureGates.Enabled(apifeatures.FeatureGateVSphereMultiDisk),

pkg/operator/operator_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ const (
4242
var (
4343
enabledFeatureGates = []openshiftv1.FeatureGateAttributes{
4444
{Name: apifeatures.FeatureGateMachineAPIMigration},
45-
{Name: apifeatures.FeatureGateVSphereStaticIPs},
4645
{Name: apifeatures.FeatureGateGCPLabelsTags},
4746
{Name: apifeatures.FeatureGateAzureWorkloadIdentity},
4847
{Name: apifeatures.FeatureGateVSphereMultiDisk},
@@ -53,7 +52,6 @@ var (
5352
"MachineAPIMigration": true,
5453
"GCPLabelsTags": true,
5554
"AzureWorkloadIdentity": true,
56-
"VSphereStaticIPs": true,
5755
"VSphereMultiDisk": true,
5856
"VSphereHostVMGroupZonal": true,
5957
}

pkg/util/testing/testing.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,6 @@ func NewDefaultMutableFeatureGate() (featuregate.MutableFeatureGate, error) {
182182
_, err := features.NewFeatureGateOptions(defaultMutableGate,
183183
openshiftfeatures.SelfManaged,
184184
openshiftfeatures.FeatureGateMachineAPIMigration,
185-
openshiftfeatures.FeatureGateVSphereStaticIPs,
186185
openshiftfeatures.FeatureGateVSphereHostVMGroupZonal,
187186
openshiftfeatures.FeatureGateVSphereMultiDisk)
188187
if err != nil {
@@ -191,7 +190,6 @@ func NewDefaultMutableFeatureGate() (featuregate.MutableFeatureGate, error) {
191190
if err := defaultMutableGate.SetFromMap(
192191
map[string]bool{
193192
"MachineAPIMigration": true,
194-
"VSphereStaticIPs": true,
195193
"VSphereMultiDisk": true,
196194
},
197195
); err != nil {

0 commit comments

Comments
 (0)