Merge pull request #72382 from liggitt/volumescheduling-ga
Stop checking VolumeScheduling feature gate
This commit is contained in:
@@ -1777,11 +1777,9 @@ func ValidatePersistentVolumeUpdate(newPv, oldPv *core.PersistentVolume) field.E
|
||||
|
||||
allErrs = append(allErrs, ValidateImmutableField(newPv.Spec.VolumeMode, oldPv.Spec.VolumeMode, field.NewPath("volumeMode"))...)
|
||||
|
||||
if utilfeature.DefaultFeatureGate.Enabled(features.VolumeScheduling) {
|
||||
// Allow setting NodeAffinity if oldPv NodeAffinity was not set
|
||||
if oldPv.Spec.NodeAffinity != nil {
|
||||
allErrs = append(allErrs, ValidateImmutableField(newPv.Spec.NodeAffinity, oldPv.Spec.NodeAffinity, field.NewPath("nodeAffinity"))...)
|
||||
}
|
||||
// Allow setting NodeAffinity if oldPv NodeAffinity was not set
|
||||
if oldPv.Spec.NodeAffinity != nil {
|
||||
allErrs = append(allErrs, ValidateImmutableField(newPv.Spec.NodeAffinity, oldPv.Spec.NodeAffinity, field.NewPath("nodeAffinity"))...)
|
||||
}
|
||||
|
||||
return allErrs
|
||||
@@ -3160,22 +3158,17 @@ func ValidateTopologySelectorTerm(term core.TopologySelectorTerm, fldPath *field
|
||||
exprMap := make(map[string]sets.String)
|
||||
exprPath := fldPath.Child("matchLabelExpressions")
|
||||
|
||||
if utilfeature.DefaultFeatureGate.Enabled(features.VolumeScheduling) {
|
||||
// Allow empty MatchLabelExpressions, in case this field becomes optional in the future.
|
||||
// Allow empty MatchLabelExpressions, in case this field becomes optional in the future.
|
||||
for i, req := range term.MatchLabelExpressions {
|
||||
idxPath := exprPath.Index(i)
|
||||
valueSet, exprErrs := validateTopologySelectorLabelRequirement(req, idxPath)
|
||||
allErrs = append(allErrs, exprErrs...)
|
||||
|
||||
for i, req := range term.MatchLabelExpressions {
|
||||
idxPath := exprPath.Index(i)
|
||||
valueSet, exprErrs := validateTopologySelectorLabelRequirement(req, idxPath)
|
||||
allErrs = append(allErrs, exprErrs...)
|
||||
|
||||
// Validate no duplicate keys exist.
|
||||
if _, exists := exprMap[req.Key]; exists {
|
||||
allErrs = append(allErrs, field.Duplicate(idxPath.Child("key"), req.Key))
|
||||
}
|
||||
exprMap[req.Key] = valueSet
|
||||
// Validate no duplicate keys exist.
|
||||
if _, exists := exprMap[req.Key]; exists {
|
||||
allErrs = append(allErrs, field.Duplicate(idxPath.Child("key"), req.Key))
|
||||
}
|
||||
} else if len(term.MatchLabelExpressions) != 0 {
|
||||
allErrs = append(allErrs, field.Forbidden(fldPath, "field is disabled by feature-gate VolumeScheduling"))
|
||||
exprMap[req.Key] = valueSet
|
||||
}
|
||||
|
||||
return exprMap, allErrs
|
||||
@@ -5319,10 +5312,6 @@ func validateVolumeNodeAffinity(nodeAffinity *core.VolumeNodeAffinity, fldPath *
|
||||
return false, allErrs
|
||||
}
|
||||
|
||||
if !utilfeature.DefaultFeatureGate.Enabled(features.VolumeScheduling) {
|
||||
allErrs = append(allErrs, field.Forbidden(fldPath, "Volume node affinity is disabled by feature-gate"))
|
||||
}
|
||||
|
||||
if nodeAffinity.Required != nil {
|
||||
allErrs = append(allErrs, ValidateNodeSelector(nodeAffinity.Required, fldPath.Child("required"))...)
|
||||
} else {
|
||||
|
@@ -577,19 +577,6 @@ func TestValidateLocalVolumesDisabled(t *testing.T) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
for name, scenario := range scenarios {
|
||||
t.Run(name+" VolumeScheduling disabled", func(t *testing.T) {
|
||||
defer utilfeaturetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.VolumeScheduling, false)()
|
||||
errs := ValidatePersistentVolume(scenario.volume)
|
||||
if len(errs) == 0 && scenario.isExpectedFailure {
|
||||
t.Errorf("Unexpected success for scenario: %s", name)
|
||||
}
|
||||
if len(errs) > 0 && !scenario.isExpectedFailure {
|
||||
t.Errorf("Unexpected failure for scenario: %s - %+v", name, errs)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func testVolumeWithNodeAffinity(affinity *core.VolumeNodeAffinity) *core.PersistentVolume {
|
||||
|
Reference in New Issue
Block a user