@@ -1127,7 +1127,7 @@ func (c *K8sOrchestrator) HandleLateEnablementOfCapability(ctx context.Context,
1127
1127
_ , err = apiextensionsClientSet .ApiextensionsV1 ().CustomResourceDefinitions ().Get (ctx ,
1128
1128
"capabilities.iaas.vmware.com" , metav1.GetOptions {})
1129
1129
if err != nil {
1130
- if apierrors .IsNotFound (err ) {
1130
+ if apierrors .IsNotFound (err ) || apierrors . IsForbidden ( err ) {
1131
1131
// If capabilities CR is not registered on supervisor, then sleep for some time and check
1132
1132
// again if CR has been registered on supervisor. If TKR is new, but supervisor is old, then
1133
1133
// it could happen that capabilities CR is not registered on the supervisor cluster.
@@ -1343,6 +1343,32 @@ func (c *K8sOrchestrator) IsFSSEnabled(ctx context.Context, featureName string)
1343
1343
}
1344
1344
// Get rest client config for supervisor.
1345
1345
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
+ }
1346
1372
wcpCapabilityApiClient , err := k8s .NewClientForGroup (ctx , restClientConfig , wcpcapapis .GroupName )
1347
1373
if err != nil {
1348
1374
log .Errorf ("failed to create wcpCapabilityApi client. Err: %+v" , err )
0 commit comments