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
5687f652
Unverified
Commit
5687f652
authored
May 21, 2018
by
Lucas Käldström
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kubeadm: Remove .AuthorizationModes in the v1alpha2 API
parent
4f0020d1
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
25 additions
and
109 deletions
+25
-109
fuzzer.go
cmd/kubeadm/app/apis/kubeadm/fuzzer/fuzzer.go
+0
-1
types.go
cmd/kubeadm/app/apis/kubeadm/types.go
+0
-4
conversion.go
cmd/kubeadm/app/apis/kubeadm/v1alpha1/conversion.go
+15
-0
defaults.go
cmd/kubeadm/app/apis/kubeadm/v1alpha2/defaults.go
+0
-7
types.go
cmd/kubeadm/app/apis/kubeadm/v1alpha2/types.go
+0
-4
validation.go
cmd/kubeadm/app/apis/kubeadm/validation/validation.go
+0
-31
validation_test.go
cmd/kubeadm/app/apis/kubeadm/validation/validation_test.go
+0
-34
init.go
cmd/kubeadm/app/cmd/init.go
+0
-1
constants.go
cmd/kubeadm/app/constants/constants.go
+0
-5
staticpods_test.go
cmd/kubeadm/app/phases/upgrade/staticpods_test.go
+3
-3
checks.go
cmd/kubeadm/app/preflight/checks.go
+0
-11
masterconfig_test.go
cmd/kubeadm/app/util/config/masterconfig_test.go
+1
-1
internal.yaml
.../app/util/config/testdata/conversion/master/internal.yaml
+2
-4
v1alpha1.yaml
.../app/util/config/testdata/conversion/master/v1alpha1.yaml
+1
-0
v1alpha1_without_TypeMeta.yaml
...testdata/conversion/master/v1alpha1_without_TypeMeta.yaml
+1
-0
v1alpha2.yaml
.../app/util/config/testdata/conversion/master/v1alpha2.yaml
+2
-3
No files found.
cmd/kubeadm/app/apis/kubeadm/fuzzer/fuzzer.go
View file @
5687f652
...
@@ -39,7 +39,6 @@ func Funcs(codecs runtimeserializer.CodecFactory) []interface{} {
...
@@ -39,7 +39,6 @@ func Funcs(codecs runtimeserializer.CodecFactory) []interface{} {
obj
.
API
.
AdvertiseAddress
=
"foo"
obj
.
API
.
AdvertiseAddress
=
"foo"
obj
.
Networking
.
ServiceSubnet
=
"foo"
obj
.
Networking
.
ServiceSubnet
=
"foo"
obj
.
Networking
.
DNSDomain
=
"foo"
obj
.
Networking
.
DNSDomain
=
"foo"
obj
.
AuthorizationModes
=
[]
string
{
"foo"
}
obj
.
CertificatesDir
=
"foo"
obj
.
CertificatesDir
=
"foo"
obj
.
APIServerCertSANs
=
[]
string
{
"foo"
}
obj
.
APIServerCertSANs
=
[]
string
{
"foo"
}
obj
.
Etcd
.
ServerCertSANs
=
[]
string
{
"foo"
}
obj
.
Etcd
.
ServerCertSANs
=
[]
string
{
"foo"
}
...
...
cmd/kubeadm/app/apis/kubeadm/types.go
View file @
5687f652
...
@@ -45,10 +45,6 @@ type MasterConfiguration struct {
...
@@ -45,10 +45,6 @@ type MasterConfiguration struct {
// NodeName is the name of the node that will host the k8s control plane.
// NodeName is the name of the node that will host the k8s control plane.
// Defaults to the hostname if not provided.
// Defaults to the hostname if not provided.
NodeName
string
NodeName
string
// AuthorizationModes is a set of authorization modes used inside the cluster.
// If not specified, defaults to Node and RBAC, meaning both the node
// authorizer and RBAC are enabled.
AuthorizationModes
[]
string
// NoTaintMaster will, if set, suppress the tainting of the
// NoTaintMaster will, if set, suppress the tainting of the
// master node allowing workloads to be run on it (e.g. in
// master node allowing workloads to be run on it (e.g. in
// single node configurations).
// single node configurations).
...
...
cmd/kubeadm/app/apis/kubeadm/v1alpha1/conversion.go
View file @
5687f652
...
@@ -17,6 +17,9 @@ limitations under the License.
...
@@ -17,6 +17,9 @@ limitations under the License.
package
v1alpha1
package
v1alpha1
import
(
import
(
"reflect"
"strings"
"k8s.io/apimachinery/pkg/conversion"
"k8s.io/apimachinery/pkg/conversion"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
...
@@ -41,6 +44,7 @@ func Convert_v1alpha1_MasterConfiguration_To_kubeadm_MasterConfiguration(in *Mas
...
@@ -41,6 +44,7 @@ func Convert_v1alpha1_MasterConfiguration_To_kubeadm_MasterConfiguration(in *Mas
}
}
UpgradeCloudProvider
(
in
,
out
)
UpgradeCloudProvider
(
in
,
out
)
UpgradeAuthorizationModes
(
in
,
out
)
// We don't support migrating information from the .PrivilegedPods field which was removed in v1alpha2
// We don't support migrating information from the .PrivilegedPods field which was removed in v1alpha2
return
nil
return
nil
...
@@ -69,3 +73,14 @@ func UpgradeCloudProvider(in *MasterConfiguration, out *kubeadm.MasterConfigurat
...
@@ -69,3 +73,14 @@ func UpgradeCloudProvider(in *MasterConfiguration, out *kubeadm.MasterConfigurat
out
.
ControllerManagerExtraArgs
[
"cloud-provider"
]
=
in
.
CloudProvider
out
.
ControllerManagerExtraArgs
[
"cloud-provider"
]
=
in
.
CloudProvider
}
}
}
}
func
UpgradeAuthorizationModes
(
in
*
MasterConfiguration
,
out
*
kubeadm
.
MasterConfiguration
)
{
// If .AuthorizationModes was set to something else than the default, preserve the information via extraargs
if
!
reflect
.
DeepEqual
(
in
.
AuthorizationModes
,
strings
.
Split
(
DefaultAuthorizationModes
,
","
))
{
if
out
.
APIServerExtraArgs
==
nil
{
out
.
APIServerExtraArgs
=
map
[
string
]
string
{}
}
out
.
APIServerExtraArgs
[
"authorization-mode"
]
=
strings
.
Join
(
in
.
AuthorizationModes
,
","
)
}
}
cmd/kubeadm/app/apis/kubeadm/v1alpha2/defaults.go
View file @
5687f652
...
@@ -18,7 +18,6 @@ package v1alpha2
...
@@ -18,7 +18,6 @@ package v1alpha2
import
(
import
(
"net/url"
"net/url"
"strings"
"time"
"time"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
...
@@ -42,8 +41,6 @@ const (
...
@@ -42,8 +41,6 @@ const (
DefaultKubernetesVersion
=
"stable-1.10"
DefaultKubernetesVersion
=
"stable-1.10"
// DefaultAPIBindPort defines default API port
// DefaultAPIBindPort defines default API port
DefaultAPIBindPort
=
6443
DefaultAPIBindPort
=
6443
// DefaultAuthorizationModes defines default authorization modes
DefaultAuthorizationModes
=
"Node,RBAC"
// DefaultCertificatesDir defines default certificate directory
// DefaultCertificatesDir defines default certificate directory
DefaultCertificatesDir
=
"/etc/kubernetes/pki"
DefaultCertificatesDir
=
"/etc/kubernetes/pki"
// DefaultImageRepository defines default image registry
// DefaultImageRepository defines default image registry
...
@@ -96,10 +93,6 @@ func SetDefaults_MasterConfiguration(obj *MasterConfiguration) {
...
@@ -96,10 +93,6 @@ func SetDefaults_MasterConfiguration(obj *MasterConfiguration) {
obj
.
Networking
.
DNSDomain
=
DefaultServiceDNSDomain
obj
.
Networking
.
DNSDomain
=
DefaultServiceDNSDomain
}
}
if
len
(
obj
.
AuthorizationModes
)
==
0
{
obj
.
AuthorizationModes
=
strings
.
Split
(
DefaultAuthorizationModes
,
","
)
}
if
obj
.
CertificatesDir
==
""
{
if
obj
.
CertificatesDir
==
""
{
obj
.
CertificatesDir
=
DefaultCertificatesDir
obj
.
CertificatesDir
=
DefaultCertificatesDir
}
}
...
...
cmd/kubeadm/app/apis/kubeadm/v1alpha2/types.go
View file @
5687f652
...
@@ -45,10 +45,6 @@ type MasterConfiguration struct {
...
@@ -45,10 +45,6 @@ type MasterConfiguration struct {
// NodeName is the name of the node that will host the k8s control plane.
// NodeName is the name of the node that will host the k8s control plane.
// Defaults to the hostname if not provided.
// Defaults to the hostname if not provided.
NodeName
string
`json:"nodeName"`
NodeName
string
`json:"nodeName"`
// AuthorizationModes is a set of authorization modes used inside the cluster.
// If not specified, defaults to Node and RBAC, meaning both the node
// authorizer and RBAC are enabled.
AuthorizationModes
[]
string
`json:"authorizationModes,omitempty"`
// NoTaintMaster will, if set, suppress the tainting of the
// NoTaintMaster will, if set, suppress the tainting of the
// master node allowing workloads to be run on it (e.g. in
// master node allowing workloads to be run on it (e.g. in
// single node configurations).
// single node configurations).
...
...
cmd/kubeadm/app/apis/kubeadm/validation/validation.go
View file @
5687f652
...
@@ -37,7 +37,6 @@ import (
...
@@ -37,7 +37,6 @@ import (
kubeadmutil
"k8s.io/kubernetes/cmd/kubeadm/app/util"
kubeadmutil
"k8s.io/kubernetes/cmd/kubeadm/app/util"
tokenutil
"k8s.io/kubernetes/cmd/kubeadm/app/util/token"
tokenutil
"k8s.io/kubernetes/cmd/kubeadm/app/util/token"
apivalidation
"k8s.io/kubernetes/pkg/apis/core/validation"
apivalidation
"k8s.io/kubernetes/pkg/apis/core/validation"
authzmodes
"k8s.io/kubernetes/pkg/kubeapiserver/authorizer/modes"
"k8s.io/kubernetes/pkg/kubelet/apis/kubeletconfig"
"k8s.io/kubernetes/pkg/kubelet/apis/kubeletconfig"
kubeletscheme
"k8s.io/kubernetes/pkg/kubelet/apis/kubeletconfig/scheme"
kubeletscheme
"k8s.io/kubernetes/pkg/kubelet/apis/kubeletconfig/scheme"
kubeletvalidation
"k8s.io/kubernetes/pkg/kubelet/apis/kubeletconfig/validation"
kubeletvalidation
"k8s.io/kubernetes/pkg/kubelet/apis/kubeletconfig/validation"
...
@@ -49,16 +48,9 @@ import (
...
@@ -49,16 +48,9 @@ import (
"k8s.io/kubernetes/pkg/util/node"
"k8s.io/kubernetes/pkg/util/node"
)
)
// Describes the authorization modes that are enforced by kubeadm
var
requiredAuthzModes
=
[]
string
{
authzmodes
.
ModeRBAC
,
authzmodes
.
ModeNode
,
}
// ValidateMasterConfiguration validates master configuration and collects all encountered errors
// ValidateMasterConfiguration validates master configuration and collects all encountered errors
func
ValidateMasterConfiguration
(
c
*
kubeadm
.
MasterConfiguration
)
field
.
ErrorList
{
func
ValidateMasterConfiguration
(
c
*
kubeadm
.
MasterConfiguration
)
field
.
ErrorList
{
allErrs
:=
field
.
ErrorList
{}
allErrs
:=
field
.
ErrorList
{}
allErrs
=
append
(
allErrs
,
ValidateAuthorizationModes
(
c
.
AuthorizationModes
,
field
.
NewPath
(
"authorizationModes"
))
...
)
allErrs
=
append
(
allErrs
,
ValidateNetworking
(
&
c
.
Networking
,
field
.
NewPath
(
"networking"
))
...
)
allErrs
=
append
(
allErrs
,
ValidateNetworking
(
&
c
.
Networking
,
field
.
NewPath
(
"networking"
))
...
)
allErrs
=
append
(
allErrs
,
ValidateCertSANs
(
c
.
APIServerCertSANs
,
field
.
NewPath
(
"apiServerCertSANs"
))
...
)
allErrs
=
append
(
allErrs
,
ValidateCertSANs
(
c
.
APIServerCertSANs
,
field
.
NewPath
(
"apiServerCertSANs"
))
...
)
allErrs
=
append
(
allErrs
,
ValidateCertSANs
(
c
.
Etcd
.
ServerCertSANs
,
field
.
NewPath
(
"etcd"
)
.
Child
(
"serverCertSANs"
))
...
)
allErrs
=
append
(
allErrs
,
ValidateCertSANs
(
c
.
Etcd
.
ServerCertSANs
,
field
.
NewPath
(
"etcd"
)
.
Child
(
"serverCertSANs"
))
...
)
...
@@ -102,29 +94,6 @@ func ValidateNodeConfiguration(c *kubeadm.NodeConfiguration) field.ErrorList {
...
@@ -102,29 +94,6 @@ func ValidateNodeConfiguration(c *kubeadm.NodeConfiguration) field.ErrorList {
return
allErrs
return
allErrs
}
}
// ValidateAuthorizationModes validates authorization modes and collects all encountered errors
func
ValidateAuthorizationModes
(
authzModes
[]
string
,
fldPath
*
field
.
Path
)
field
.
ErrorList
{
allErrs
:=
field
.
ErrorList
{}
found
:=
map
[
string
]
bool
{}
for
_
,
authzMode
:=
range
authzModes
{
if
!
authzmodes
.
IsValidAuthorizationMode
(
authzMode
)
{
allErrs
=
append
(
allErrs
,
field
.
Invalid
(
fldPath
,
authzMode
,
"invalid authorization mode"
))
}
if
found
[
authzMode
]
{
allErrs
=
append
(
allErrs
,
field
.
Invalid
(
fldPath
,
authzMode
,
"duplicate authorization mode"
))
continue
}
found
[
authzMode
]
=
true
}
for
_
,
requiredMode
:=
range
requiredAuthzModes
{
if
!
found
[
requiredMode
]
{
allErrs
=
append
(
allErrs
,
field
.
Required
(
fldPath
,
fmt
.
Sprintf
(
"authorization mode %s must be enabled"
,
requiredMode
)))
}
}
return
allErrs
}
// ValidateDiscovery validates discovery related configuration and collects all encountered errors
// ValidateDiscovery validates discovery related configuration and collects all encountered errors
func
ValidateDiscovery
(
c
*
kubeadm
.
NodeConfiguration
)
field
.
ErrorList
{
func
ValidateDiscovery
(
c
*
kubeadm
.
NodeConfiguration
)
field
.
ErrorList
{
allErrs
:=
field
.
ErrorList
{}
allErrs
:=
field
.
ErrorList
{}
...
...
cmd/kubeadm/app/apis/kubeadm/validation/validation_test.go
View file @
5687f652
...
@@ -104,34 +104,6 @@ func TestValidateTokenGroups(t *testing.T) {
...
@@ -104,34 +104,6 @@ func TestValidateTokenGroups(t *testing.T) {
}
}
}
}
func
TestValidateAuthorizationModes
(
t
*
testing
.
T
)
{
var
tests
=
[]
struct
{
s
[]
string
f
*
field
.
Path
expected
bool
}{
{[]
string
{
""
},
nil
,
false
},
{[]
string
{
"rBAC"
},
nil
,
false
},
// mode not supported
{[]
string
{
"rBAC"
,
"Webhook"
},
nil
,
false
},
// mode not supported
{[]
string
{
"RBAC"
,
"Webhook"
},
nil
,
false
},
// mode Node required
{[]
string
{
"Node"
,
"RBAC"
,
"Webhook"
,
"Webhook"
},
nil
,
false
},
// no duplicates allowed
{[]
string
{
"not valid"
},
nil
,
false
},
// invalid mode
{[]
string
{
"Node"
,
"RBAC"
},
nil
,
true
},
// supported
{[]
string
{
"RBAC"
,
"Node"
},
nil
,
true
},
// supported
{[]
string
{
"Node"
,
"RBAC"
,
"Webhook"
,
"ABAC"
},
nil
,
true
},
// supported
}
for
_
,
rt
:=
range
tests
{
actual
:=
ValidateAuthorizationModes
(
rt
.
s
,
rt
.
f
)
if
(
len
(
actual
)
==
0
)
!=
rt
.
expected
{
t
.
Errorf
(
"failed ValidateAuthorizationModes:
\n\t
expected: %t
\n\t
actual: %t"
,
rt
.
expected
,
(
len
(
actual
)
==
0
),
)
}
}
}
func
TestValidateNodeName
(
t
*
testing
.
T
)
{
func
TestValidateNodeName
(
t
*
testing
.
T
)
{
var
tests
=
[]
struct
{
var
tests
=
[]
struct
{
s
string
s
string
...
@@ -431,7 +403,6 @@ func TestValidateMasterConfiguration(t *testing.T) {
...
@@ -431,7 +403,6 @@ func TestValidateMasterConfiguration(t *testing.T) {
AdvertiseAddress
:
"1.2.3.4"
,
AdvertiseAddress
:
"1.2.3.4"
,
BindPort
:
6443
,
BindPort
:
6443
,
},
},
AuthorizationModes
:
[]
string
{
"Node"
,
"RBAC"
},
Networking
:
kubeadm
.
Networking
{
Networking
:
kubeadm
.
Networking
{
ServiceSubnet
:
"10.96.0.1/12"
,
ServiceSubnet
:
"10.96.0.1/12"
,
DNSDomain
:
"cluster.local"
,
DNSDomain
:
"cluster.local"
,
...
@@ -445,7 +416,6 @@ func TestValidateMasterConfiguration(t *testing.T) {
...
@@ -445,7 +416,6 @@ func TestValidateMasterConfiguration(t *testing.T) {
AdvertiseAddress
:
"1.2.3.4"
,
AdvertiseAddress
:
"1.2.3.4"
,
BindPort
:
6443
,
BindPort
:
6443
,
},
},
AuthorizationModes
:
[]
string
{
"Node"
,
"RBAC"
},
Networking
:
kubeadm
.
Networking
{
Networking
:
kubeadm
.
Networking
{
ServiceSubnet
:
"2001:db8::1/98"
,
ServiceSubnet
:
"2001:db8::1/98"
,
DNSDomain
:
"cluster.local"
,
DNSDomain
:
"cluster.local"
,
...
@@ -459,7 +429,6 @@ func TestValidateMasterConfiguration(t *testing.T) {
...
@@ -459,7 +429,6 @@ func TestValidateMasterConfiguration(t *testing.T) {
AdvertiseAddress
:
"1.2.3.4"
,
AdvertiseAddress
:
"1.2.3.4"
,
BindPort
:
6443
,
BindPort
:
6443
,
},
},
AuthorizationModes
:
[]
string
{
"Node"
,
"RBAC"
},
Networking
:
kubeadm
.
Networking
{
Networking
:
kubeadm
.
Networking
{
ServiceSubnet
:
"10.96.0.1/12"
,
ServiceSubnet
:
"10.96.0.1/12"
,
DNSDomain
:
"cluster.local"
,
DNSDomain
:
"cluster.local"
,
...
@@ -473,7 +442,6 @@ func TestValidateMasterConfiguration(t *testing.T) {
...
@@ -473,7 +442,6 @@ func TestValidateMasterConfiguration(t *testing.T) {
AdvertiseAddress
:
"1.2.3.4"
,
AdvertiseAddress
:
"1.2.3.4"
,
BindPort
:
6443
,
BindPort
:
6443
,
},
},
AuthorizationModes
:
[]
string
{
"Node"
,
"RBAC"
},
Networking
:
kubeadm
.
Networking
{
Networking
:
kubeadm
.
Networking
{
ServiceSubnet
:
"10.96.0.1/12"
,
ServiceSubnet
:
"10.96.0.1/12"
,
DNSDomain
:
"cluster.local"
,
DNSDomain
:
"cluster.local"
,
...
@@ -515,7 +483,6 @@ func TestValidateMasterConfiguration(t *testing.T) {
...
@@ -515,7 +483,6 @@ func TestValidateMasterConfiguration(t *testing.T) {
},
},
},
},
},
},
AuthorizationModes
:
[]
string
{
"Node"
,
"RBAC"
},
Networking
:
kubeadm
.
Networking
{
Networking
:
kubeadm
.
Networking
{
ServiceSubnet
:
"10.96.0.1/12"
,
ServiceSubnet
:
"10.96.0.1/12"
,
DNSDomain
:
"cluster.local"
,
DNSDomain
:
"cluster.local"
,
...
@@ -557,7 +524,6 @@ func TestValidateMasterConfiguration(t *testing.T) {
...
@@ -557,7 +524,6 @@ func TestValidateMasterConfiguration(t *testing.T) {
},
},
},
},
},
},
AuthorizationModes
:
[]
string
{
"Node"
,
"RBAC"
},
Networking
:
kubeadm
.
Networking
{
Networking
:
kubeadm
.
Networking
{
ServiceSubnet
:
"2001:db8::1/98"
,
ServiceSubnet
:
"2001:db8::1/98"
,
DNSDomain
:
"cluster.local"
,
DNSDomain
:
"cluster.local"
,
...
...
cmd/kubeadm/app/cmd/init.go
View file @
5687f652
...
@@ -252,7 +252,6 @@ func NewInit(cfgPath string, externalcfg *kubeadmapiv1alpha2.MasterConfiguration
...
@@ -252,7 +252,6 @@ func NewInit(cfgPath string, externalcfg *kubeadmapiv1alpha2.MasterConfiguration
}
}
glog
.
Infof
(
"[init] using Kubernetes version: %s
\n
"
,
cfg
.
KubernetesVersion
)
glog
.
Infof
(
"[init] using Kubernetes version: %s
\n
"
,
cfg
.
KubernetesVersion
)
glog
.
Infof
(
"[init] using Authorization modes: %v
\n
"
,
cfg
.
AuthorizationModes
)
glog
.
Infoln
(
"[preflight] running pre-flight checks"
)
glog
.
Infoln
(
"[preflight] running pre-flight checks"
)
...
...
cmd/kubeadm/app/constants/constants.go
View file @
5687f652
...
@@ -275,11 +275,6 @@ var (
...
@@ -275,11 +275,6 @@ var (
Effect
:
v1
.
TaintEffectNoSchedule
,
Effect
:
v1
.
TaintEffectNoSchedule
,
}
}
// AuthorizationPolicyPath defines the supported location of authorization policy file
AuthorizationPolicyPath
=
filepath
.
Join
(
KubernetesDir
,
"abac_policy.json"
)
// AuthorizationWebhookConfigPath defines the supported location of webhook config file
AuthorizationWebhookConfigPath
=
filepath
.
Join
(
KubernetesDir
,
"webhook_authz.conf"
)
// DefaultTokenUsages specifies the default functions a token will get
// DefaultTokenUsages specifies the default functions a token will get
DefaultTokenUsages
=
bootstrapapi
.
KnownTokenUsages
DefaultTokenUsages
=
bootstrapapi
.
KnownTokenUsages
...
...
cmd/kubeadm/app/phases/upgrade/staticpods_test.go
View file @
5687f652
...
@@ -46,14 +46,13 @@ const (
...
@@ -46,14 +46,13 @@ const (
waitForPodsWithLabel
=
"wait-for-pods-with-label"
waitForPodsWithLabel
=
"wait-for-pods-with-label"
testConfiguration
=
`
testConfiguration
=
`
apiVersion: kubeadm.k8s.io/v1alpha2
kind: MasterConfiguration
api:
api:
advertiseAddress: 1.2.3.4
advertiseAddress: 1.2.3.4
bindPort: 6443
bindPort: 6443
apiServerCertSANs: null
apiServerCertSANs: null
apiServerExtraArgs: null
apiServerExtraArgs: null
authorizationModes:
- Node
- RBAC
certificatesDir: %s
certificatesDir: %s
controllerManagerExtraArgs: null
controllerManagerExtraArgs: null
etcd:
etcd:
...
@@ -508,6 +507,7 @@ func getAPIServerHash(dir string) (string, error) {
...
@@ -508,6 +507,7 @@ func getAPIServerHash(dir string) (string, error) {
return
fmt
.
Sprintf
(
"%x"
,
sha256
.
Sum256
(
fileBytes
)),
nil
return
fmt
.
Sprintf
(
"%x"
,
sha256
.
Sum256
(
fileBytes
)),
nil
}
}
// TODO: Make this test function use the rest of the "official" API machinery helper funcs we have inside of kubeadm
func
getConfig
(
version
,
certsDir
,
etcdDataDir
string
)
(
*
kubeadmapi
.
MasterConfiguration
,
error
)
{
func
getConfig
(
version
,
certsDir
,
etcdDataDir
string
)
(
*
kubeadmapi
.
MasterConfiguration
,
error
)
{
externalcfg
:=
&
kubeadmapiv1alpha2
.
MasterConfiguration
{}
externalcfg
:=
&
kubeadmapiv1alpha2
.
MasterConfiguration
{}
internalcfg
:=
&
kubeadmapi
.
MasterConfiguration
{}
internalcfg
:=
&
kubeadmapi
.
MasterConfiguration
{}
...
...
cmd/kubeadm/app/preflight/checks.go
View file @
5687f652
...
@@ -47,7 +47,6 @@ import (
...
@@ -47,7 +47,6 @@ import (
kubeadmdefaults
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
kubeadmdefaults
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
kubeadmconstants
"k8s.io/kubernetes/cmd/kubeadm/app/constants"
kubeadmconstants
"k8s.io/kubernetes/cmd/kubeadm/app/constants"
"k8s.io/kubernetes/pkg/apis/core/validation"
"k8s.io/kubernetes/pkg/apis/core/validation"
authzmodes
"k8s.io/kubernetes/pkg/kubeapiserver/authorizer/modes"
"k8s.io/kubernetes/pkg/registry/core/service/ipallocator"
"k8s.io/kubernetes/pkg/registry/core/service/ipallocator"
"k8s.io/kubernetes/pkg/util/initsystem"
"k8s.io/kubernetes/pkg/util/initsystem"
"k8s.io/kubernetes/pkg/util/procfs"
"k8s.io/kubernetes/pkg/util/procfs"
...
@@ -889,16 +888,6 @@ func RunInitMasterChecks(execer utilsexec.Interface, cfg *kubeadmapi.MasterConfi
...
@@ -889,16 +888,6 @@ func RunInitMasterChecks(execer utilsexec.Interface, cfg *kubeadmapi.MasterConfi
)
)
}
}
// Check the config for authorization mode
for
_
,
authzMode
:=
range
cfg
.
AuthorizationModes
{
switch
authzMode
{
case
authzmodes
.
ModeABAC
:
checks
=
append
(
checks
,
FileExistingCheck
{
Path
:
kubeadmconstants
.
AuthorizationPolicyPath
})
case
authzmodes
.
ModeWebhook
:
checks
=
append
(
checks
,
FileExistingCheck
{
Path
:
kubeadmconstants
.
AuthorizationWebhookConfigPath
})
}
}
if
ip
:=
net
.
ParseIP
(
cfg
.
API
.
AdvertiseAddress
);
ip
!=
nil
{
if
ip
:=
net
.
ParseIP
(
cfg
.
API
.
AdvertiseAddress
);
ip
!=
nil
{
if
ip
.
To4
()
==
nil
&&
ip
.
To16
()
!=
nil
{
if
ip
.
To4
()
==
nil
&&
ip
.
To16
()
!=
nil
{
checks
=
append
(
checks
,
checks
=
append
(
checks
,
...
...
cmd/kubeadm/app/util/config/masterconfig_test.go
View file @
5687f652
...
@@ -39,7 +39,7 @@ const (
...
@@ -39,7 +39,7 @@ const (
master_v1alpha2YAML
=
"testdata/conversion/master/v1alpha2.yaml"
master_v1alpha2YAML
=
"testdata/conversion/master/v1alpha2.yaml"
master_internalYAML
=
"testdata/conversion/master/internal.yaml"
master_internalYAML
=
"testdata/conversion/master/internal.yaml"
master_incompleteYAML
=
"testdata/defaulting/master/incomplete.yaml"
master_incompleteYAML
=
"testdata/defaulting/master/incomplete.yaml"
master_defaultedYAML
=
"testdata/defaulting/master/defaulted.yaml"
master_defaultedYAML
=
"testdata/defaulting/master/defaulted.yaml"
master_invalidYAML
=
"testdata/validation/invalid_mastercfg.yaml"
master_invalidYAML
=
"testdata/validation/invalid_mastercfg.yaml"
master_beforeUpgradeYAML
=
"testdata/v1alpha1_upgrade/before.yaml"
master_beforeUpgradeYAML
=
"testdata/v1alpha1_upgrade/before.yaml"
master_afterUpgradeYAML
=
"testdata/v1alpha1_upgrade/after.yaml"
master_afterUpgradeYAML
=
"testdata/v1alpha1_upgrade/after.yaml"
...
...
cmd/kubeadm/app/util/config/testdata/conversion/master/internal.yaml
View file @
5687f652
...
@@ -3,15 +3,13 @@ API:
...
@@ -3,15 +3,13 @@ API:
BindPort
:
6443
BindPort
:
6443
ControlPlaneEndpoint
:
"
"
ControlPlaneEndpoint
:
"
"
APIServerCertSANs
:
null
APIServerCertSANs
:
null
APIServerExtraArgs
:
null
APIServerExtraArgs
:
authorization-mode
:
Node,RBAC,Webhook
APIServerExtraVolumes
:
null
APIServerExtraVolumes
:
null
AuditPolicyConfiguration
:
AuditPolicyConfiguration
:
LogDir
:
/var/log/kubernetes/audit
LogDir
:
/var/log/kubernetes/audit
LogMaxAge
:
2
LogMaxAge
:
2
Path
:
"
"
Path
:
"
"
AuthorizationModes
:
-
Node
-
RBAC
CIImageRepository
:
"
"
CIImageRepository
:
"
"
CRISocket
:
/var/run/dockershim.sock
CRISocket
:
/var/run/dockershim.sock
CertificatesDir
:
/etc/kubernetes/pki
CertificatesDir
:
/etc/kubernetes/pki
...
...
cmd/kubeadm/app/util/config/testdata/conversion/master/v1alpha1.yaml
View file @
5687f652
...
@@ -10,6 +10,7 @@ auditPolicy:
...
@@ -10,6 +10,7 @@ auditPolicy:
authorizationModes
:
authorizationModes
:
-
Node
-
Node
-
RBAC
-
RBAC
-
Webhook
certificatesDir
:
/etc/kubernetes/pki
certificatesDir
:
/etc/kubernetes/pki
cloudProvider
:
"
"
cloudProvider
:
"
"
clusterName
:
kubernetes
clusterName
:
kubernetes
...
...
cmd/kubeadm/app/util/config/testdata/conversion/master/v1alpha1_without_TypeMeta.yaml
View file @
5687f652
...
@@ -10,6 +10,7 @@ auditPolicy:
...
@@ -10,6 +10,7 @@ auditPolicy:
authorizationModes
:
authorizationModes
:
-
Node
-
Node
-
RBAC
-
RBAC
-
Webhook
certificatesDir
:
/etc/kubernetes/pki
certificatesDir
:
/etc/kubernetes/pki
cloudProvider
:
"
"
cloudProvider
:
"
"
clusterName
:
kubernetes
clusterName
:
kubernetes
...
...
cmd/kubeadm/app/util/config/testdata/conversion/master/v1alpha2.yaml
View file @
5687f652
...
@@ -2,14 +2,13 @@ api:
...
@@ -2,14 +2,13 @@ api:
advertiseAddress
:
192.168.2.2
advertiseAddress
:
192.168.2.2
bindPort
:
6443
bindPort
:
6443
controlPlaneEndpoint
:
"
"
controlPlaneEndpoint
:
"
"
apiServerExtraArgs
:
authorization-mode
:
Node,RBAC,Webhook
apiVersion
:
kubeadm.k8s.io/v1alpha2
apiVersion
:
kubeadm.k8s.io/v1alpha2
auditPolicy
:
auditPolicy
:
logDir
:
/var/log/kubernetes/audit
logDir
:
/var/log/kubernetes/audit
logMaxAge
:
2
logMaxAge
:
2
path
:
"
"
path
:
"
"
authorizationModes
:
-
Node
-
RBAC
certificatesDir
:
/etc/kubernetes/pki
certificatesDir
:
/etc/kubernetes/pki
clusterName
:
kubernetes
clusterName
:
kubernetes
criSocket
:
/var/run/dockershim.sock
criSocket
:
/var/run/dockershim.sock
...
...
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