Skip to content

Commit a2484ff

Browse files
nikhilbargedeepakkinniAishwarya-Hebbarxing-yangdivyenpatel
authored
Cherry-Pick commits upto daee8bd (#3518)
* Fix IsLinkedCloneRequest to use FSS based on cluster flavor (#3512) Signed-off-by: Deepak Kinni <[email protected]> * Utils for CSI personas testing (#3494) * Check topology annotation on existing PVC for CnsRegisterVolume (#3489) * Check topology annotation on existing PVC for CNSRegisterVolume * Move the PVC check before PV creation * Removed commented out code * Address comments * use supports_FCD_transaction wcp capability to enabled transaction support (#3509) * set max back off duration for reconcilers (#3510) * Update CSI spec dependency (#3511) Signed-off-by: Deepak Kinni <[email protected]> * multi-Svc test refactor (#3469) * Improve capabilities check for case when TKR is newer than supervisor (#3514) --------- Signed-off-by: Deepak Kinni <[email protected]> Co-authored-by: Deepak Kinni <[email protected]> Co-authored-by: Aishwarya-Hebbar <[email protected]> Co-authored-by: Xing Yang <[email protected]> Co-authored-by: Divyen Patel <[email protected]> Co-authored-by: Raj Kumar Gupta <[email protected]>
1 parent 87679f2 commit a2484ff

40 files changed

+1231
-401
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ toolchain go1.24.2
77
require (
88
github.com/agiledragon/gomonkey/v2 v2.13.0
99
github.com/akutz/gofsutil v0.1.2
10-
github.com/container-storage-interface/spec v1.9.0
10+
github.com/container-storage-interface/spec v1.11.0
1111
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
1212
github.com/evanphx/json-patch/v5 v5.9.0
1313
github.com/fsnotify/fsnotify v1.7.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UF
3232
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
3333
github.com/chai2010/gettext-go v1.0.2 h1:1Lwwip6Q2QGsAdl/ZKPCwTe9fe0CjlUbqj5bFNSjIRk=
3434
github.com/chai2010/gettext-go v1.0.2/go.mod h1:y+wnP2cHYaVj19NZhYKAwEMH2CI1gNHeQQ+5AjwawxA=
35-
github.com/container-storage-interface/spec v1.9.0 h1:zKtX4STsq31Knz3gciCYCi1SXtO2HJDecIjDVboYavY=
36-
github.com/container-storage-interface/spec v1.9.0/go.mod h1:ZfDu+3ZRyeVqxZM0Ds19MVLkN2d1XJ5MAfi1L3VjlT0=
35+
github.com/container-storage-interface/spec v1.11.0 h1:H/YKTOeUZwHtyPOr9raR+HgFmGluGCklulxDYxSdVNM=
36+
github.com/container-storage-interface/spec v1.11.0/go.mod h1:DtUvaQszPml1YJfIK7c00mlv6/g4wNMLanLgiUbKFRI=
3737
github.com/containerd/containerd/api v1.8.0 h1:hVTNJKR8fMc/2Tiw60ZRijntNMd1U+JVMyTRdsD2bS0=
3838
github.com/containerd/containerd/api v1.8.0/go.mod h1:dFv4lt6S20wTu/hMcP4350RL87qPWLVa/OHOwmmdnYc=
3939
github.com/containerd/errdefs v1.0.0 h1:tg5yIfIlQIrxYtu9ajqY42W3lpS19XqdxRQeEwYG8PI=

hack/run-e2e-test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ then
7373
OPTS+=(-p)
7474
ginkgo -mod=mod "${OPTS[@]}" --focus="csi-block-vanilla-parallelized" tests/e2e
7575
else
76-
ginkgo -mod=mod "${OPTS[@]}" --focus="$FOCUS" tests/e2e
76+
ginkgo -mod=mod "${OPTS[@]}" --focus="$FOCUS" -r tests/e2e
7777
fi
7878

7979
# Checking for test status

manifests/supervisorcluster/1.29/cns-csi.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,6 @@ data:
574574
"workload-domain-isolation": "false"
575575
"sv-pvc-snapshot-protection-finalizer": "false"
576576
"file-volume-with-vm-service": "false"
577-
"csi-transaction-support": "false"
578577
kind: ConfigMap
579578
metadata:
580579
name: csi-feature-states

manifests/supervisorcluster/1.30/cns-csi.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,6 @@ data:
573573
"workload-domain-isolation": "false"
574574
"sv-pvc-snapshot-protection-finalizer": "false"
575575
"file-volume-with-vm-service": "false"
576-
"csi-transaction-support": "false"
577576
kind: ConfigMap
578577
metadata:
579578
name: csi-feature-states

manifests/supervisorcluster/1.31/cns-csi.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,6 @@ data:
573573
"workload-domain-isolation": "false"
574574
"sv-pvc-snapshot-protection-finalizer": "false"
575575
"file-volume-with-vm-service": "false"
576-
"csi-transaction-support": "false"
577576
kind: ConfigMap
578577
metadata:
579578
name: csi-feature-states

manifests/supervisorcluster/1.32/cns-csi.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,6 @@ data:
576576
"workload-domain-isolation": "false"
577577
"sv-pvc-snapshot-protection-finalizer": "false"
578578
"file-volume-with-vm-service": "false"
579-
"csi-transaction-support": "false"
580579
kind: ConfigMap
581580
metadata:
582581
name: csi-feature-states

pkg/csi/service/common/commonco/k8sorchestrator/k8sorchestrator.go

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1102,6 +1102,7 @@ func (c *K8sOrchestrator) HandleLateEnablementOfCapability(ctx context.Context,
11021102
clusterFlavor cnstypes.CnsClusterFlavor, capability,
11031103
gcPort, gcEndpoint string) {
11041104
log := logger.GetLogger(ctx)
1105+
log.Infof("Starting a routine to handle late enablement for capability: %q", capability)
11051106
var restClientConfig *restclient.Config
11061107
var err error
11071108

@@ -1126,7 +1127,7 @@ func (c *K8sOrchestrator) HandleLateEnablementOfCapability(ctx context.Context,
11261127
_, err = apiextensionsClientSet.ApiextensionsV1().CustomResourceDefinitions().Get(ctx,
11271128
"capabilities.iaas.vmware.com", metav1.GetOptions{})
11281129
if err != nil {
1129-
if apierrors.IsNotFound(err) {
1130+
if apierrors.IsNotFound(err) || apierrors.IsForbidden(err) {
11301131
// If capabilities CR is not registered on supervisor, then sleep for some time and check
11311132
// again if CR has been registered on supervisor. If TKR is new, but supervisor is old, then
11321133
// it could happen that capabilities CR is not registered on the supervisor cluster.
@@ -1243,7 +1244,7 @@ func (c *K8sOrchestrator) IsFSSEnabled(ctx context.Context, featureName string)
12431244
} else if c.clusterFlavor == cnstypes.CnsClusterFlavorWorkload {
12441245
// Check if it is WCP defined feature state.
12451246
if _, exists := common.WCPFeatureStates[featureName]; exists {
1246-
log.Infof("Feature %q is a WCP defined feature state. Reading the capabilities CR %q.",
1247+
log.Debugf("Feature %q is a WCP defined feature state. Reading the capabilities CR %q.",
12471248
featureName, common.WCPCapabilitiesCRName)
12481249

12491250
if len(WcpCapabilitiesMap) == 0 {
@@ -1265,7 +1266,7 @@ func (c *K8sOrchestrator) IsFSSEnabled(ctx context.Context, featureName string)
12651266
log.Infof("WCP cluster capabilities map - %+v", WcpCapabilitiesMap)
12661267
}
12671268
if supervisorFeatureState, exists := WcpCapabilitiesMap[featureName]; exists {
1268-
log.Infof("Supervisor capability %q is set to %t", featureName, supervisorFeatureState)
1269+
log.Debugf("Supervisor capability %q is set to %t", featureName, supervisorFeatureState)
12691270

12701271
if !supervisorFeatureState {
12711272
// if capability can be enabled after upgrading CSI, we need to fetch capabilities CR again and
@@ -1342,6 +1343,32 @@ func (c *K8sOrchestrator) IsFSSEnabled(ctx context.Context, featureName string)
13421343
}
13431344
// Get rest client config for supervisor.
13441345
restClientConfig := k8s.GetRestClientConfigForSupervisor(ctx, cfg.GC.Endpoint, cfg.GC.Port)
1346+
// Check if CRD for capabilities exists
1347+
// If CRD does not exist on supervisor then skip further capability check
1348+
// this is case when tkr is newer and supervisor is older where capabilities CRD does not exist.
1349+
apiextensionsClientSet, err := apiextensionsclientset.NewForConfig(restClientConfig)
1350+
if err != nil {
1351+
log.Errorf("failed to create apiextension clientset using config. Err: %+v", err)
1352+
return false
1353+
}
1354+
_, err = apiextensionsClientSet.ApiextensionsV1().CustomResourceDefinitions().Get(ctx,
1355+
"capabilities.iaas.vmware.com", metav1.GetOptions{})
1356+
if err != nil {
1357+
if featureName == common.WorkloadDomainIsolationFSS {
1358+
// prefer CSI internal feature-state configmap for workload-domain-isolation feature
1359+
// in case capabilities CRD is not registred on supervisor
1360+
log.Info("CSI workload-domain-isolation is set to true in pvcsi fss configmap. " +
1361+
"check if it is enabled in cns-csi fss")
1362+
return c.IsCNSCSIFSSEnabled(ctx, featureName)
1363+
}
1364+
if apierrors.IsNotFound(err) || apierrors.IsForbidden(err) {
1365+
log.Info("CR instance capabilities.iaas.vmware.com is not registered on supervisor, " +
1366+
"considering feature to be false")
1367+
return false
1368+
}
1369+
log.Errorf("failed to check if Capabilities CR is registered. Err: %v", err)
1370+
return false
1371+
}
13451372
wcpCapabilityApiClient, err := k8s.NewClientForGroup(ctx, restClientConfig, wcpcapapis.GroupName)
13461373
if err != nil {
13471374
log.Errorf("failed to create wcpCapabilityApi client. Err: %+v", err)
@@ -1987,7 +2014,16 @@ func (c *K8sOrchestrator) IsLinkedCloneRequest(ctx context.Context, pvcName stri
19872014
return false, err
19882015
}
19892016
hasLinkedCloneAnn := metav1.HasAnnotation(pvcObj.ObjectMeta, common.AnnKeyLinkedClone)
1990-
isLinkedCloneSupported := c.IsFSSEnabled(ctx, common.LinkedCloneSupport)
2017+
var fss string
2018+
if c.clusterFlavor == cnstypes.CnsClusterFlavorWorkload {
2019+
fss = common.LinkedCloneSupport
2020+
} else if c.clusterFlavor == cnstypes.CnsClusterFlavorGuest {
2021+
fss = common.LinkedCloneSupportFSS
2022+
} else {
2023+
// LinkedClone not supported in vanilla
2024+
return false, nil
2025+
}
2026+
isLinkedCloneSupported := c.IsFSSEnabled(ctx, fss)
19912027

19922028
if hasLinkedCloneAnn && !isLinkedCloneSupported {
19932029
log.Errorf("linked clone support is not enabled for the linked clone request pvc %s in namespace %s",

pkg/csi/service/common/commonco/k8sorchestrator/topology.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1874,6 +1874,10 @@ func (c *K8sOrchestrator) GetActiveClustersForNamespaceInRequestedZones(ctx cont
18741874
}
18751875
activeClusters = append(activeClusters, clusters...)
18761876
}
1877+
if len(activeClusters) == 0 {
1878+
return nil, logger.LogNewErrorf(log, "could not find active cluster for the namespace %q "+
1879+
"in requested zones: %v", targetNS, requestedZones)
1880+
}
18771881
log.Infof("active clusters: %v for namespace: %q in requested zones: %v", activeClusters, targetNS, requestedZones)
18781882
return activeClusters, nil
18791883
}

pkg/csi/service/common/constants.go

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -444,8 +444,10 @@ const (
444444
FileVolumesWithVmService = "file-volume-with-vm-service"
445445
// SharedDiskFss is an FSS that tells whether shared disks are supported or not
446446
SharedDiskFss = "supports_shared_disks_with_VM_service_VMs"
447-
// CSITranSactionSupport is an FSS for transaction support
448-
CSITranSactionSupport = "csi-transaction-support"
447+
// FCDTransactionSupport is the wcp capability that tells whether transaction is supported in CSI
448+
FCDTransactionSupport = "supports_FCD_transaction"
449+
// CSITransactionSupport is an FSS for transaction support
450+
CSITransactionSupport = "csi-transaction-support"
449451
// VolFromSnapshotOnTargetDs is a FSS that tells whether creation of volumes from
450452
// snapshots on different datastores feature is supported in CSI.
451453
VolFromSnapshotOnTargetDs = "supports_vol_from_snapshot_on_target_ds"
@@ -472,17 +474,20 @@ var WCPFeatureStates = map[string]struct{}{
472474
StoragePolicyReservationSupport: {},
473475
WCPVMServiceVMSnapshots: {},
474476
BYOKEncryption: {},
477+
FCDTransactionSupport: {},
478+
MultipleClustersPerVsphereZone: {},
475479
}
476480

477481
// WCPFeatureStatesSupportsLateEnablement contains capabilities that can be enabled later
478482
// after CSI upgrade
479483
// During FSS check if driver detects that the capabilities is disabled in the cached configmap,
480484
// it will re-fetch the configmap and update the cached configmap.
481485
var WCPFeatureStatesSupportsLateEnablement = map[string]struct{}{
482-
WorkloadDomainIsolation: {},
483-
LinkedCloneSupport: {},
484-
WCPVMServiceVMSnapshots: {},
485-
BYOKEncryption: {},
486+
WorkloadDomainIsolation: {},
487+
LinkedCloneSupport: {},
488+
MultipleClustersPerVsphereZone: {},
489+
WCPVMServiceVMSnapshots: {},
490+
BYOKEncryption: {},
486491
}
487492

488493
// WCPFeatureAssociatedWithPVCSI contains FSS name used in PVCSI and associated WCP Capability name on a

0 commit comments

Comments
 (0)