Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
08351b6d
Unverified
Commit
08351b6d
authored
Nov 02, 2018
by
k8s-ci-robot
Committed by
GitHub
Nov 02, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #68230 from bertinatto/remove_mount_propagation_gate
Remove mount propagation feature gate
parents
5581f52c
6c9b8545
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
2 additions
and
79 deletions
+2
-79
util.go
pkg/api/pod/util.go
+0
-17
validation.go
pkg/apis/core/validation/validation.go
+0
-4
validation_test.go
pkg/apis/core/validation/validation_test.go
+0
-20
kube_features.go
pkg/features/kube_features.go
+1
-0
kubelet.go
pkg/kubelet/kubelet.go
+1
-2
kubelet_pods.go
pkg/kubelet/kubelet_pods.go
+0
-4
kubelet_pods_linux_test.go
pkg/kubelet/kubelet_pods_linux_test.go
+0
-25
BUILD
pkg/registry/settings/podpreset/BUILD
+0
-1
strategy.go
pkg/registry/settings/podpreset/strategy.go
+0
-6
No files found.
pkg/api/pod/util.go
View file @
08351b6d
...
...
@@ -248,13 +248,6 @@ func DropDisabledAlphaFields(podSpec *api.PodSpec) {
}
}
for
i
:=
range
podSpec
.
Containers
{
DropDisabledVolumeMountsAlphaFields
(
podSpec
.
Containers
[
i
]
.
VolumeMounts
)
}
for
i
:=
range
podSpec
.
InitContainers
{
DropDisabledVolumeMountsAlphaFields
(
podSpec
.
InitContainers
[
i
]
.
VolumeMounts
)
}
DropDisabledVolumeDevicesAlphaFields
(
podSpec
)
DropDisabledRunAsGroupField
(
podSpec
)
...
...
@@ -304,16 +297,6 @@ func DropDisabledProcMountField(podSpec *api.PodSpec) {
}
}
// DropDisabledVolumeMountsAlphaFields removes disabled fields from []VolumeMount.
// This should be called from PrepareForCreate/PrepareForUpdate for all resources containing a VolumeMount
func
DropDisabledVolumeMountsAlphaFields
(
volumeMounts
[]
api
.
VolumeMount
)
{
if
!
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
MountPropagation
)
{
for
i
:=
range
volumeMounts
{
volumeMounts
[
i
]
.
MountPropagation
=
nil
}
}
}
// DropDisabledVolumeDevicesAlphaFields removes disabled fields from []VolumeDevice.
// This should be called from PrepareForCreate/PrepareForUpdate for all resources containing a VolumeDevice
func
DropDisabledVolumeDevicesAlphaFields
(
podSpec
*
api
.
PodSpec
)
{
...
...
pkg/apis/core/validation/validation.go
View file @
08351b6d
...
...
@@ -1115,10 +1115,6 @@ func validateMountPropagation(mountPropagation *core.MountPropagationMode, conta
if
mountPropagation
==
nil
{
return
allErrs
}
if
!
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
MountPropagation
)
{
allErrs
=
append
(
allErrs
,
field
.
Forbidden
(
fldPath
,
"mount propagation is disabled by feature-gate"
))
return
allErrs
}
supportedMountPropagations
:=
sets
.
NewString
(
string
(
core
.
MountPropagationBidirectional
),
string
(
core
.
MountPropagationHostToContainer
),
string
(
core
.
MountPropagationNone
))
if
!
supportedMountPropagations
.
Has
(
string
(
*
mountPropagation
))
{
...
...
pkg/apis/core/validation/validation_test.go
View file @
08351b6d
...
...
@@ -5038,26 +5038,6 @@ func TestValidateMountPropagation(t *testing.T) {
},
}
// Enable MountPropagation for this test
priorityEnabled
:=
utilfeature
.
DefaultFeatureGate
.
Enabled
(
"MountPropagation"
)
defer
func
()
{
var
err
error
// restoring the old value
if
priorityEnabled
{
err
=
utilfeature
.
DefaultFeatureGate
.
Set
(
"MountPropagation=true"
)
}
else
{
err
=
utilfeature
.
DefaultFeatureGate
.
Set
(
"MountPropagation=false"
)
}
if
err
!=
nil
{
t
.
Errorf
(
"Failed to restore feature gate for MountPropagation: %v"
,
err
)
}
}()
err
:=
utilfeature
.
DefaultFeatureGate
.
Set
(
"MountPropagation=true"
)
if
err
!=
nil
{
t
.
Errorf
(
"Failed to enable feature gate for MountPropagation: %v"
,
err
)
return
}
volumes
:=
[]
core
.
Volume
{
{
Name
:
"foo"
,
VolumeSource
:
core
.
VolumeSource
{
HostPath
:
&
core
.
HostPathVolumeSource
{
Path
:
"/foo/baz"
,
Type
:
newHostPathType
(
string
(
core
.
HostPathUnset
))}}},
}
...
...
pkg/features/kube_features.go
View file @
08351b6d
...
...
@@ -140,6 +140,7 @@ const (
// owner: @jsafrane
// GA: v1.12
//
// Note: This feature gate is unconditionally enabled in v1.13 and will be removed in v1.14.
// Enable mount propagation of volumes.
MountPropagation
utilfeature
.
Feature
=
"MountPropagation"
...
...
pkg/kubelet/kubelet.go
View file @
08351b6d
...
...
@@ -32,7 +32,6 @@ import (
"time"
"github.com/golang/glog"
cadvisorapi
"github.com/google/cadvisor/info/v1"
cadvisorapiv2
"github.com/google/cadvisor/info/v2"
"k8s.io/api/core/v1"
...
...
@@ -777,7 +776,7 @@ func NewMainKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
tokenManager
:=
token
.
NewManager
(
kubeDeps
.
KubeClient
)
if
!
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
MountPropagation
)
{
glog
.
Warning
(
"Mount propagation feature gate has been deprecated and will be removed in the next release
"
)
return
nil
,
fmt
.
Errorf
(
"mount propagation feature gate has been deprecated and will be removed in 1.14
"
)
}
klet
.
volumePluginMgr
,
err
=
...
...
pkg/kubelet/kubelet_pods.go
View file @
08351b6d
...
...
@@ -262,10 +262,6 @@ func translateMountPropagation(mountMode *v1.MountPropagationMode) (runtimeapi.M
return
runtimeapi
.
MountPropagation_PROPAGATION_PRIVATE
,
nil
}
if
!
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
MountPropagation
)
{
// mount propagation is disabled, use private as in the old versions
return
runtimeapi
.
MountPropagation_PROPAGATION_PRIVATE
,
nil
}
switch
{
case
mountMode
==
nil
:
// PRIVATE is the default
...
...
pkg/kubelet/kubelet_pods_linux_test.go
View file @
08351b6d
...
...
@@ -23,7 +23,6 @@ import (
"github.com/stretchr/testify/assert"
"k8s.io/api/core/v1"
utilfeature
"k8s.io/apiserver/pkg/util/feature"
_
"k8s.io/kubernetes/pkg/apis/core/install"
runtimeapi
"k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
...
...
@@ -247,12 +246,6 @@ func TestMakeMounts(t *testing.T) {
HostNetwork
:
true
,
},
}
// test makeMounts with enabled mount propagation
err
:=
utilfeature
.
DefaultFeatureGate
.
Set
(
"MountPropagation=true"
)
if
err
!=
nil
{
t
.
Errorf
(
"Failed to enable feature gate for MountPropagation: %v"
,
err
)
return
}
mounts
,
_
,
err
:=
makeMounts
(
&
pod
,
"/pod"
,
&
tc
.
container
,
"fakepodname"
,
""
,
""
,
tc
.
podVolumes
,
fm
,
nil
)
...
...
@@ -270,24 +263,6 @@ func TestMakeMounts(t *testing.T) {
}
assert
.
Equal
(
t
,
tc
.
expectedMounts
,
mounts
,
"mounts of container %+v"
,
tc
.
container
)
// test makeMounts with disabled mount propagation
err
=
utilfeature
.
DefaultFeatureGate
.
Set
(
"MountPropagation=false"
)
if
err
!=
nil
{
t
.
Errorf
(
"Failed to enable feature gate for MountPropagation: %v"
,
err
)
return
}
mounts
,
_
,
err
=
makeMounts
(
&
pod
,
"/pod"
,
&
tc
.
container
,
"fakepodname"
,
""
,
""
,
tc
.
podVolumes
,
fm
,
nil
)
if
!
tc
.
expectErr
{
expectedPrivateMounts
:=
[]
kubecontainer
.
Mount
{}
for
_
,
mount
:=
range
tc
.
expectedMounts
{
// all mounts are expected to be private when mount
// propagation is disabled
mount
.
Propagation
=
runtimeapi
.
MountPropagation_PROPAGATION_PRIVATE
expectedPrivateMounts
=
append
(
expectedPrivateMounts
,
mount
)
}
assert
.
Equal
(
t
,
expectedPrivateMounts
,
mounts
,
"mounts of container %+v"
,
tc
.
container
)
}
})
}
}
...
...
pkg/registry/settings/podpreset/BUILD
View file @
08351b6d
...
...
@@ -14,7 +14,6 @@ go_library(
importpath = "k8s.io/kubernetes/pkg/registry/settings/podpreset",
deps = [
"//pkg/api/legacyscheme:go_default_library",
"//pkg/api/pod:go_default_library",
"//pkg/apis/settings:go_default_library",
"//pkg/apis/settings/validation:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
...
...
pkg/registry/settings/podpreset/strategy.go
View file @
08351b6d
...
...
@@ -23,7 +23,6 @@ import (
"k8s.io/apimachinery/pkg/util/validation/field"
"k8s.io/apiserver/pkg/storage/names"
"k8s.io/kubernetes/pkg/api/legacyscheme"
"k8s.io/kubernetes/pkg/api/pod"
"k8s.io/kubernetes/pkg/apis/settings"
"k8s.io/kubernetes/pkg/apis/settings/validation"
)
...
...
@@ -46,8 +45,6 @@ func (podPresetStrategy) NamespaceScoped() bool {
func
(
podPresetStrategy
)
PrepareForCreate
(
ctx
context
.
Context
,
obj
runtime
.
Object
)
{
pip
:=
obj
.
(
*
settings
.
PodPreset
)
pip
.
Generation
=
1
pod
.
DropDisabledVolumeMountsAlphaFields
(
pip
.
Spec
.
VolumeMounts
)
}
// PrepareForUpdate clears fields that are not allowed to be set by end users on update.
...
...
@@ -55,9 +52,6 @@ func (podPresetStrategy) PrepareForUpdate(ctx context.Context, obj, old runtime.
newPodPreset
:=
obj
.
(
*
settings
.
PodPreset
)
oldPodPreset
:=
old
.
(
*
settings
.
PodPreset
)
pod
.
DropDisabledVolumeMountsAlphaFields
(
oldPodPreset
.
Spec
.
VolumeMounts
)
pod
.
DropDisabledVolumeMountsAlphaFields
(
newPodPreset
.
Spec
.
VolumeMounts
)
// Update is not allowed
newPodPreset
.
Spec
=
oldPodPreset
.
Spec
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment