Skip to content

Commit

Permalink
Introduce FSS supervisor-block-volume-snapshot for CSI Snapshot suppo…
Browse files Browse the repository at this point in the history
…rt on Supervisor

Signed-off-by: Deepak Kinni <[email protected]>
  • Loading branch information
deepakkinni committed Aug 2, 2024
1 parent 2bb14e7 commit 6a286ac
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 9 deletions.
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
16 changes: 9 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,7 @@ 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

0 comments on commit 6a286ac

Please sign in to comment.