Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 27 additions & 22 deletions pkg/csi/service/common/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -490,38 +490,43 @@ const (
// HighPVNodeDensity is an FSS for guest cluster nodes that, when enabled,
// raises MAX_VOLUMES_PER_NODE from 59 to 255 in NodeGetInfo responses.
HighPVNodeDensity = "high-pv-node-density"
// SupportsPerNamespaceNetworkProviders is a WCP capability indicating that network provider
// is resolved per namespace (NetworkSettings CR) rather than from the global wcp-network-config.
SupportsPerNamespaceNetworkProviders = "supports_per_namespace_network_providers"
)

var WCPFeatureStates = map[string]struct{}{
PodVMOnStretchedSupervisor: {},
CSIDetachOnSupervisor: {},
WorkloadDomainIsolation: {},
VPCCapabilitySupervisor: {},
VolFromSnapshotOnTargetDs: {},
SharedDiskFss: {},
LinkedCloneSupport: {},
WCPMobilityNonDisruptiveImport: {},
WCPVMServiceVMSnapshots: {},
BYOKEncryption: {},
FCDTransactionSupport: {},
MultipleClustersPerVsphereZone: {},
FileVolumesWithVmService: {},
VsanFileVolumeService: {},
PodVMOnStretchedSupervisor: {},
CSIDetachOnSupervisor: {},
WorkloadDomainIsolation: {},
VPCCapabilitySupervisor: {},
VolFromSnapshotOnTargetDs: {},
SharedDiskFss: {},
LinkedCloneSupport: {},
WCPMobilityNonDisruptiveImport: {},
WCPVMServiceVMSnapshots: {},
BYOKEncryption: {},
FCDTransactionSupport: {},
MultipleClustersPerVsphereZone: {},
FileVolumesWithVmService: {},
VsanFileVolumeService: {},
SupportsPerNamespaceNetworkProviders: {},
}

// WCPFeatureStatesSupportsLateEnablement contains capabilities that can be enabled later
// after CSI upgrade
// During FSS check if driver detects that the capabilities is disabled in the cached configmap,
// it will re-fetch the configmap and update the cached configmap.
var WCPFeatureStatesSupportsLateEnablement = map[string]struct{}{
WorkloadDomainIsolation: {},
LinkedCloneSupport: {},
MultipleClustersPerVsphereZone: {},
WCPVMServiceVMSnapshots: {},
BYOKEncryption: {},
SharedDiskFss: {},
FileVolumesWithVmService: {},
VsanFileVolumeService: {},
WorkloadDomainIsolation: {},
LinkedCloneSupport: {},
MultipleClustersPerVsphereZone: {},
WCPVMServiceVMSnapshots: {},
BYOKEncryption: {},
SharedDiskFss: {},
FileVolumesWithVmService: {},
VsanFileVolumeService: {},
SupportsPerNamespaceNetworkProviders: {},
}

// WCPFeatureAssociatedWithPVCSI contains FSS name used in PVCSI and associated WCP Capability name on a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,9 @@ func (r *ReconcileCnsFileAccessConfig) configureVolumeACLs(ctx context.Context,
// getVMExternalIP helps to fetch the external facing IP for a given TKG VM.
func (r *ReconcileCnsFileAccessConfig) getVMExternalIP(ctx context.Context,
vm *vmoperatortypes.VirtualMachine) (string, error) {
if commonco.ContainerOrchestratorUtility.IsFSSEnabled(ctx, common.SupportsPerNamespaceNetworkProviders) {
return r.getVMExternalIPFromNetworkSettings(ctx, vm)
}
log := logger.GetLogger(ctx)
networkProvider, err := util.GetNetworkProvider(ctx)
if err != nil {
Expand Down Expand Up @@ -798,7 +801,21 @@ func (r *ReconcileCnsFileAccessConfig) getVMExternalIP(ctx context.Context,
}

tkgVMIP, err := util.GetTKGVMIP(ctx, r.vmOperatorClient,
r.dynamicClient, vm.Namespace, vm.Name, networkProvider)
r.dynamicClient, vm.Namespace, vm.Name, networkProvider, false)
if err != nil {
return "", logger.LogNewErrorf(log, "Failed to get external facing IP address for VM %q/%q. Err: %+v",
vm.Namespace, vm.Name, err)
}
log.Infof("Found tkg VMIP %q for VM %q in namespace %q", tkgVMIP, vm.Name, vm.Namespace)
return tkgVMIP, nil
}

// getVMExternalIPFromNetworkSettings resolves the VM IP when per-namespace NetworkSettings is used.
func (r *ReconcileCnsFileAccessConfig) getVMExternalIPFromNetworkSettings(ctx context.Context,
vm *vmoperatortypes.VirtualMachine) (string, error) {
log := logger.GetLogger(ctx)
tkgVMIP, err := util.GetTKGVMIPFromNetworkSettings(ctx, r.vmOperatorClient, r.dynamicClient,
vm.Namespace, vm.Name)
if err != nil {
return "", logger.LogNewErrorf(log, "Failed to get external facing IP address for VM %q/%q. Err: %+v",
vm.Namespace, vm.Name, err)
Expand Down
Loading