Repository: kubernetes-sigs/cluster-api-provider-vsphere
Pull request #3118 (2024-07-23 15:38:24)

🌱 Drop WCP fault domains feature gate
Signed-off-by: Stefan Büringer buringerst@vmware.com

<!--  Thanks for sending a pull request! Please add a icon to the title of this PR (see https://sigs.k8s.io/cluster-api-provider-vsphere/CONTRIBUTING.md#contributing-a-patch), and delete this line and similar ones -->
<!-- the icon will be either ⚠️ (:warning:, major or breaking changes), ✨ (:sparkles:, feature additions), 🐛 (:bug:, patch and bugfixes), 📖 (:book:, documentation or proposals), or 🌱 (:seedling:, minor or other)
Here are some other tips for you:
1. If this is your first time, read our contributor guidelines https://git.k8s.io/community/contributors/guide/pull-requests.md#the-pull-request-submit-process and developer guide https://git.k8s.io/community/contributors/devel/development.md#development-guide
2. If you want *faster* PR reviews, read how: https://git.k8s.io/community/contributors/guide/pull-requests.md#best-practices-for-faster-reviews
3. Follow the instructions for writing a release note: https://git.k8s.io/community/contributors/guide/release-notes.md
4. If the PR is unfinished, see how to mark it: https://git.k8s.io/community/contributors/guide/pull-requests.md#marking-unfinished-pull-requests
5. If this PR changes image versions, please title this PR "Bump <image name> from x.x.x to y.y.y."
-->

**What this PR does / why we need it**:

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #



Patch:
diff --git a/controllers/vmware/vspherecluster_reconciler.go b/controllers/vmware/vspherecluster_reconciler.go
index 1330e03b..5d605e8f 100644
--- a/controllers/vmware/vspherecluster_reconciler.go
+++ b/controllers/vmware/vspherecluster_reconciler.go
@@ -20,7 +20,6 @@ package vmware
 import (
 	"context"
 	"fmt"
-	"os"
 
 	"github.com/pkg/errors"
 	topologyv1 "github.com/vmware-tanzu/vm-operator/external/tanzu-topology/api/v1alpha1"
@@ -370,17 +369,9 @@ func (r *ClusterReconciler) VSphereMachineToCluster(ctx context.Context, o clien
 	}}
 }
 
-var isFaultDomainsFSSEnabled = func() bool {
-	return os.Getenv("FSS_WCP_FAULTDOMAINS") == "true"
-}
-
 // Returns the failure domain information discovered on the cluster
 // hosting this controller.
 func (r *ClusterReconciler) getFailureDomains(ctx context.Context) (clusterv1.FailureDomains, error) {
-	if !isFaultDomainsFSSEnabled() {
-		return nil, nil
-	}
-
 	availabilityZoneList := &topologyv1.AvailabilityZoneList{}
 	if err := r.Client.List(ctx, availabilityZoneList); err != nil {
 		return nil, err


Test patch:
diff --git a/config/deployments/integration-tests/README.md b/config/deployments/integration-tests/README.md
index 2c57737f..a1b7e5a4 100644
--- a/config/deployments/integration-tests/README.md
+++ b/config/deployments/integration-tests/README.md
@@ -10,6 +10,8 @@ To sync the new CRD's use the following script **and** update `kustomization.yam
 make clean-vm-operator checkout-vm-operator
 rm -r config/deployments/integration-tests/crds
 cp -r test/infrastructure/vm-operator/vm-operator.tmp/config/crd/bases config/deployments/integration-tests/crds
+# Note: for now we only need the AvailabilityZone CRD in our integration tests
+cp test/infrastructure/vm-operator/vm-operator.tmp/config/crd/external-crds/topology.tanzu.vmware.com_availabilityzones.yaml config/deployments/integration-tests/crds
 
 make clean-vm-operator
 ```
diff --git a/config/deployments/integration-tests/crds/topology.tanzu.vmware.com_availabilityzones.yaml b/config/deployments/integration-tests/crds/topology.tanzu.vmware.com_availabilityzones.yaml
new file mode 100644
index 00000000..c0f7c005
--- /dev/null
+++ b/config/deployments/integration-tests/crds/topology.tanzu.vmware.com_availabilityzones.yaml
@@ -0,0 +1,94 @@
+apiVersion: apiextensions.k8s.io/v1
+kind: CustomResourceDefinition
+metadata:
+  annotations:
+    controller-gen.kubebuilder.io/version: v0.6.1
+  creationTimestamp: null
+  name: availabilityzones.topology.tanzu.vmware.com
+spec:
+  group: topology.tanzu.vmware.com
+  names:
+    kind: AvailabilityZone
+    listKind: AvailabilityZoneList
+    plural: availabilityzones
+    shortNames:
+    - az
+    singular: availabilityzone
+  scope: Cluster
+  versions:
+  - name: v1alpha1
+    schema:
+      openAPIV3Schema:
+        description: AvailabilityZone is the schema for the AvailabilityZone resource
+          for the vSphere topology API.
+        properties:
+          apiVersion:
+            description: 'APIVersion defines the versioned schema of this representation
+              of an object. Servers should convert recognized schemas to the latest
+              internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
+            type: string
+          kind:
+            description: 'Kind is a string value representing the REST resource this
+              object represents. Servers may infer this from the endpoint the client
+              submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
+            type: string
+          metadata:
+            type: object
+          spec:
+            description: AvailabilityZoneSpec defines the desired state of AvailabilityZone.
+            properties:
+              clusterComputeResourceMoIDs:
+                description: ClusterComputeResourceMoIDs are the managed object IDs
+                  of the vSphere ClusterComputeResources represented by this availability
+                  zone.
+                items:
+                  type: string
+                type: array
+              clusterComputeResourceMoId:
+                description: ClusterComputeResourceMoId is the managed object ID of
+                  the vSphere ClusterComputeResource represented by this availability
+                  zone.
+                type: string
+              namespaces:
+                additionalProperties:
+                  description: NamespaceInfo contains identifying information about
+                    the vSphere resources used to represent a Kubernetes namespace
+                    on individual vSphere Zones.
+                  properties:
+                    folderMoId:
+                      description: FolderMoId is the managed object ID of the vSphere
+                        Folder for a Namespace. Folders are global and not per-vSphere
+                        Cluster, but the FolderMoId is stored here, alongside the
+                        PoolMoId for convenience.
+                      type: string
+                    poolMoIDs:
+                      description: PoolMoIDs are the managed object ID of the vSphere
+                        ResourcePools for a Namespace in an individual vSphere Zone.
+                        A zone may be comprised of multiple ResourcePools.
+                      items:
+                        type: string
+                      type: array
+                    poolMoId:
+                      description: PoolMoId is the managed object ID of the vSphere
+                        ResourcePool for a Namespace on an individual vSphere Cluster.
+                      type: string
+                  type: object
+                description: Namespaces is a map that enables querying information
+                  about the vSphere objects that make up a Kubernetes Namespace based
+                  on its name.
+                type: object
+            type: object
+          status:
+            description: AvailabilityZoneStatus defines the observed state of AvailabilityZone.
+            type: object
+        type: object
+    served: true
+    storage: true
+    subresources:
+      status: {}
+status:
+  acceptedNames:
+    kind: ""
+    plural: ""
+  conditions: []
+  storedVersions: []
diff --git a/controllers/vmware/vspherecluster_reconciler_test.go b/controllers/vmware/vspherecluster_reconciler_test.go
index 3990e6ae..88b34ace 100644
--- a/controllers/vmware/vspherecluster_reconciler_test.go
+++ b/controllers/vmware/vspherecluster_reconciler_test.go
@@ -130,16 +130,6 @@ var _ = Describe("Cluster Controller Tests", func() {
 	})
 
 	Context("Test getFailureDomains", func() {
-		fss := isFaultDomainsFSSEnabled
-
-		BeforeEach(func() {
-			isFaultDomainsFSSEnabled = func() bool { return true }
-		})
-
-		AfterEach(func() {
-			isFaultDomainsFSSEnabled = fss
-		})
-
 		It("should not find FailureDomains", func() {
 			fds, err := reconciler.getFailureDomains(ctx)
 			Expect(err).ToNot(HaveOccurred())