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
05559c04
Unverified
Commit
05559c04
authored
May 15, 2018
by
Lucas Käldström
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kubeadm: Remove the .PrivilegedPods configuration option
parent
adb60f40
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
1 addition
and
81 deletions
+1
-81
types.go
cmd/kubeadm/app/apis/kubeadm/types.go
+0
-5
conversion.go
cmd/kubeadm/app/apis/kubeadm/v1alpha1/conversion.go
+1
-10
types.go
cmd/kubeadm/app/apis/kubeadm/v1alpha2/types.go
+0
-5
common_test.go
cmd/kubeadm/app/cmd/upgrade/common_test.go
+0
-3
manifests.go
cmd/kubeadm/app/phases/controlplane/manifests.go
+0
-14
manifests_test.go
cmd/kubeadm/app/phases/controlplane/manifests_test.go
+0
-44
No files found.
cmd/kubeadm/app/apis/kubeadm/types.go
View file @
05559c04
...
@@ -54,11 +54,6 @@ type MasterConfiguration struct {
...
@@ -54,11 +54,6 @@ type MasterConfiguration struct {
// single node configurations).
// single node configurations).
NoTaintMaster
bool
NoTaintMaster
bool
// Mark the controller and api server pods as privileged as some cloud
// controllers like openstack need escalated privileges under some conditions
// example - loading a config drive to fetch node information.
PrivilegedPods
bool
// Token is used for establishing bidirectional trust between nodes and masters.
// Token is used for establishing bidirectional trust between nodes and masters.
// Used for joining nodes in the cluster.
// Used for joining nodes in the cluster.
Token
string
Token
string
...
...
cmd/kubeadm/app/apis/kubeadm/v1alpha1/conversion.go
View file @
05559c04
...
@@ -25,7 +25,6 @@ import (
...
@@ -25,7 +25,6 @@ import (
func
addConversionFuncs
(
scheme
*
runtime
.
Scheme
)
error
{
func
addConversionFuncs
(
scheme
*
runtime
.
Scheme
)
error
{
// Add non-generated conversion functions
// Add non-generated conversion functions
err
:=
scheme
.
AddConversionFuncs
(
err
:=
scheme
.
AddConversionFuncs
(
Convert_kubeadm_MasterConfiguration_To_v1alpha1_MasterConfiguration
,
Convert_v1alpha1_MasterConfiguration_To_kubeadm_MasterConfiguration
,
Convert_v1alpha1_MasterConfiguration_To_kubeadm_MasterConfiguration
,
)
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -35,21 +34,13 @@ func addConversionFuncs(scheme *runtime.Scheme) error {
...
@@ -35,21 +34,13 @@ func addConversionFuncs(scheme *runtime.Scheme) error {
return
nil
return
nil
}
}
func
Convert_kubeadm_MasterConfiguration_To_v1alpha1_MasterConfiguration
(
in
*
kubeadm
.
MasterConfiguration
,
out
*
MasterConfiguration
,
s
conversion
.
Scope
)
error
{
if
err
:=
autoConvert_kubeadm_MasterConfiguration_To_v1alpha1_MasterConfiguration
(
in
,
out
,
s
);
err
!=
nil
{
return
err
}
// Setting .CloudProvider is not supported from internal API not supported
return
nil
}
func
Convert_v1alpha1_MasterConfiguration_To_kubeadm_MasterConfiguration
(
in
*
MasterConfiguration
,
out
*
kubeadm
.
MasterConfiguration
,
s
conversion
.
Scope
)
error
{
func
Convert_v1alpha1_MasterConfiguration_To_kubeadm_MasterConfiguration
(
in
*
MasterConfiguration
,
out
*
kubeadm
.
MasterConfiguration
,
s
conversion
.
Scope
)
error
{
if
err
:=
autoConvert_v1alpha1_MasterConfiguration_To_kubeadm_MasterConfiguration
(
in
,
out
,
s
);
err
!=
nil
{
if
err
:=
autoConvert_v1alpha1_MasterConfiguration_To_kubeadm_MasterConfiguration
(
in
,
out
,
s
);
err
!=
nil
{
return
err
return
err
}
}
UpgradeCloudProvider
(
in
,
out
)
UpgradeCloudProvider
(
in
,
out
)
// We don't support migrating information from the .PrivilegedPods field which was removed in v1alpha2
return
nil
return
nil
}
}
...
...
cmd/kubeadm/app/apis/kubeadm/v1alpha2/types.go
View file @
05559c04
...
@@ -54,11 +54,6 @@ type MasterConfiguration struct {
...
@@ -54,11 +54,6 @@ type MasterConfiguration struct {
// single node configurations).
// single node configurations).
NoTaintMaster
bool
`json:"noTaintMaster,omitempty"`
NoTaintMaster
bool
`json:"noTaintMaster,omitempty"`
// Mark the controller and api server pods as privileged as some cloud
// controllers like openstack need escalated privileges under some conditions
// example - loading a config drive to fetch node information
PrivilegedPods
bool
`json:"privilegedPods"`
// Token is used for establishing bidirectional trust between nodes and masters.
// Token is used for establishing bidirectional trust between nodes and masters.
// Used for joining nodes in the cluster.
// Used for joining nodes in the cluster.
Token
string
`json:"token"`
Token
string
`json:"token"`
...
...
cmd/kubeadm/app/cmd/upgrade/common_test.go
View file @
05559c04
...
@@ -64,7 +64,6 @@ func TestPrintConfiguration(t *testing.T) {
...
@@ -64,7 +64,6 @@ func TestPrintConfiguration(t *testing.T) {
podSubnet: ""
podSubnet: ""
serviceSubnet: ""
serviceSubnet: ""
nodeName: ""
nodeName: ""
privilegedPods: false
token: ""
token: ""
unifiedControlPlaneImage: ""
unifiedControlPlaneImage: ""
`
),
`
),
...
@@ -103,7 +102,6 @@ func TestPrintConfiguration(t *testing.T) {
...
@@ -103,7 +102,6 @@ func TestPrintConfiguration(t *testing.T) {
podSubnet: ""
podSubnet: ""
serviceSubnet: 10.96.0.1/12
serviceSubnet: 10.96.0.1/12
nodeName: ""
nodeName: ""
privilegedPods: false
token: ""
token: ""
unifiedControlPlaneImage: ""
unifiedControlPlaneImage: ""
`
),
`
),
...
@@ -152,7 +150,6 @@ func TestPrintConfiguration(t *testing.T) {
...
@@ -152,7 +150,6 @@ func TestPrintConfiguration(t *testing.T) {
podSubnet: ""
podSubnet: ""
serviceSubnet: ""
serviceSubnet: ""
nodeName: ""
nodeName: ""
privilegedPods: false
token: ""
token: ""
unifiedControlPlaneImage: ""
unifiedControlPlaneImage: ""
`
),
`
),
...
...
cmd/kubeadm/app/phases/controlplane/manifests.go
View file @
05559c04
...
@@ -38,7 +38,6 @@ import (
...
@@ -38,7 +38,6 @@ import (
staticpodutil
"k8s.io/kubernetes/cmd/kubeadm/app/util/staticpod"
staticpodutil
"k8s.io/kubernetes/cmd/kubeadm/app/util/staticpod"
authzmodes
"k8s.io/kubernetes/pkg/kubeapiserver/authorizer/modes"
authzmodes
"k8s.io/kubernetes/pkg/kubeapiserver/authorizer/modes"
"k8s.io/kubernetes/pkg/master/reconcilers"
"k8s.io/kubernetes/pkg/master/reconcilers"
utilpointer
"k8s.io/kubernetes/pkg/util/pointer"
"k8s.io/kubernetes/pkg/util/version"
"k8s.io/kubernetes/pkg/util/version"
)
)
...
@@ -107,19 +106,6 @@ func GetStaticPodSpecs(cfg *kubeadmapi.MasterConfiguration, k8sVersion *version.
...
@@ -107,19 +106,6 @@ func GetStaticPodSpecs(cfg *kubeadmapi.MasterConfiguration, k8sVersion *version.
Env
:
getProxyEnvVars
(),
Env
:
getProxyEnvVars
(),
},
mounts
.
GetVolumes
(
kubeadmconstants
.
KubeScheduler
)),
},
mounts
.
GetVolumes
(
kubeadmconstants
.
KubeScheduler
)),
}
}
// Some cloud providers need extra privileges for example to load node information from a config drive
// TODO: when we fully to external cloud providers and the api server and controller manager do not need
// to call out to cloud provider code, we can remove the support for the PrivilegedPods
if
cfg
.
PrivilegedPods
{
staticPodSpecs
[
kubeadmconstants
.
KubeAPIServer
]
.
Spec
.
Containers
[
0
]
.
SecurityContext
=
&
v1
.
SecurityContext
{
Privileged
:
utilpointer
.
BoolPtr
(
true
),
}
staticPodSpecs
[
kubeadmconstants
.
KubeControllerManager
]
.
Spec
.
Containers
[
0
]
.
SecurityContext
=
&
v1
.
SecurityContext
{
Privileged
:
utilpointer
.
BoolPtr
(
true
),
}
}
return
staticPodSpecs
return
staticPodSpecs
}
}
...
...
cmd/kubeadm/app/phases/controlplane/manifests_test.go
View file @
05559c04
...
@@ -136,50 +136,6 @@ func TestCreateStaticPodFilesAndWrappers(t *testing.T) {
...
@@ -136,50 +136,6 @@ func TestCreateStaticPodFilesAndWrappers(t *testing.T) {
}
}
}
}
func
TestPrivilegedPods
(
t
*
testing
.
T
)
{
var
staticPodNames
=
[]
string
{
kubeadmconstants
.
KubeAPIServer
,
kubeadmconstants
.
KubeControllerManager
,
}
var
assertions
=
[]
struct
{
privilegedPods
bool
expectedPrivilege
bool
}{
{
privilegedPods
:
false
,
expectedPrivilege
:
false
,
},
{
privilegedPods
:
true
,
expectedPrivilege
:
true
,
},
}
for
_
,
assertion
:=
range
assertions
{
cfg
:=
&
kubeadmapi
.
MasterConfiguration
{
KubernetesVersion
:
"v1.9.0"
,
PrivilegedPods
:
assertion
.
privilegedPods
,
}
k8sVersion
,
_
:=
version
.
ParseSemantic
(
cfg
.
KubernetesVersion
)
specs
:=
GetStaticPodSpecs
(
cfg
,
k8sVersion
)
for
_
,
podname
:=
range
staticPodNames
{
spec
,
_
:=
specs
[
podname
]
sc
:=
spec
.
Spec
.
Containers
[
0
]
.
SecurityContext
if
assertion
.
expectedPrivilege
==
true
{
if
sc
==
nil
||
sc
.
Privileged
==
nil
||
*
sc
.
Privileged
==
false
{
t
.
Errorf
(
"GetStaticPodSpecs did not enable privileged containers in %s pod"
,
podname
)
}
}
else
{
if
sc
!=
nil
&&
sc
.
Privileged
!=
nil
&&
*
sc
.
Privileged
==
true
{
t
.
Errorf
(
"GetStaticPodSpecs enabled privileged containers in %s pod"
,
podname
)
}
}
}
}
}
func
TestGetAPIServerCommand
(
t
*
testing
.
T
)
{
func
TestGetAPIServerCommand
(
t
*
testing
.
T
)
{
var
tests
=
[]
struct
{
var
tests
=
[]
struct
{
name
string
name
string
...
...
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