Skip to content

Commit

Permalink
Remove deprecated code to prepare branch for release 1.9
Browse files Browse the repository at this point in the history
  • Loading branch information
Ankitasw committed Oct 25, 2023
1 parent c2b813c commit 99799d7
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 38 deletions.
11 changes: 0 additions & 11 deletions controllers/vspherecluster_reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,6 @@ import (
infrautilv1 "sigs.k8s.io/cluster-api-provider-vsphere/pkg/util"
)

// legacyIdentityFinalizer is deprecated and should be used only while upgrading the cluster
// from v1alpha3(v.0.7).
//
// Deprecated: legacyIdentityFinalizer will be removed in a future release.
const legacyIdentityFinalizer string = "identity/infrastructure.cluster.x-k8s.io"

type clusterReconciler struct {
ControllerManagerContext *capvcontext.ControllerManagerContext
Client client.Client
Expand Down Expand Up @@ -210,11 +204,6 @@ func (r *clusterReconciler) reconcileDelete(ctx context.Context, clusterCtx *cap
log.Info(fmt.Sprintf("Removing finalizer from Secret %s/%s having finalizers %v", secret.Namespace, secret.Name, secret.Finalizers))
ctrlutil.RemoveFinalizer(secret, infrav1.SecretIdentitySetFinalizer)

// Check if the old finalizer(from v0.7) is present, if yes, delete it
// For more context, please refer: https://github.com/kubernetes-sigs/cluster-api-provider-vsphere/issues/1482
if ctrlutil.ContainsFinalizer(secret, legacyIdentityFinalizer) {
ctrlutil.RemoveFinalizer(secret, legacyIdentityFinalizer)
}
if err := r.Client.Update(ctx, secret); err != nil {
return reconcile.Result{}, err
}
Expand Down
14 changes: 0 additions & 14 deletions controllers/vspherecluster_reconciler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,25 +334,11 @@ var _ = Describe("VIM based VSphere ClusterReconciler", func() {
By("deleting the vspherecluster which has the secret with legacy finalizer")
Expect(testEnv.Delete(ctx, instance)).To(Succeed())

By("checking that the secret is deleted")
secretKey := client.ObjectKey{Namespace: secret.Namespace, Name: secret.Name}
Eventually(func() bool {
err := testEnv.Get(ctx, secretKey, secret)
return apierrors.IsNotFound(err)
}, timeout).Should(BeTrue())

// confirm that the VSphereCluster is deleted
Eventually(func() bool {
err := testEnv.Get(ctx, key, instance)
return apierrors.IsNotFound(err)
}, timeout).Should(BeTrue())

/*By("checking that the secret is deleted")
secretKey := client.ObjectKey{Namespace: secret.Namespace, Name: secret.Name}
Eventually(func() bool {
err := testEnv.Get(ctx, secretKey, secret)
return apierrors.IsNotFound(err)
}, timeout).Should(BeTrue())*/
})
})

Expand Down
5 changes: 0 additions & 5 deletions controllers/vsphereclusteridentity_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,6 @@ func (r clusterIdentityReconciler) reconcileDelete(ctx context.Context, identity
return err
}
log.Info(fmt.Sprintf("Removing finalizer from Secret %s/%s", secret.Namespace, secret.Name))
// Check if the old finalizer(from v0.7) is present, if yes, delete it
// For more context, please refer: https://github.com/kubernetes-sigs/cluster-api-provider-vsphere/issues/1482
if ctrlutil.ContainsFinalizer(secret, legacyIdentityFinalizer) {
ctrlutil.RemoveFinalizer(secret, legacyIdentityFinalizer)
}
ctrlutil.RemoveFinalizer(secret, infrav1.SecretIdentitySetFinalizer)
if err := r.Client.Update(ctx, secret); err != nil {
return err
Expand Down
4 changes: 0 additions & 4 deletions pkg/services/network/network_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -512,10 +512,6 @@ var _ = Describe("Network provider", func() {
testWithLabelFunc(CAPVDefaultNetworkLabel)
})

Context("with legacy default network label", func() {
testWithLabelFunc(legacyDefaultNetworkLabel)
})

})
})

Expand Down
2 changes: 1 addition & 1 deletion pkg/services/vmoperator/control_plane_endpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,9 @@ var _ = Describe("ControlPlaneEndpoint Tests", func() {
// A VirtualMachineService should be created and will wait for a VIP to be assigned
expectedAnnotations["netoperator.vmware.com/network-name"] = "dummy-network"
expectVMS = true
createDefaultNetwork(ctx, clusterCtx, c)
expectedConditions[0].Reason = vmwarev1.WaitingForLoadBalancerIPReason
expectedConditions[0].Message = waitingForVIPFailure
createDefaultNetwork(ctx, clusterCtx, c)
apiEndpoint, err = cpService.ReconcileControlPlaneEndpointService(ctx, clusterCtx, netOpProvider)
verifyOutput()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@ spec:
name: '${VSPHERE_DATACENTER}'
type: Datacenter
tagCategory: k8s-region
# autoConfigure: true
zone:
name: '${VSPHERE_COMPUTE_CLUSTER}'
type: ComputeCluster
tagCategory: k8s-zone
# autoConfigure: true
topology:
datacenter: '${VSPHERE_DATACENTER}'
# datastore is optional and should\can be set when only one compute cluster is set
Expand All @@ -28,4 +26,4 @@ spec:
server: '${VSPHERE_SERVER}'
failureDomain: "ownerreferences"
placementConstraint:
resourcePool: '${VSPHERE_RESOURCE_POOL}'
resourcePool: '${VSPHERE_RESOURCE_POOL}'

0 comments on commit 99799d7

Please sign in to comment.