remove AllowImageVolumeSource

This commit is contained in:
carlory
2024-09-13 23:41:06 +08:00
parent 24a50a3ddf
commit 684fbd6f20
4 changed files with 17 additions and 85 deletions

View File

@@ -2553,48 +2553,6 @@ func TestValidateAllowNonLocalProjectedTokenPathOption(t *testing.T) {
}
}
func TestValidateAllowImageVolumeSourceOption(t *testing.T) {
testCases := []struct {
name string
oldPodSpec *api.PodSpec
featureEnabled bool
wantOption bool
}{
{
name: "CreateFeatureEnabled",
featureEnabled: true,
wantOption: true,
},
{
name: "CreateFeatureDisabled",
featureEnabled: false,
wantOption: false,
},
{
name: "UpdateFeatureDisabled",
oldPodSpec: &api.PodSpec{Volumes: []api.Volume{{VolumeSource: api.VolumeSource{Image: &api.ImageVolumeSource{Reference: "image"}}}}},
featureEnabled: false,
wantOption: true,
},
{
name: "UpdateFeatureEnabled",
oldPodSpec: &api.PodSpec{Volumes: []api.Volume{{VolumeSource: api.VolumeSource{Image: &api.ImageVolumeSource{Reference: "image"}}}}},
featureEnabled: true,
wantOption: true,
},
}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.ImageVolume, tc.featureEnabled)
gotOptions := GetValidationOptionsFromPodSpecAndMeta(nil, tc.oldPodSpec, nil, nil)
if tc.wantOption != gotOptions.AllowImageVolumeSource {
t.Errorf("unexpected diff, want: %v, got: %v", tc.wantOption, gotOptions.AllowImageVolumeSource)
}
})
}
}
func TestDropInPlacePodVerticalScaling(t *testing.T) {
podWithInPlaceVerticalScaling := func() *api.Pod {
return &api.Pod{