@@ -51,6 +51,7 @@ import (
51
51
"sigs.k8s.io/vsphere-csi-driver/v3/pkg/common/utils"
52
52
"sigs.k8s.io/vsphere-csi-driver/v3/pkg/csi/service/common"
53
53
"sigs.k8s.io/vsphere-csi-driver/v3/pkg/csi/service/common/commonco"
54
+ "sigs.k8s.io/vsphere-csi-driver/v3/pkg/csi/service/common/commonco/k8sorchestrator"
54
55
commoncotypes "sigs.k8s.io/vsphere-csi-driver/v3/pkg/csi/service/common/commonco/types"
55
56
"sigs.k8s.io/vsphere-csi-driver/v3/pkg/csi/service/logger"
56
57
csitypes "sigs.k8s.io/vsphere-csi-driver/v3/pkg/csi/types"
83
84
volumeInfoService cnsvolumeinfo.VolumeInfoService
84
85
// isPodVMOnStretchSupervisorFSSEnabled is true when PodVMOnStretchedSupervisor FSS is enabled.
85
86
isPodVMOnStretchSupervisorFSSEnabled bool
87
+ // IsMultipleClustersPerVsphereZoneFSSEnabled is true when supports_multiple_clusters_per_zone FSS is enabled.
88
+ IsMultipleClustersPerVsphereZoneFSSEnabled bool
86
89
)
87
90
88
91
var getCandidateDatastores = cnsvsphere .GetCandidateDatastoresInCluster
@@ -153,7 +156,12 @@ func (c *controller) Init(config *cnsconfig.Config, version string) error {
153
156
common .PodVMOnStretchedSupervisor )
154
157
idempotencyHandlingEnabled := commonco .ContainerOrchestratorUtility .IsFSSEnabled (ctx ,
155
158
common .CSIVolumeManagerIdempotency )
156
- if commonco .ContainerOrchestratorUtility .IsFSSEnabled (ctx , common .MultipleClustersPerVsphereZone ) {
159
+ IsMultipleClustersPerVsphereZoneFSSEnabled = commonco .ContainerOrchestratorUtility .IsFSSEnabled (ctx ,
160
+ common .MultipleClustersPerVsphereZone )
161
+ if ! IsMultipleClustersPerVsphereZoneFSSEnabled {
162
+ go k8sorchestrator .HandleLateEnablementOfCapability (ctx , cnstypes .CnsClusterFlavorWorkload ,
163
+ common .MultipleClustersPerVsphereZone , "" , "" )
164
+ } else {
157
165
err := commonco .ContainerOrchestratorUtility .StartZonesInformer (ctx , nil , metav1 .NamespaceAll )
158
166
if err != nil {
159
167
return logger .LogNewErrorf (log , "failed to start zone informer. Error: %v" , err )
@@ -521,8 +529,6 @@ func (c *controller) createBlockVolume(ctx context.Context, req *csi.CreateVolum
521
529
filterSuspendedDatastores := commonco .ContainerOrchestratorUtility .IsFSSEnabled (ctx , common .CnsMgrSuspendCreateVolume )
522
530
isTKGSHAEnabled := commonco .ContainerOrchestratorUtility .IsFSSEnabled (ctx , common .TKGsHA )
523
531
isCSITransactionSupportEnabled := commonco .ContainerOrchestratorUtility .IsFSSEnabled (ctx , common .CSITranSactionSupport )
524
- isMultipleClustersPerVsphereZoneEnabled := commonco .ContainerOrchestratorUtility .IsFSSEnabled (ctx ,
525
- common .MultipleClustersPerVsphereZone )
526
532
527
533
topoSegToDatastoresMap := make (map [string ][]* cnsvsphere.DatastoreInfo )
528
534
if isTKGSHAEnabled {
@@ -552,7 +558,7 @@ func (c *controller) createBlockVolume(ctx context.Context, req *csi.CreateVolum
552
558
hostnameLabelPresent , zoneLabelPresent = checkTopologyKeysFromAccessibilityReqs (topologyRequirement )
553
559
if zoneLabelPresent && hostnameLabelPresent {
554
560
if isVdppOnStretchedSVEnabled {
555
- if isMultipleClustersPerVsphereZoneEnabled && c .topologyMgr .ZonesWithMultipleClustersExist (ctx ) {
561
+ if IsMultipleClustersPerVsphereZoneFSSEnabled && c .topologyMgr .ZonesWithMultipleClustersExist (ctx ) {
556
562
return nil , csifault .CSIInternalFault , logger .LogNewErrorCode (log , codes .Internal ,
557
563
"Creating volume with both zone and hostname in topology requirement is not " +
558
564
"supported on deployment with multiple vSphere Clusters per zone" )
@@ -571,7 +577,7 @@ func (c *controller) createBlockVolume(ctx context.Context, req *csi.CreateVolum
571
577
}
572
578
// Initiate TKGs HA workflow when the topology requirement contains zone labels only.
573
579
log .Infof ("Topology aware environment detected with requirement: %+v" , topologyRequirement )
574
- if ! isMultipleClustersPerVsphereZoneEnabled {
580
+ if ! IsMultipleClustersPerVsphereZoneFSSEnabled {
575
581
log .Debugf ("Calling GetSharedDatastoresInTopology: storageTopologyType: %s, " +
576
582
"topologyRequirement %+v, topoSegToDatastoresMap %+v" ,
577
583
storageTopologyType , topologyRequirement , topoSegToDatastoresMap )
@@ -859,7 +865,7 @@ func (c *controller) createBlockVolume(ctx context.Context, req *csi.CreateVolum
859
865
StorageClassName : req .Parameters [common .AttributeStorageClassName ],
860
866
Namespace : req .Parameters [common .AttributePvcNamespace ],
861
867
IsPodVMOnStretchSupervisorFSSEnabled : isPodVMOnStretchSupervisorFSSEnabled ,
862
- IsMultipleClustersPerVsphereZoneEnabled : isMultipleClustersPerVsphereZoneEnabled ,
868
+ IsMultipleClustersPerVsphereZoneEnabled : IsMultipleClustersPerVsphereZoneFSSEnabled ,
863
869
})
864
870
if err != nil {
865
871
if cnsvolume .IsNotSupportedFaultType (ctx , faultType ) {
@@ -873,7 +879,7 @@ func (c *controller) createBlockVolume(ctx context.Context, req *csi.CreateVolum
873
879
StorageClassName : req .Parameters [common .AttributeStorageClassName ],
874
880
Namespace : req .Parameters [common .AttributePvcNamespace ],
875
881
IsPodVMOnStretchSupervisorFSSEnabled : isPodVMOnStretchSupervisorFSSEnabled ,
876
- IsMultipleClustersPerVsphereZoneEnabled : isMultipleClustersPerVsphereZoneEnabled ,
882
+ IsMultipleClustersPerVsphereZoneEnabled : IsMultipleClustersPerVsphereZoneFSSEnabled ,
877
883
})
878
884
}
879
885
}
@@ -940,7 +946,7 @@ func (c *controller) createBlockVolume(ctx context.Context, req *csi.CreateVolum
940
946
}
941
947
}
942
948
} else if zoneLabelPresent {
943
- if isMultipleClustersPerVsphereZoneEnabled && len (volumeInfo .Clusters ) > 0 {
949
+ if IsMultipleClustersPerVsphereZoneFSSEnabled && len (volumeInfo .Clusters ) > 0 {
944
950
// Calculate Volume Accessible Topology from Clusters returned in CreateVolume Response
945
951
azClusterMap := c .topologyMgr .GetAZClustersMap (ctx )
946
952
resp .Volume .AccessibleTopology = GetAccessibleTopologies (volumeInfo .Clusters , azClusterMap )
@@ -1325,10 +1331,6 @@ func (c *controller) createFileVolume(ctx context.Context, req *csi.CreateVolume
1325
1331
)
1326
1332
1327
1333
linkedCloneSupportEnabled = commonco .ContainerOrchestratorUtility .IsFSSEnabled (ctx , common .LinkedCloneSupport )
1328
-
1329
- isMultipleClustersPerVsphereZoneEnabled := commonco .ContainerOrchestratorUtility .IsFSSEnabled (ctx ,
1330
- common .MultipleClustersPerVsphereZone )
1331
-
1332
1334
topologyRequirement = req .AccessibilityRequirements
1333
1335
// Volume Size - Default is 10 GiB.
1334
1336
volSizeBytes := int64 (common .DefaultGbDiskSize * common .GbInBytes )
@@ -1397,7 +1399,7 @@ func (c *controller) createFileVolume(ctx context.Context, req *csi.CreateVolume
1397
1399
return nil , csifault .CSIInternalFault , logger .LogNewErrorCode (log , codes .Internal ,
1398
1400
"topology manager not initialized." )
1399
1401
}
1400
- if isMultipleClustersPerVsphereZoneEnabled {
1402
+ if IsMultipleClustersPerVsphereZoneFSSEnabled {
1401
1403
log .Infof ("MultipleClustersPerVsphereZone capability is enabled. Skipping to find candidate " +
1402
1404
"datastores for volume provisioning." )
1403
1405
pvcNamespace := req .Parameters [common .AttributePvcNamespace ]
@@ -1509,7 +1511,7 @@ func (c *controller) createFileVolume(ctx context.Context, req *csi.CreateVolume
1509
1511
StorageClassName : req .Parameters [common .AttributeStorageClassName ],
1510
1512
Namespace : req .Parameters [common .AttributePvcNamespace ],
1511
1513
IsPodVMOnStretchSupervisorFSSEnabled : isPodVMOnStretchSupervisorFSSEnabled ,
1512
- IsMultipleClustersPerVsphereZoneEnabled : isMultipleClustersPerVsphereZoneEnabled ,
1514
+ IsMultipleClustersPerVsphereZoneEnabled : IsMultipleClustersPerVsphereZoneFSSEnabled ,
1513
1515
})
1514
1516
} else {
1515
1517
volumeInfo , faultType , err = common .CreateFileVolumeUtil (ctx , cnstypes .CnsClusterFlavorWorkload , vc ,
@@ -1540,7 +1542,7 @@ func (c *controller) createFileVolume(ctx context.Context, req *csi.CreateVolume
1540
1542
// Calculate accessible topology for the provisioned volume in case of topology aware environment.
1541
1543
if isWorkloadDomainIsolationEnabled {
1542
1544
if zoneLabelPresent {
1543
- if isMultipleClustersPerVsphereZoneEnabled && len (volumeInfo .Clusters ) > 0 {
1545
+ if IsMultipleClustersPerVsphereZoneFSSEnabled && len (volumeInfo .Clusters ) > 0 {
1544
1546
// Calculate Volume Accessible Topology from Clusters returned in CreateVolume Response
1545
1547
azClusterMap := c .topologyMgr .GetAZClustersMap (ctx )
1546
1548
resp .Volume .AccessibleTopology = GetAccessibleTopologies (volumeInfo .Clusters , azClusterMap )
0 commit comments