Skip to content

Commit 0b22249

Browse files
Remove volume-health fss (#3391)
1 parent c31e318 commit 0b22249

File tree

8 files changed

+46
-59
lines changed

8 files changed

+46
-59
lines changed

manifests/guestcluster/1.33/pvcsi.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,6 @@ metadata:
660660
---
661661
apiVersion: v1
662662
data:
663-
"volume-health": "true"
664663
"online-volume-extend": "true"
665664
"file-volume": "true"
666665
"csi-sv-feature-states-replication": "false" # Do not enable for guest cluster, Refer PR#2386 for details

manifests/supervisorcluster/1.32/cns-csi.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,6 @@ spec:
549549
---
550550
apiVersion: v1
551551
data:
552-
"volume-health": "true"
553552
"online-volume-extend": "true"
554553
"file-volume": "true"
555554
"trigger-csi-fullsync": "false"

pkg/common/unittestcommon/utils.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ func GetFakeContainerOrchestratorInterface(orchestratorType int) (commonco.COCom
5959
fakeCO := &FakeK8SOrchestrator{
6060
featureStatesLock: &sync.RWMutex{},
6161
featureStates: map[string]string{
62-
"volume-health": "true",
6362
"csi-migration": "true",
6463
"file-volume": "true",
6564
"block-volume-snapshot": "true",

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

Lines changed: 36 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ var (
3333
cancel context.CancelFunc
3434
)
3535

36+
const (
37+
feature_flag_1 = "feature_flag_1"
38+
feature_flag_2 = "feature_flag_2"
39+
)
40+
3641
func init() {
3742
// Create context
3843
ctx, cancel = context.WithCancel(context.Background())
@@ -44,8 +49,8 @@ func init() {
4449
// Scenario 2: FSS is disabled both in SV and GC
4550
func TestIsFSSEnabledInGcWithSync(t *testing.T) {
4651
svFSS := map[string]string{
47-
"volume-extend": "true",
48-
"volume-health": "false",
52+
feature_flag_1: "true",
53+
feature_flag_2: "false",
4954
}
5055
svFSSConfigMapInfo := FSSConfigMapInfo{
5156
configMapName: cnsconfig.DefaultSupervisorFSSConfigMapName,
@@ -54,8 +59,8 @@ func TestIsFSSEnabledInGcWithSync(t *testing.T) {
5459
featureStatesLock: &sync.RWMutex{},
5560
}
5661
internalFSS := map[string]string{
57-
"volume-extend": "true",
58-
"volume-health": "false",
62+
feature_flag_1: "true",
63+
feature_flag_2: "false",
5964
}
6065
internalFSSConfigMapInfo := FSSConfigMapInfo{
6166
configMapName: cnsconfig.DefaultInternalFSSConfigMapName,
@@ -68,13 +73,13 @@ func TestIsFSSEnabledInGcWithSync(t *testing.T) {
6873
clusterFlavor: cnstypes.CnsClusterFlavorGuest,
6974
internalFSS: internalFSSConfigMapInfo,
7075
}
71-
isEnabled := k8sOrchestrator.IsFSSEnabled(ctx, "volume-extend")
76+
isEnabled := k8sOrchestrator.IsFSSEnabled(ctx, feature_flag_1)
7277
if !isEnabled {
73-
t.Errorf("volume-extend feature state is disabled!")
78+
t.Errorf("%s feature state is disabled!", feature_flag_1)
7479
}
75-
isEnabled = k8sOrchestrator.IsFSSEnabled(ctx, "volume-health")
80+
isEnabled = k8sOrchestrator.IsFSSEnabled(ctx, feature_flag_2)
7681
if isEnabled {
77-
t.Errorf("volume-health feature state is enabled!")
82+
t.Errorf("%s feature state is enabled!", feature_flag_2)
7883
}
7984
}
8085

@@ -83,8 +88,8 @@ func TestIsFSSEnabledInGcWithSync(t *testing.T) {
8388
// Scenario 2: FSS is disabled in SV but enabled in GC
8489
func TestIsFSSEnabledInGcWithoutSync(t *testing.T) {
8590
svFSS := map[string]string{
86-
"volume-extend": "true",
87-
"volume-health": "false",
91+
feature_flag_1: "true",
92+
feature_flag_2: "false",
8893
}
8994
svFSSConfigMapInfo := FSSConfigMapInfo{
9095
configMapName: cnsconfig.DefaultSupervisorFSSConfigMapName,
@@ -93,8 +98,8 @@ func TestIsFSSEnabledInGcWithoutSync(t *testing.T) {
9398
featureStatesLock: &sync.RWMutex{},
9499
}
95100
internalFSS := map[string]string{
96-
"volume-extend": "false",
97-
"volume-health": "true",
101+
feature_flag_1: "false",
102+
feature_flag_2: "true",
98103
}
99104
internalFSSConfigMapInfo := FSSConfigMapInfo{
100105
configMapName: cnsconfig.DefaultInternalFSSConfigMapName,
@@ -107,13 +112,13 @@ func TestIsFSSEnabledInGcWithoutSync(t *testing.T) {
107112
clusterFlavor: cnstypes.CnsClusterFlavorGuest,
108113
internalFSS: internalFSSConfigMapInfo,
109114
}
110-
isEnabled := k8sOrchestrator.IsFSSEnabled(ctx, "volume-extend")
115+
isEnabled := k8sOrchestrator.IsFSSEnabled(ctx, feature_flag_1)
111116
if isEnabled {
112-
t.Errorf("volume-extend feature state is enabled!")
117+
t.Errorf("%s feature state is enabled!", feature_flag_1)
113118
}
114-
isEnabled = k8sOrchestrator.IsFSSEnabled(ctx, "volume-health")
119+
isEnabled = k8sOrchestrator.IsFSSEnabled(ctx, feature_flag_2)
115120
if isEnabled {
116-
t.Errorf("volume-health feature state is enabled!")
121+
t.Errorf("%s feature state is enabled!", feature_flag_2)
117122
}
118123
}
119124

@@ -122,8 +127,8 @@ func TestIsFSSEnabledInGcWithoutSync(t *testing.T) {
122127
// Scenario 2: Missing feature state
123128
func TestIsFSSEnabledInGcWrongValues(t *testing.T) {
124129
svFSS := map[string]string{
125-
"volume-extend": "true",
126-
"volume-health": "true",
130+
feature_flag_1: "true",
131+
feature_flag_2: "true",
127132
}
128133
svFSSConfigMapInfo := FSSConfigMapInfo{
129134
configMapName: cnsconfig.DefaultSupervisorFSSConfigMapName,
@@ -132,7 +137,7 @@ func TestIsFSSEnabledInGcWrongValues(t *testing.T) {
132137
featureStatesLock: &sync.RWMutex{},
133138
}
134139
internalFSS := map[string]string{
135-
"volume-extend": "enabled",
140+
feature_flag_1: "enabled",
136141
}
137142
internalFSSConfigMapInfo := FSSConfigMapInfo{
138143
configMapName: cnsconfig.DefaultInternalFSSConfigMapName,
@@ -146,22 +151,22 @@ func TestIsFSSEnabledInGcWrongValues(t *testing.T) {
146151
internalFSS: internalFSSConfigMapInfo,
147152
}
148153
// Wrong value given
149-
isEnabled := k8sOrchestrator.IsFSSEnabled(ctx, "volume-extend")
154+
isEnabled := k8sOrchestrator.IsFSSEnabled(ctx, feature_flag_1)
150155
if isEnabled {
151-
t.Errorf("volume-extend feature state is enabled even when it was assigned a wrong value!")
156+
t.Errorf("%s feature state is enabled even when it was assigned a wrong value!", feature_flag_1)
152157
}
153158
// Feature state missing
154-
isEnabled = k8sOrchestrator.IsFSSEnabled(ctx, "volume-health")
159+
isEnabled = k8sOrchestrator.IsFSSEnabled(ctx, feature_flag_2)
155160
if isEnabled {
156-
t.Errorf("Non existing feature state volume-health is enabled!")
161+
t.Errorf("Non existing feature state %s is enabled!", feature_flag_2)
157162
}
158163
}
159164

160165
// TestIsFSSEnabledInSV tests IsFSSEnabled in Supervisor flavor - all scenarios
161166
func TestIsFSSEnabledInSV(t *testing.T) {
162167
svFSS := map[string]string{
163-
"volume-extend": "true",
164-
"volume-health": "false",
168+
feature_flag_1: "true",
169+
feature_flag_2: "false",
165170
"csi-migration": "enabled",
166171
}
167172
svFSSConfigMapInfo := FSSConfigMapInfo{
@@ -174,13 +179,13 @@ func TestIsFSSEnabledInSV(t *testing.T) {
174179
supervisorFSS: svFSSConfigMapInfo,
175180
clusterFlavor: cnstypes.CnsClusterFlavorWorkload,
176181
}
177-
isEnabled := k8sOrchestrator.IsFSSEnabled(ctx, "volume-extend")
182+
isEnabled := k8sOrchestrator.IsFSSEnabled(ctx, feature_flag_1)
178183
if !isEnabled {
179-
t.Errorf("volume-extend feature state is disabled!")
184+
t.Errorf("%s feature state is disabled!", feature_flag_1)
180185
}
181-
isEnabled = k8sOrchestrator.IsFSSEnabled(ctx, "volume-health")
186+
isEnabled = k8sOrchestrator.IsFSSEnabled(ctx, feature_flag_2)
182187
if isEnabled {
183-
t.Errorf("volume-health feature state is enabled!")
188+
t.Errorf("%s feature state is enabled!", feature_flag_2)
184189
}
185190
// Wrong value given
186191
isEnabled = k8sOrchestrator.IsFSSEnabled(ctx, "csi-migration")
@@ -218,9 +223,9 @@ func TestIsFSSEnabledWithWrongClusterFlavor(t *testing.T) {
218223
k8sOrchestrator := K8sOrchestrator{
219224
clusterFlavor: "Vanila",
220225
}
221-
isEnabled := k8sOrchestrator.IsFSSEnabled(ctx, "volume-extend")
226+
isEnabled := k8sOrchestrator.IsFSSEnabled(ctx, feature_flag_1)
222227
if isEnabled {
223-
t.Errorf("volume-extend feature state enabled even when cluster flavor is wrong")
228+
t.Errorf("%s feature state enabled even when cluster flavor is wrong", feature_flag_1)
224229
}
225230
}
226231

pkg/csi/service/common/constants.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -377,9 +377,6 @@ const (
377377
const (
378378
// Default interval to check if the feature is enabled or not.
379379
DefaultFeatureEnablementCheckInterval = 1 * time.Minute
380-
// VolumeHealth is the feature flag name for volume health.
381-
VolumeHealth = "volume-health"
382-
383380
// OnlineVolumeExtend guards the feature for online volume expansion.
384381
OnlineVolumeExtend = "online-volume-extend"
385382
// CSIMigration is feature flag for migrating in-tree vSphere volumes to CSI.

pkg/syncer/admissionhandler/admissionhandler.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ var (
5858
featureGateCsiMigrationEnabled bool
5959
featureGateBlockVolumeSnapshotEnabled bool
6060
featureGateTKGSHaEnabled bool
61-
featureGateVolumeHealthEnabled bool
6261
featureGateTopologyAwareFileVolumeEnabled bool
6362
featureGateByokEnabled bool
6463
featureFileVolumesWithVmServiceEnabled bool
@@ -146,7 +145,6 @@ func StartWebhookServer(ctx context.Context, enableWebhookClientCertVerification
146145

147146
if clusterFlavor == cnstypes.CnsClusterFlavorWorkload {
148147
featureGateTKGSHaEnabled = containerOrchestratorUtility.IsFSSEnabled(ctx, common.TKGsHA)
149-
featureGateVolumeHealthEnabled = containerOrchestratorUtility.IsFSSEnabled(ctx, common.VolumeHealth)
150148
featureGateBlockVolumeSnapshotEnabled = containerOrchestratorUtility.IsFSSEnabled(ctx, common.BlockVolumeSnapshot)
151149
featureGateByokEnabled = containerOrchestratorUtility.IsFSSEnabled(ctx, common.WCP_VMService_BYOK)
152150
featureIsSharedDiskEnabled = containerOrchestratorUtility.IsFSSEnabled(ctx, common.SharedDiskFss)

pkg/syncer/admissionhandler/cnscsi_admissionhandler.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -184,11 +184,9 @@ func (h *CSISupervisorWebhook) Handle(ctx context.Context, req admission.Request
184184
return
185185
}
186186
}
187-
if featureGateVolumeHealthEnabled {
188-
resp = validatePVCAnnotationForVolumeHealth(ctx, req)
189-
if !resp.Allowed {
190-
return
191-
}
187+
resp = validatePVCAnnotationForVolumeHealth(ctx, req)
188+
if !resp.Allowed {
189+
return
192190
}
193191
if featureGateBlockVolumeSnapshotEnabled {
194192
admissionResp := validatePVC(ctx, &req.AdmissionRequest)

pkg/syncer/metadatasyncer.go

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -826,12 +826,8 @@ func InitMetadataSyncer(ctx context.Context, clusterFlavor cnstypes.CnsClusterFl
826826
go func() {
827827
for ; true; <-volumeHealthTicker.C {
828828
ctx, log = logger.GetNewContextWithLogger()
829-
if !metadataSyncer.coCommonInterface.IsFSSEnabled(ctx, common.VolumeHealth) {
830-
log.Warnf("VolumeHealth feature is disabled on the cluster")
831-
} else {
832-
log.Infof("getVolumeHealthStatus is triggered")
833-
csiGetVolumeHealthStatus(ctx, k8sClient, metadataSyncer)
834-
}
829+
log.Infof("getVolumeHealthStatus is triggered")
830+
csiGetVolumeHealthStatus(ctx, k8sClient, metadataSyncer)
835831
}
836832
}()
837833
if IsPodVMOnStretchSupervisorFSSEnabled {
@@ -859,16 +855,12 @@ func InitMetadataSyncer(ctx context.Context, clusterFlavor cnstypes.CnsClusterFl
859855
go func() {
860856
for ; true; <-volumeHealthEnablementTicker.C {
861857
ctx, log = logger.GetNewContextWithLogger()
862-
if !metadataSyncer.coCommonInterface.IsFSSEnabled(ctx, common.VolumeHealth) {
863-
log.Debugf("VolumeHealth feature is disabled on the cluster")
864-
} else {
865-
if err := initVolumeHealthReconciler(ctx, k8sClient, metadataSyncer.supervisorClient); err != nil {
866-
log.Warnf("Error while initializing volume health reconciler. Err:%+v. Retry will be triggered at %v",
867-
err, time.Now().Add(common.DefaultFeatureEnablementCheckInterval))
868-
continue
869-
}
870-
break
858+
if err := initVolumeHealthReconciler(ctx, k8sClient, metadataSyncer.supervisorClient); err != nil {
859+
log.Warnf("Error while initializing volume health reconciler. Err:%+v. Retry will be triggered at %v",
860+
err, time.Now().Add(common.DefaultFeatureEnablementCheckInterval))
861+
continue
871862
}
863+
break
872864
}
873865
}()
874866

0 commit comments

Comments
 (0)