mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Merge pull request #89584 from kevtaylor/kep/VolumeSubpathExpansion-Remove-FeatureGate
Remove VolumeSubpathEnvExpansion Feature Gate
This commit is contained in:
commit
357d3c9f93
@ -396,8 +396,8 @@ func dropDisabledFields(
|
|||||||
podSpec.EphemeralContainers = nil
|
podSpec.EphemeralContainers = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!utilfeature.DefaultFeatureGate.Enabled(features.VolumeSubpath) || !utilfeature.DefaultFeatureGate.Enabled(features.VolumeSubpathEnvExpansion)) && !subpathExprInUse(oldPodSpec) {
|
if !utilfeature.DefaultFeatureGate.Enabled(features.VolumeSubpath) && !subpathExprInUse(oldPodSpec) {
|
||||||
// drop subpath env expansion from the pod if either of the subpath features is disabled and the old spec did not specify subpath env expansion
|
// drop subpath env expansion from the pod if subpath feature is disabled and the old spec did not specify subpath env expansion
|
||||||
VisitContainers(podSpec, AllContainers, func(c *api.Container, containerType ContainerType) bool {
|
VisitContainers(podSpec, AllContainers, func(c *api.Container, containerType ContainerType) bool {
|
||||||
for i := range c.VolumeMounts {
|
for i := range c.VolumeMounts {
|
||||||
c.VolumeMounts[i].SubPathExpr = ""
|
c.VolumeMounts[i].SubPathExpr = ""
|
||||||
|
@ -1512,7 +1512,6 @@ func TestDropSubPathExpr(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
t.Run(fmt.Sprintf("feature enabled=%v, old pod %v, new pod %v", enabled, oldPodInfo.description, newPodInfo.description), func(t *testing.T) {
|
t.Run(fmt.Sprintf("feature enabled=%v, old pod %v, new pod %v", enabled, oldPodInfo.description, newPodInfo.description), func(t *testing.T) {
|
||||||
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.VolumeSubpathEnvExpansion, enabled)()
|
|
||||||
|
|
||||||
var oldPodSpec *api.PodSpec
|
var oldPodSpec *api.PodSpec
|
||||||
if oldPod != nil {
|
if oldPod != nil {
|
||||||
|
@ -5053,8 +5053,7 @@ func TestValidateDisabledSubpath(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestValidateSubpathMutuallyExclusive(t *testing.T) {
|
func TestValidateSubpathMutuallyExclusive(t *testing.T) {
|
||||||
// Enable feature VolumeSubpathEnvExpansion and VolumeSubpath
|
// Enable feature VolumeSubpath
|
||||||
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.VolumeSubpathEnvExpansion, true)()
|
|
||||||
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.VolumeSubpath, true)()
|
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.VolumeSubpath, true)()
|
||||||
|
|
||||||
volumes := []core.Volume{
|
volumes := []core.Volume{
|
||||||
@ -5137,8 +5136,6 @@ func TestValidateSubpathMutuallyExclusive(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestValidateDisabledSubpathExpr(t *testing.T) {
|
func TestValidateDisabledSubpathExpr(t *testing.T) {
|
||||||
// Enable feature VolumeSubpathEnvExpansion
|
|
||||||
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.VolumeSubpathEnvExpansion, true)()
|
|
||||||
|
|
||||||
volumes := []core.Volume{
|
volumes := []core.Volume{
|
||||||
{Name: "abc", VolumeSource: core.VolumeSource{PersistentVolumeClaim: &core.PersistentVolumeClaimVolumeSource{ClaimName: "testclaim1"}}},
|
{Name: "abc", VolumeSource: core.VolumeSource{PersistentVolumeClaim: &core.PersistentVolumeClaimVolumeSource{ClaimName: "testclaim1"}}},
|
||||||
|
@ -288,15 +288,6 @@ const (
|
|||||||
// while making decisions.
|
// while making decisions.
|
||||||
BalanceAttachedNodeVolumes featuregate.Feature = "BalanceAttachedNodeVolumes"
|
BalanceAttachedNodeVolumes featuregate.Feature = "BalanceAttachedNodeVolumes"
|
||||||
|
|
||||||
// owner: @kevtaylor
|
|
||||||
// alpha: v1.14
|
|
||||||
// beta: v1.15
|
|
||||||
// ga: v1.17
|
|
||||||
//
|
|
||||||
// Allow subpath environment variable substitution
|
|
||||||
// Only applicable if the VolumeSubpath feature is also enabled
|
|
||||||
VolumeSubpathEnvExpansion featuregate.Feature = "VolumeSubpathEnvExpansion"
|
|
||||||
|
|
||||||
// owner: @vladimirvivien
|
// owner: @vladimirvivien
|
||||||
// alpha: v1.11
|
// alpha: v1.11
|
||||||
// beta: v1.14
|
// beta: v1.14
|
||||||
@ -646,7 +637,6 @@ var defaultKubernetesFeatureGates = map[featuregate.Feature]featuregate.FeatureS
|
|||||||
VolumeSubpath: {Default: true, PreRelease: featuregate.GA},
|
VolumeSubpath: {Default: true, PreRelease: featuregate.GA},
|
||||||
ConfigurableFSGroupPolicy: {Default: false, PreRelease: featuregate.Alpha},
|
ConfigurableFSGroupPolicy: {Default: false, PreRelease: featuregate.Alpha},
|
||||||
BalanceAttachedNodeVolumes: {Default: false, PreRelease: featuregate.Alpha},
|
BalanceAttachedNodeVolumes: {Default: false, PreRelease: featuregate.Alpha},
|
||||||
VolumeSubpathEnvExpansion: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.19,
|
|
||||||
CSIBlockVolume: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.20
|
CSIBlockVolume: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.20
|
||||||
CSIInlineVolume: {Default: true, PreRelease: featuregate.Beta},
|
CSIInlineVolume: {Default: true, PreRelease: featuregate.Beta},
|
||||||
RuntimeClass: {Default: true, PreRelease: featuregate.Beta},
|
RuntimeClass: {Default: true, PreRelease: featuregate.Beta},
|
||||||
|
@ -167,10 +167,6 @@ func makeMounts(pod *v1.Pod, podDir string, container *v1.Container, hostName, h
|
|||||||
return nil, cleanupAction, fmt.Errorf("volume subpaths are disabled")
|
return nil, cleanupAction, fmt.Errorf("volume subpaths are disabled")
|
||||||
}
|
}
|
||||||
|
|
||||||
if !utilfeature.DefaultFeatureGate.Enabled(features.VolumeSubpathEnvExpansion) {
|
|
||||||
return nil, cleanupAction, fmt.Errorf("volume subpath expansion is disabled")
|
|
||||||
}
|
|
||||||
|
|
||||||
subPath, err = kubecontainer.ExpandContainerVolumeMounts(mount, expandEnvs)
|
subPath, err = kubecontainer.ExpandContainerVolumeMounts(mount, expandEnvs)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user