Skip to content

Commit

Permalink
Prepare main branch for release-1.9
Browse files Browse the repository at this point in the history
  • Loading branch information
Ankitasw committed Oct 19, 2023
1 parent c2b813c commit 3b3e99f
Show file tree
Hide file tree
Showing 21 changed files with 61 additions and 191 deletions.
5 changes: 0 additions & 5 deletions apis/v1beta1/vspherefailuredomain_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,6 @@ type FailureDomain struct {

// TagCategory is the category used for the tag
TagCategory string `json:"tagCategory"`

// AutoConfigure tags the Type which is specified in the Topology
//
// Deprecated: This field is going to be removed in a future release.
AutoConfigure *bool `json:"autoConfigure,omitempty"`
}

// Topology describes a given failure domain using vSphere constructs.
Expand Down
9 changes: 2 additions & 7 deletions apis/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion clusterctl-settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"name": "infrastructure-vsphere",
"config": {
"componentsFile": "infrastructure-components.yaml",
"nextVersion": "v1.8.0"
"nextVersion": "v1.9.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,6 @@ spec:
region:
description: Region defines the name and type of a region
properties:
autoConfigure:
description: "AutoConfigure tags the Type which is specified in
the Topology \n Deprecated: This field is going to be removed
in a future release."
type: boolean
name:
description: Name is the name of the tag that represents this
failure domain
Expand Down Expand Up @@ -105,11 +100,6 @@ spec:
zone:
description: Zone defines the name and type of a zone
properties:
autoConfigure:
description: "AutoConfigure tags the Type which is specified in
the Topology \n Deprecated: This field is going to be removed
in a future release."
type: boolean
name:
description: Name is the name of the tag that represents this
failure domain
Expand Down
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
3 changes: 0 additions & 3 deletions controllers/vspheredeploymentzone_controller_domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@ func (r vsphereDeploymentZoneReconciler) reconcileFailureDomain(ctx context.Cont
}

func (r vsphereDeploymentZoneReconciler) reconcileInfraFailureDomain(ctx context.Context, deploymentZoneCtx *capvcontext.VSphereDeploymentZoneContext, vsphereFailureDomain *infrav1.VSphereFailureDomain, failureDomain infrav1.FailureDomain) error {
if *failureDomain.AutoConfigure {
return r.createAndAttachMetadata(ctx, deploymentZoneCtx, vsphereFailureDomain, failureDomain)
}
return r.verifyFailureDomain(ctx, deploymentZoneCtx, vsphereFailureDomain, failureDomain)
}

Expand Down
49 changes: 21 additions & 28 deletions controllers/vspheredeploymentzone_controller_domain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,14 @@ func TestVsphereDeploymentZoneReconciler_Reconcile_VerifyFailureDomain_ComputeCl
vsphereFailureDomain := &infrav1.VSphereFailureDomain{
Spec: infrav1.VSphereFailureDomainSpec{
Region: infrav1.FailureDomain{
Name: "k8s-region-west",
Type: infrav1.DatacenterFailureDomain,
TagCategory: "k8s-region",
AutoConfigure: nil,
Name: "k8s-region-west",
Type: infrav1.DatacenterFailureDomain,
TagCategory: "k8s-region",
},
Zone: infrav1.FailureDomain{
Name: "k8s-region-west-2",
Type: infrav1.ComputeClusterFailureDomain,
TagCategory: "k8s-region",
AutoConfigure: nil,
Name: "k8s-region-west-2",
Type: infrav1.ComputeClusterFailureDomain,
TagCategory: "k8s-region",
},
Topology: infrav1.Topology{
Datacenter: "DC0",
Expand Down Expand Up @@ -148,16 +146,14 @@ func TestVsphereDeploymentZoneReconciler_Reconcile_VerifyFailureDomain_HostGroup
vsphereFailureDomain := &infrav1.VSphereFailureDomain{
Spec: infrav1.VSphereFailureDomainSpec{
Region: infrav1.FailureDomain{
Name: "k8s-region-west",
Type: infrav1.ComputeClusterFailureDomain,
TagCategory: "k8s-region",
AutoConfigure: nil,
Name: "k8s-region-west",
Type: infrav1.ComputeClusterFailureDomain,
TagCategory: "k8s-region",
},
Zone: infrav1.FailureDomain{
Name: "k8s-region-west-2",
Type: infrav1.HostGroupFailureDomain,
TagCategory: "k8s-region",
AutoConfigure: nil,
Name: "k8s-region-west-2",
Type: infrav1.HostGroupFailureDomain,
TagCategory: "k8s-region",
},
Topology: infrav1.Topology{
Datacenter: "DC0",
Expand Down Expand Up @@ -226,10 +222,9 @@ func TestVsphereDeploymentZoneReconciler_Reconcile_CreateAndAttachMetadata(t *te
name: "create tag + category & attach to datacenter",
vsphereFailureDomainSpec: infrav1.VSphereFailureDomainSpec{
Region: infrav1.FailureDomain{
Name: "k8s-region-west-1",
Type: infrav1.DatacenterFailureDomain,
TagCategory: "k8s-region",
AutoConfigure: nil,
Name: "k8s-region-west-1",
Type: infrav1.DatacenterFailureDomain,
TagCategory: "k8s-region",
},
Topology: infrav1.Topology{
Datacenter: "DC0",
Expand All @@ -241,10 +236,9 @@ func TestVsphereDeploymentZoneReconciler_Reconcile_CreateAndAttachMetadata(t *te
name: "create tag + category & attach to compute cluster",
vsphereFailureDomainSpec: infrav1.VSphereFailureDomainSpec{
Zone: infrav1.FailureDomain{
Name: "k8s-us-east-1",
Type: infrav1.ComputeClusterFailureDomain,
TagCategory: "k8s-zone",
AutoConfigure: nil,
Name: "k8s-us-east-1",
Type: infrav1.ComputeClusterFailureDomain,
TagCategory: "k8s-zone",
},
Topology: infrav1.Topology{
Datacenter: "DC0",
Expand All @@ -256,10 +250,9 @@ func TestVsphereDeploymentZoneReconciler_Reconcile_CreateAndAttachMetadata(t *te
name: "create tag + category & attach to host group",
vsphereFailureDomainSpec: infrav1.VSphereFailureDomainSpec{
Zone: infrav1.FailureDomain{
Name: "bar",
Type: infrav1.HostGroupFailureDomain,
TagCategory: "foo",
AutoConfigure: pointer.Bool(true),
Name: "bar",
Type: infrav1.HostGroupFailureDomain,
TagCategory: "foo",
},
Topology: infrav1.Topology{
Datacenter: "DC0",
Expand Down
56 changes: 24 additions & 32 deletions controllers/vspheredeploymentzone_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,14 @@ var _ = Describe("VSphereDeploymentZoneReconciler", func() {
},
Spec: infrav1.VSphereFailureDomainSpec{
Region: infrav1.FailureDomain{
Name: "k8s-region-west",
Type: infrav1.DatacenterFailureDomain,
TagCategory: "k8s-region",
AutoConfigure: pointer.Bool(false),
Name: "k8s-region-west",
Type: infrav1.DatacenterFailureDomain,
TagCategory: "k8s-region",
},
Zone: infrav1.FailureDomain{
Name: "k8s-zone-west-1",
Type: infrav1.ComputeClusterFailureDomain,
TagCategory: "k8s-zone",
AutoConfigure: pointer.Bool(false),
Name: "k8s-zone-west-1",
Type: infrav1.ComputeClusterFailureDomain,
TagCategory: "k8s-zone",
},
Topology: infrav1.Topology{
Datacenter: "DC0",
Expand Down Expand Up @@ -163,16 +161,14 @@ var _ = Describe("VSphereDeploymentZoneReconciler", func() {
},
Spec: infrav1.VSphereFailureDomainSpec{
Region: infrav1.FailureDomain{
Name: "k8s-region-west",
Type: infrav1.DatacenterFailureDomain,
TagCategory: "k8s-region",
AutoConfigure: pointer.Bool(false),
Name: "k8s-region-west",
Type: infrav1.DatacenterFailureDomain,
TagCategory: "k8s-region",
},
Zone: infrav1.FailureDomain{
Name: "k8s-zone-west-1",
Type: infrav1.ComputeClusterFailureDomain,
TagCategory: "k8s-zone",
AutoConfigure: pointer.Bool(false),
Name: "k8s-zone-west-1",
Type: infrav1.ComputeClusterFailureDomain,
TagCategory: "k8s-zone",
},
Topology: infrav1.Topology{
Datacenter: "DC0",
Expand Down Expand Up @@ -336,16 +332,14 @@ func TestVSphereDeploymentZone_Reconcile(t *testing.T) {
},
Spec: infrav1.VSphereFailureDomainSpec{
Region: infrav1.FailureDomain{
Name: "k8s-region-west",
Type: infrav1.DatacenterFailureDomain,
TagCategory: "k8s-region",
AutoConfigure: pointer.Bool(false),
Name: "k8s-region-west",
Type: infrav1.DatacenterFailureDomain,
TagCategory: "k8s-region",
},
Zone: infrav1.FailureDomain{
Name: "k8s-zone-west-1",
Type: infrav1.ComputeClusterFailureDomain,
TagCategory: "k8s-zone",
AutoConfigure: pointer.Bool(false),
Name: "k8s-zone-west-1",
Type: infrav1.ComputeClusterFailureDomain,
TagCategory: "k8s-zone",
},
Topology: infrav1.Topology{
Datacenter: "DC0",
Expand Down Expand Up @@ -408,16 +402,14 @@ func TestVSphereDeploymentZone_Reconcile(t *testing.T) {
},
Spec: infrav1.VSphereFailureDomainSpec{
Region: infrav1.FailureDomain{
Name: "k8s-region-west",
Type: infrav1.DatacenterFailureDomain,
TagCategory: "k8s-region",
AutoConfigure: pointer.Bool(false),
Name: "k8s-region-west",
Type: infrav1.DatacenterFailureDomain,
TagCategory: "k8s-region",
},
Zone: infrav1.FailureDomain{
Name: "k8s-zone-west-1",
Type: infrav1.ComputeClusterFailureDomain,
TagCategory: "k8s-zone",
AutoConfigure: pointer.Bool(false),
Name: "k8s-zone-west-1",
Type: infrav1.ComputeClusterFailureDomain,
TagCategory: "k8s-zone",
},
Topology: infrav1.Topology{
Datacenter: "DC0",
Expand Down
10 changes: 1 addition & 9 deletions internal/webhooks/vspherefailuredomain.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/validation/field"
"k8s.io/utils/pointer"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/webhook"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
Expand Down Expand Up @@ -103,17 +102,10 @@ func (webhook *VSphereFailureDomainWebhook) ValidateDelete(_ context.Context, _

// Default implements webhook.Defaulter so a webhook will be registered for the type.
func (webhook *VSphereFailureDomainWebhook) Default(_ context.Context, obj runtime.Object) error {
typedObj, ok := obj.(*infrav1.VSphereFailureDomain)
_, ok := obj.(*infrav1.VSphereFailureDomain)
if !ok {
return apierrors.NewBadRequest(fmt.Sprintf("expected a VSphereFailureDomain but got a %T", obj))
}
if typedObj.Spec.Zone.AutoConfigure == nil {
typedObj.Spec.Zone.AutoConfigure = pointer.Bool(false)
}

if typedObj.Spec.Region.AutoConfigure == nil {
typedObj.Spec.Region.AutoConfigure = pointer.Bool(false)
}

return nil
}
10 changes: 3 additions & 7 deletions internal/webhooks/vspherefailuredomain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ func TestVsphereFailureDomain_Default(t *testing.T) {
}
webhook := &VSphereFailureDomainWebhook{}
g.Expect(webhook.Default(context.Background(), m)).ToNot(HaveOccurred())

g.Expect(*m.Spec.Zone.AutoConfigure).To(BeFalse())
g.Expect(*m.Spec.Region.AutoConfigure).To(BeFalse())
}

func TestVSphereFailureDomain_ValidateCreate(t *testing.T) {
Expand All @@ -50,10 +47,9 @@ func TestVSphereFailureDomain_ValidateCreate(t *testing.T) {
name: "region failureDomain type is hostGroup",
failureDomain: infrav1.VSphereFailureDomain{Spec: infrav1.VSphereFailureDomainSpec{
Region: infrav1.FailureDomain{
Name: "foo",
Type: infrav1.HostGroupFailureDomain,
TagCategory: "k8s-bar",
AutoConfigure: pointer.Bool(true),
Name: "foo",
Type: infrav1.HostGroupFailureDomain,
TagCategory: "k8s-bar",
},
}},
},
Expand Down
3 changes: 3 additions & 0 deletions metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@ releaseSeries:
- major: 1
minor: 8
contract: v1beta1
- major: 1
minor: 9
contract: v1beta1
5 changes: 0 additions & 5 deletions pkg/services/network/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,4 @@ const (

// SystemNamespace is the namespace where supervisor control plane VMs reside.
SystemNamespace = "kube-system"

// legacyDefaultNetworkLabel was the label used for default networks.
//
// Deprecated: legacyDefaultNetworkLabel will be removed in a future release.
legacyDefaultNetworkLabel = "capw.vmware.com/is-default-network"
)
Loading

0 comments on commit 3b3e99f

Please sign in to comment.