Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce FSS supervisor-block-volume-snapshot for CSI Snapshot support on Supervisor #2980

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
1 change: 1 addition & 0 deletions manifests/supervisorcluster/1.27/cns-csi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@ data:
"storage-quota-m2": "false"
"vdpp-on-stretched-supervisor": "false"
"cns-unregister-volume": "false"
"supervisor-block-volume-snapshot": "false"
kind: ConfigMap
metadata:
name: csi-feature-states
Expand Down
1 change: 1 addition & 0 deletions manifests/supervisorcluster/1.28/cns-csi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@ data:
"storage-quota-m2": "false"
"vdpp-on-stretched-supervisor": "false"
"cns-unregister-volume": "false"
"supervisor-block-volume-snapshot": "false"
kind: ConfigMap
metadata:
name: csi-feature-states
Expand Down
1 change: 1 addition & 0 deletions manifests/supervisorcluster/1.29/cns-csi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@ data:
"storage-quota-m2": "false"
"vdpp-on-stretched-supervisor": "false"
"cns-unregister-volume": "false"
"supervisor-block-volume-snapshot": "false"
kind: ConfigMap
metadata:
name: csi-feature-states
Expand Down
2 changes: 2 additions & 0 deletions pkg/csi/service/common/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,8 @@ const (
CSIDetachOnSupervisor = "CSI_Detach_Supported"
// CnsUnregisterVolume enables the cretion of CRD and controller for CnsUnregisterVolume API.
CnsUnregisterVolume = "cns-unregister-volume"
// SupervisorBlockVolumeSnapshots enables the creation of CSI snapshots on supervisor directly.
SupervisorBlockVolumeSnapshots = "supervisor-block-volume-snapshot"
)

var WCPFeatureStates = map[string]struct{}{
Expand Down
17 changes: 10 additions & 7 deletions pkg/syncer/admissionhandler/admissionhandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,14 @@ var (
cfg *config
// COInitParams stores the input params required for initiating the
// CO agnostic orchestrator in the admission handler package.
COInitParams *interface{}
featureGateCsiMigrationEnabled bool
featureGateBlockVolumeSnapshotEnabled bool
featureGateTKGSHaEnabled bool
featureGateVolumeHealthEnabled bool
featureGateTopologyAwareFileVolumeEnabled bool
featureGateStorageQuotaM2Enabled bool
COInitParams *interface{}
featureGateCsiMigrationEnabled bool
featureGateBlockVolumeSnapshotEnabled bool
featureGateTKGSHaEnabled bool
featureGateVolumeHealthEnabled bool
featureGateTopologyAwareFileVolumeEnabled bool
featureGateStorageQuotaM2Enabled bool
featureGateSupervisorBlockVolumeSnapshotEnabled bool
)

// watchConfigChange watches on the webhook configuration directory for changes
Expand Down Expand Up @@ -144,6 +145,8 @@ func StartWebhookServer(ctx context.Context) error {
featureGateVolumeHealthEnabled = containerOrchestratorUtility.IsFSSEnabled(ctx, common.VolumeHealth)
featureGateBlockVolumeSnapshotEnabled = containerOrchestratorUtility.IsFSSEnabled(ctx, common.BlockVolumeSnapshot)
featureGateStorageQuotaM2Enabled = containerOrchestratorUtility.IsFSSEnabled(ctx, common.StorageQuotaM2)
featureGateSupervisorBlockVolumeSnapshotEnabled =
containerOrchestratorUtility.IsFSSEnabled(ctx, common.SupervisorBlockVolumeSnapshots)
startCNSCSIWebhookManager(ctx)
} else if clusterFlavor == cnstypes.CnsClusterFlavorGuest {
featureGateBlockVolumeSnapshotEnabled = containerOrchestratorUtility.IsFSSEnabled(ctx, common.BlockVolumeSnapshot)
Expand Down
5 changes: 3 additions & 2 deletions pkg/syncer/admissionhandler/validatesnapshotoperation.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ func validateSnapshotOperationSupervisorRequest(ctx context.Context, request adm
if request.Operation == admissionv1.Create {
// NOTE: Change to allow snapshot creation from supervisor directly with StorageQuotaM2 FSS enabled
// is temporary & will be reverted before release
if featureGateStorageQuotaM2Enabled {
log.Debugf("validateSnapshotOperationSupervisorRequest Allow %v since StorageQuotaM2 FSS enabled", request)
if featureGateStorageQuotaM2Enabled || featureGateSupervisorBlockVolumeSnapshotEnabled {
log.Debugf("validateSnapshotOperationSupervisorRequest Allow %v since "+
"StorageQuotaM2 or supervisor-block-volume-snapshot FSS enabled", request)
return admission.Allowed("")
}
if _, annotationFound := newVS.Annotations[common.SupervisorVolumeSnapshotAnnotationKey]; !annotationFound {
Expand Down