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
5656338b
Unverified
Commit
5656338b
authored
Nov 09, 2018
by
Lucas Käldström
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update unit tests after the rename
parent
731bcdc8
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
76 additions
and
76 deletions
+76
-76
validation_test.go
cmd/kubeadm/app/apis/kubeadm/validation/validation_test.go
+6
-6
proxy_test.go
cmd/kubeadm/app/phases/addons/proxy/proxy_test.go
+3
-3
certs_test.go
cmd/kubeadm/app/phases/certs/certs_test.go
+2
-2
manifests_test.go
cmd/kubeadm/app/phases/controlplane/manifests_test.go
+15
-15
local_test.go
cmd/kubeadm/app/phases/etcd/local_test.go
+3
-3
kubeconfig_test.go
cmd/kubeadm/app/phases/kubeconfig/kubeconfig_test.go
+8
-8
postupgrade_test.go
cmd/kubeadm/app/phases/upgrade/postupgrade_test.go
+1
-1
uploadconfig_test.go
cmd/kubeadm/app/phases/uploadconfig/uploadconfig_test.go
+2
-2
checks_test.go
cmd/kubeadm/app/preflight/checks_test.go
+2
-2
cluster_test.go
cmd/kubeadm/app/util/config/cluster_test.go
+4
-4
internal.yaml
.../app/util/config/testdata/conversion/master/internal.yaml
+3
-3
v1beta1.yaml
...m/app/util/config/testdata/conversion/master/v1beta1.yaml
+3
-3
defaulted.yaml
...app/util/config/testdata/defaulting/master/defaulted.yaml
+3
-3
incomplete.yaml
...pp/util/config/testdata/defaulting/master/incomplete.yaml
+2
-2
endpoint_test.go
cmd/kubeadm/app/util/endpoint_test.go
+11
-11
pki_helpers_test.go
cmd/kubeadm/app/util/pkiutil/pki_helpers_test.go
+4
-4
utils_test.go
cmd/kubeadm/app/util/staticpod/utils_test.go
+4
-4
No files found.
cmd/kubeadm/app/apis/kubeadm/validation/validation_test.go
View file @
5656338b
...
@@ -359,7 +359,7 @@ func TestValidateInitConfiguration(t *testing.T) {
...
@@ -359,7 +359,7 @@ func TestValidateInitConfiguration(t *testing.T) {
&
kubeadm
.
InitConfiguration
{},
false
},
&
kubeadm
.
InitConfiguration
{},
false
},
{
"invalid missing token with IPv4 service subnet"
,
{
"invalid missing token with IPv4 service subnet"
,
&
kubeadm
.
InitConfiguration
{
&
kubeadm
.
InitConfiguration
{
APIEndpoint
:
kubeadm
.
APIEndpoint
{
Local
APIEndpoint
:
kubeadm
.
APIEndpoint
{
AdvertiseAddress
:
"1.2.3.4"
,
AdvertiseAddress
:
"1.2.3.4"
,
BindPort
:
6443
,
BindPort
:
6443
,
},
},
...
@@ -374,7 +374,7 @@ func TestValidateInitConfiguration(t *testing.T) {
...
@@ -374,7 +374,7 @@ func TestValidateInitConfiguration(t *testing.T) {
},
false
},
},
false
},
{
"invalid missing token with IPv6 service subnet"
,
{
"invalid missing token with IPv6 service subnet"
,
&
kubeadm
.
InitConfiguration
{
&
kubeadm
.
InitConfiguration
{
APIEndpoint
:
kubeadm
.
APIEndpoint
{
Local
APIEndpoint
:
kubeadm
.
APIEndpoint
{
AdvertiseAddress
:
"1.2.3.4"
,
AdvertiseAddress
:
"1.2.3.4"
,
BindPort
:
6443
,
BindPort
:
6443
,
},
},
...
@@ -389,7 +389,7 @@ func TestValidateInitConfiguration(t *testing.T) {
...
@@ -389,7 +389,7 @@ func TestValidateInitConfiguration(t *testing.T) {
},
false
},
},
false
},
{
"invalid missing node name"
,
{
"invalid missing node name"
,
&
kubeadm
.
InitConfiguration
{
&
kubeadm
.
InitConfiguration
{
APIEndpoint
:
kubeadm
.
APIEndpoint
{
Local
APIEndpoint
:
kubeadm
.
APIEndpoint
{
AdvertiseAddress
:
"1.2.3.4"
,
AdvertiseAddress
:
"1.2.3.4"
,
BindPort
:
6443
,
BindPort
:
6443
,
},
},
...
@@ -403,7 +403,7 @@ func TestValidateInitConfiguration(t *testing.T) {
...
@@ -403,7 +403,7 @@ func TestValidateInitConfiguration(t *testing.T) {
},
false
},
},
false
},
{
"valid master configuration with incorrect IPv4 pod subnet"
,
{
"valid master configuration with incorrect IPv4 pod subnet"
,
&
kubeadm
.
InitConfiguration
{
&
kubeadm
.
InitConfiguration
{
APIEndpoint
:
kubeadm
.
APIEndpoint
{
Local
APIEndpoint
:
kubeadm
.
APIEndpoint
{
AdvertiseAddress
:
"1.2.3.4"
,
AdvertiseAddress
:
"1.2.3.4"
,
BindPort
:
6443
,
BindPort
:
6443
,
},
},
...
@@ -419,7 +419,7 @@ func TestValidateInitConfiguration(t *testing.T) {
...
@@ -419,7 +419,7 @@ func TestValidateInitConfiguration(t *testing.T) {
},
false
},
},
false
},
{
"valid master configuration with IPv4 service subnet"
,
{
"valid master configuration with IPv4 service subnet"
,
&
kubeadm
.
InitConfiguration
{
&
kubeadm
.
InitConfiguration
{
APIEndpoint
:
kubeadm
.
APIEndpoint
{
Local
APIEndpoint
:
kubeadm
.
APIEndpoint
{
AdvertiseAddress
:
"1.2.3.4"
,
AdvertiseAddress
:
"1.2.3.4"
,
BindPort
:
6443
,
BindPort
:
6443
,
},
},
...
@@ -466,7 +466,7 @@ func TestValidateInitConfiguration(t *testing.T) {
...
@@ -466,7 +466,7 @@ func TestValidateInitConfiguration(t *testing.T) {
},
true
},
},
true
},
{
"valid master configuration using IPv6 service subnet"
,
{
"valid master configuration using IPv6 service subnet"
,
&
kubeadm
.
InitConfiguration
{
&
kubeadm
.
InitConfiguration
{
APIEndpoint
:
kubeadm
.
APIEndpoint
{
Local
APIEndpoint
:
kubeadm
.
APIEndpoint
{
AdvertiseAddress
:
"1:2:3::4"
,
AdvertiseAddress
:
"1:2:3::4"
,
BindPort
:
3446
,
BindPort
:
3446
,
},
},
...
...
cmd/kubeadm/app/phases/addons/proxy/proxy_test.go
View file @
5656338b
...
@@ -174,7 +174,7 @@ func TestEnsureProxyAddon(t *testing.T) {
...
@@ -174,7 +174,7 @@ func TestEnsureProxyAddon(t *testing.T) {
client
:=
clientsetfake
.
NewSimpleClientset
()
client
:=
clientsetfake
.
NewSimpleClientset
()
// TODO: Consider using a YAML file instead for this that makes it possible to specify YAML documents for the ComponentConfigs
// TODO: Consider using a YAML file instead for this that makes it possible to specify YAML documents for the ComponentConfigs
masterConfig
:=
&
kubeadmapiv1beta1
.
InitConfiguration
{
masterConfig
:=
&
kubeadmapiv1beta1
.
InitConfiguration
{
APIEndpoint
:
kubeadmapiv1beta1
.
APIEndpoint
{
Local
APIEndpoint
:
kubeadmapiv1beta1
.
APIEndpoint
{
AdvertiseAddress
:
"1.2.3.4"
,
AdvertiseAddress
:
"1.2.3.4"
,
BindPort
:
1234
,
BindPort
:
1234
,
},
},
...
@@ -194,9 +194,9 @@ func TestEnsureProxyAddon(t *testing.T) {
...
@@ -194,9 +194,9 @@ func TestEnsureProxyAddon(t *testing.T) {
return
true
,
nil
,
apierrors
.
NewUnauthorized
(
""
)
return
true
,
nil
,
apierrors
.
NewUnauthorized
(
""
)
})
})
case
InvalidMasterEndpoint
:
case
InvalidMasterEndpoint
:
masterConfig
.
APIEndpoint
.
AdvertiseAddress
=
"1.2.3"
masterConfig
.
Local
APIEndpoint
.
AdvertiseAddress
=
"1.2.3"
case
IPv6SetBindAddress
:
case
IPv6SetBindAddress
:
masterConfig
.
APIEndpoint
.
AdvertiseAddress
=
"1:2::3:4"
masterConfig
.
Local
APIEndpoint
.
AdvertiseAddress
=
"1:2::3:4"
masterConfig
.
Networking
.
PodSubnet
=
"2001:101::/96"
masterConfig
.
Networking
.
PodSubnet
=
"2001:101::/96"
}
}
...
...
cmd/kubeadm/app/phases/certs/certs_test.go
View file @
5656338b
...
@@ -506,7 +506,7 @@ func TestUsingExternalCA(t *testing.T) {
...
@@ -506,7 +506,7 @@ func TestUsingExternalCA(t *testing.T) {
defer
os
.
RemoveAll
(
dir
)
defer
os
.
RemoveAll
(
dir
)
cfg
:=
&
kubeadmapi
.
InitConfiguration
{
cfg
:=
&
kubeadmapi
.
InitConfiguration
{
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
AdvertiseAddress
:
"1.2.3.4"
},
Local
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
AdvertiseAddress
:
"1.2.3.4"
},
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
Networking
:
kubeadmapi
.
Networking
{
ServiceSubnet
:
"10.96.0.0/12"
,
DNSDomain
:
"cluster.local"
},
Networking
:
kubeadmapi
.
Networking
{
ServiceSubnet
:
"10.96.0.0/12"
,
DNSDomain
:
"cluster.local"
},
CertificatesDir
:
dir
,
CertificatesDir
:
dir
,
...
@@ -675,7 +675,7 @@ func TestCreateCertificateFilesMethods(t *testing.T) {
...
@@ -675,7 +675,7 @@ func TestCreateCertificateFilesMethods(t *testing.T) {
defer
os
.
RemoveAll
(
tmpdir
)
defer
os
.
RemoveAll
(
tmpdir
)
cfg
:=
&
kubeadmapi
.
InitConfiguration
{
cfg
:=
&
kubeadmapi
.
InitConfiguration
{
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
AdvertiseAddress
:
"1.2.3.4"
},
Local
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
AdvertiseAddress
:
"1.2.3.4"
},
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
Etcd
:
kubeadmapi
.
Etcd
{
Local
:
&
kubeadmapi
.
LocalEtcd
{}},
Etcd
:
kubeadmapi
.
Etcd
{
Local
:
&
kubeadmapi
.
LocalEtcd
{}},
Networking
:
kubeadmapi
.
Networking
{
ServiceSubnet
:
"10.96.0.0/12"
,
DNSDomain
:
"cluster.local"
},
Networking
:
kubeadmapi
.
Networking
{
ServiceSubnet
:
"10.96.0.0/12"
,
DNSDomain
:
"cluster.local"
},
...
...
cmd/kubeadm/app/phases/controlplane/manifests_test.go
View file @
5656338b
...
@@ -146,7 +146,7 @@ func TestGetAPIServerCommand(t *testing.T) {
...
@@ -146,7 +146,7 @@ func TestGetAPIServerCommand(t *testing.T) {
{
{
name
:
"testing defaults"
,
name
:
"testing defaults"
,
cfg
:
&
kubeadmapi
.
InitConfiguration
{
cfg
:
&
kubeadmapi
.
InitConfiguration
{
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
BindPort
:
123
,
AdvertiseAddress
:
"1.2.3.4"
},
Local
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
BindPort
:
123
,
AdvertiseAddress
:
"1.2.3.4"
},
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
Networking
:
kubeadmapi
.
Networking
{
ServiceSubnet
:
"bar"
},
Networking
:
kubeadmapi
.
Networking
{
ServiceSubnet
:
"bar"
},
CertificatesDir
:
testCertsDir
,
CertificatesDir
:
testCertsDir
,
...
@@ -185,7 +185,7 @@ func TestGetAPIServerCommand(t *testing.T) {
...
@@ -185,7 +185,7 @@ func TestGetAPIServerCommand(t *testing.T) {
{
{
name
:
"ignores the audit policy if the feature gate is not enabled"
,
name
:
"ignores the audit policy if the feature gate is not enabled"
,
cfg
:
&
kubeadmapi
.
InitConfiguration
{
cfg
:
&
kubeadmapi
.
InitConfiguration
{
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
BindPort
:
123
,
AdvertiseAddress
:
"4.3.2.1"
},
Local
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
BindPort
:
123
,
AdvertiseAddress
:
"4.3.2.1"
},
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
Networking
:
kubeadmapi
.
Networking
{
ServiceSubnet
:
"bar"
},
Networking
:
kubeadmapi
.
Networking
{
ServiceSubnet
:
"bar"
},
CertificatesDir
:
testCertsDir
,
CertificatesDir
:
testCertsDir
,
...
@@ -229,7 +229,7 @@ func TestGetAPIServerCommand(t *testing.T) {
...
@@ -229,7 +229,7 @@ func TestGetAPIServerCommand(t *testing.T) {
{
{
name
:
"ipv6 advertise address"
,
name
:
"ipv6 advertise address"
,
cfg
:
&
kubeadmapi
.
InitConfiguration
{
cfg
:
&
kubeadmapi
.
InitConfiguration
{
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
BindPort
:
123
,
AdvertiseAddress
:
"2001:db8::1"
},
Local
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
BindPort
:
123
,
AdvertiseAddress
:
"2001:db8::1"
},
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
Networking
:
kubeadmapi
.
Networking
{
ServiceSubnet
:
"bar"
},
Networking
:
kubeadmapi
.
Networking
{
ServiceSubnet
:
"bar"
},
CertificatesDir
:
testCertsDir
,
CertificatesDir
:
testCertsDir
,
...
@@ -268,7 +268,7 @@ func TestGetAPIServerCommand(t *testing.T) {
...
@@ -268,7 +268,7 @@ func TestGetAPIServerCommand(t *testing.T) {
{
{
name
:
"an external etcd with custom ca, certs and keys"
,
name
:
"an external etcd with custom ca, certs and keys"
,
cfg
:
&
kubeadmapi
.
InitConfiguration
{
cfg
:
&
kubeadmapi
.
InitConfiguration
{
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
BindPort
:
123
,
AdvertiseAddress
:
"2001:db8::1"
},
Local
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
BindPort
:
123
,
AdvertiseAddress
:
"2001:db8::1"
},
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
Networking
:
kubeadmapi
.
Networking
{
ServiceSubnet
:
"bar"
},
Networking
:
kubeadmapi
.
Networking
{
ServiceSubnet
:
"bar"
},
Etcd
:
kubeadmapi
.
Etcd
{
Etcd
:
kubeadmapi
.
Etcd
{
...
@@ -315,7 +315,7 @@ func TestGetAPIServerCommand(t *testing.T) {
...
@@ -315,7 +315,7 @@ func TestGetAPIServerCommand(t *testing.T) {
{
{
name
:
"an insecure etcd"
,
name
:
"an insecure etcd"
,
cfg
:
&
kubeadmapi
.
InitConfiguration
{
cfg
:
&
kubeadmapi
.
InitConfiguration
{
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
BindPort
:
123
,
AdvertiseAddress
:
"2001:db8::1"
},
Local
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
BindPort
:
123
,
AdvertiseAddress
:
"2001:db8::1"
},
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
Networking
:
kubeadmapi
.
Networking
{
ServiceSubnet
:
"bar"
},
Networking
:
kubeadmapi
.
Networking
{
ServiceSubnet
:
"bar"
},
Etcd
:
kubeadmapi
.
Etcd
{
Etcd
:
kubeadmapi
.
Etcd
{
...
@@ -356,7 +356,7 @@ func TestGetAPIServerCommand(t *testing.T) {
...
@@ -356,7 +356,7 @@ func TestGetAPIServerCommand(t *testing.T) {
{
{
name
:
"auditing is enabled with a custom log max age of 0"
,
name
:
"auditing is enabled with a custom log max age of 0"
,
cfg
:
&
kubeadmapi
.
InitConfiguration
{
cfg
:
&
kubeadmapi
.
InitConfiguration
{
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
BindPort
:
123
,
AdvertiseAddress
:
"2001:db8::1"
},
Local
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
BindPort
:
123
,
AdvertiseAddress
:
"2001:db8::1"
},
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
Networking
:
kubeadmapi
.
Networking
{
ServiceSubnet
:
"bar"
},
Networking
:
kubeadmapi
.
Networking
{
ServiceSubnet
:
"bar"
},
FeatureGates
:
map
[
string
]
bool
{
features
.
Auditing
:
true
},
FeatureGates
:
map
[
string
]
bool
{
features
.
Auditing
:
true
},
...
@@ -402,7 +402,7 @@ func TestGetAPIServerCommand(t *testing.T) {
...
@@ -402,7 +402,7 @@ func TestGetAPIServerCommand(t *testing.T) {
{
{
name
:
"ensure the DynamicKubelet flag gets passed through"
,
name
:
"ensure the DynamicKubelet flag gets passed through"
,
cfg
:
&
kubeadmapi
.
InitConfiguration
{
cfg
:
&
kubeadmapi
.
InitConfiguration
{
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
BindPort
:
123
,
AdvertiseAddress
:
"1.2.3.4"
},
Local
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
BindPort
:
123
,
AdvertiseAddress
:
"1.2.3.4"
},
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
Networking
:
kubeadmapi
.
Networking
{
ServiceSubnet
:
"bar"
},
Networking
:
kubeadmapi
.
Networking
{
ServiceSubnet
:
"bar"
},
CertificatesDir
:
testCertsDir
,
CertificatesDir
:
testCertsDir
,
...
@@ -443,7 +443,7 @@ func TestGetAPIServerCommand(t *testing.T) {
...
@@ -443,7 +443,7 @@ func TestGetAPIServerCommand(t *testing.T) {
{
{
name
:
"test APIServer.ExtraArgs works as expected"
,
name
:
"test APIServer.ExtraArgs works as expected"
,
cfg
:
&
kubeadmapi
.
InitConfiguration
{
cfg
:
&
kubeadmapi
.
InitConfiguration
{
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
BindPort
:
123
,
AdvertiseAddress
:
"1.2.3.4"
},
Local
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
BindPort
:
123
,
AdvertiseAddress
:
"1.2.3.4"
},
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
Networking
:
kubeadmapi
.
Networking
{
ServiceSubnet
:
"bar"
},
Networking
:
kubeadmapi
.
Networking
{
ServiceSubnet
:
"bar"
},
CertificatesDir
:
testCertsDir
,
CertificatesDir
:
testCertsDir
,
...
@@ -497,7 +497,7 @@ func TestGetAPIServerCommand(t *testing.T) {
...
@@ -497,7 +497,7 @@ func TestGetAPIServerCommand(t *testing.T) {
{
{
name
:
"authorization-mode extra-args ABAC"
,
name
:
"authorization-mode extra-args ABAC"
,
cfg
:
&
kubeadmapi
.
InitConfiguration
{
cfg
:
&
kubeadmapi
.
InitConfiguration
{
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
BindPort
:
123
,
AdvertiseAddress
:
"1.2.3.4"
},
Local
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
BindPort
:
123
,
AdvertiseAddress
:
"1.2.3.4"
},
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
Networking
:
kubeadmapi
.
Networking
{
ServiceSubnet
:
"bar"
},
Networking
:
kubeadmapi
.
Networking
{
ServiceSubnet
:
"bar"
},
CertificatesDir
:
testCertsDir
,
CertificatesDir
:
testCertsDir
,
...
@@ -543,7 +543,7 @@ func TestGetAPIServerCommand(t *testing.T) {
...
@@ -543,7 +543,7 @@ func TestGetAPIServerCommand(t *testing.T) {
{
{
name
:
"insecure-port extra-args"
,
name
:
"insecure-port extra-args"
,
cfg
:
&
kubeadmapi
.
InitConfiguration
{
cfg
:
&
kubeadmapi
.
InitConfiguration
{
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
BindPort
:
123
,
AdvertiseAddress
:
"1.2.3.4"
},
Local
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
BindPort
:
123
,
AdvertiseAddress
:
"1.2.3.4"
},
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
Networking
:
kubeadmapi
.
Networking
{
ServiceSubnet
:
"bar"
},
Networking
:
kubeadmapi
.
Networking
{
ServiceSubnet
:
"bar"
},
CertificatesDir
:
testCertsDir
,
CertificatesDir
:
testCertsDir
,
...
@@ -589,7 +589,7 @@ func TestGetAPIServerCommand(t *testing.T) {
...
@@ -589,7 +589,7 @@ func TestGetAPIServerCommand(t *testing.T) {
{
{
name
:
"authorization-mode extra-args Webhook"
,
name
:
"authorization-mode extra-args Webhook"
,
cfg
:
&
kubeadmapi
.
InitConfiguration
{
cfg
:
&
kubeadmapi
.
InitConfiguration
{
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
BindPort
:
123
,
AdvertiseAddress
:
"1.2.3.4"
},
Local
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
BindPort
:
123
,
AdvertiseAddress
:
"1.2.3.4"
},
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
Networking
:
kubeadmapi
.
Networking
{
ServiceSubnet
:
"bar"
},
Networking
:
kubeadmapi
.
Networking
{
ServiceSubnet
:
"bar"
},
CertificatesDir
:
testCertsDir
,
CertificatesDir
:
testCertsDir
,
...
@@ -971,7 +971,7 @@ func TestGetControllerManagerCommandExternalCA(t *testing.T) {
...
@@ -971,7 +971,7 @@ func TestGetControllerManagerCommandExternalCA(t *testing.T) {
{
{
name
:
"caKeyPresent-false for v1.12.0-beta.2"
,
name
:
"caKeyPresent-false for v1.12.0-beta.2"
,
cfg
:
&
kubeadmapi
.
InitConfiguration
{
cfg
:
&
kubeadmapi
.
InitConfiguration
{
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
AdvertiseAddress
:
"1.2.3.4"
},
Local
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
AdvertiseAddress
:
"1.2.3.4"
},
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
KubernetesVersion
:
"v1.12.0-beta.2"
,
KubernetesVersion
:
"v1.12.0-beta.2"
,
Networking
:
kubeadmapi
.
Networking
{
ServiceSubnet
:
"10.96.0.0/12"
,
DNSDomain
:
"cluster.local"
},
Networking
:
kubeadmapi
.
Networking
{
ServiceSubnet
:
"10.96.0.0/12"
,
DNSDomain
:
"cluster.local"
},
...
@@ -1000,7 +1000,7 @@ func TestGetControllerManagerCommandExternalCA(t *testing.T) {
...
@@ -1000,7 +1000,7 @@ func TestGetControllerManagerCommandExternalCA(t *testing.T) {
{
{
name
:
"caKeyPresent true for v1.12.0-beta.2"
,
name
:
"caKeyPresent true for v1.12.0-beta.2"
,
cfg
:
&
kubeadmapi
.
InitConfiguration
{
cfg
:
&
kubeadmapi
.
InitConfiguration
{
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
AdvertiseAddress
:
"1.2.3.4"
},
Local
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
AdvertiseAddress
:
"1.2.3.4"
},
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
KubernetesVersion
:
"v1.12.0-beta.2"
,
KubernetesVersion
:
"v1.12.0-beta.2"
,
Networking
:
kubeadmapi
.
Networking
{
ServiceSubnet
:
"10.96.0.0/12"
,
DNSDomain
:
"cluster.local"
},
Networking
:
kubeadmapi
.
Networking
{
ServiceSubnet
:
"10.96.0.0/12"
,
DNSDomain
:
"cluster.local"
},
...
@@ -1029,7 +1029,7 @@ func TestGetControllerManagerCommandExternalCA(t *testing.T) {
...
@@ -1029,7 +1029,7 @@ func TestGetControllerManagerCommandExternalCA(t *testing.T) {
{
{
name
:
"caKeyPresent-false for v1.11.3"
,
name
:
"caKeyPresent-false for v1.11.3"
,
cfg
:
&
kubeadmapi
.
InitConfiguration
{
cfg
:
&
kubeadmapi
.
InitConfiguration
{
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
AdvertiseAddress
:
"1.2.3.4"
},
Local
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
AdvertiseAddress
:
"1.2.3.4"
},
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
KubernetesVersion
:
"v1.11.3"
,
KubernetesVersion
:
"v1.11.3"
,
Networking
:
kubeadmapi
.
Networking
{
ServiceSubnet
:
"10.96.0.0/12"
,
DNSDomain
:
"cluster.local"
},
Networking
:
kubeadmapi
.
Networking
{
ServiceSubnet
:
"10.96.0.0/12"
,
DNSDomain
:
"cluster.local"
},
...
@@ -1054,7 +1054,7 @@ func TestGetControllerManagerCommandExternalCA(t *testing.T) {
...
@@ -1054,7 +1054,7 @@ func TestGetControllerManagerCommandExternalCA(t *testing.T) {
{
{
name
:
"caKeyPresent true for v1.11.3"
,
name
:
"caKeyPresent true for v1.11.3"
,
cfg
:
&
kubeadmapi
.
InitConfiguration
{
cfg
:
&
kubeadmapi
.
InitConfiguration
{
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
AdvertiseAddress
:
"1.2.3.4"
},
Local
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
AdvertiseAddress
:
"1.2.3.4"
},
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
KubernetesVersion
:
"v1.11.3"
,
KubernetesVersion
:
"v1.11.3"
,
Networking
:
kubeadmapi
.
Networking
{
ServiceSubnet
:
"10.96.0.0/12"
,
DNSDomain
:
"cluster.local"
},
Networking
:
kubeadmapi
.
Networking
{
ServiceSubnet
:
"10.96.0.0/12"
,
DNSDomain
:
"cluster.local"
},
...
...
cmd/kubeadm/app/phases/etcd/local_test.go
View file @
5656338b
...
@@ -124,7 +124,7 @@ func TestGetEtcdCommand(t *testing.T) {
...
@@ -124,7 +124,7 @@ func TestGetEtcdCommand(t *testing.T) {
{
{
name
:
"Default args - with empty etcd initial cluster"
,
name
:
"Default args - with empty etcd initial cluster"
,
cfg
:
&
kubeadmapi
.
InitConfiguration
{
cfg
:
&
kubeadmapi
.
InitConfiguration
{
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
Local
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
AdvertiseAddress
:
"1.2.3.4"
,
AdvertiseAddress
:
"1.2.3.4"
,
},
},
NodeRegistration
:
kubeadmapi
.
NodeRegistrationOptions
{
NodeRegistration
:
kubeadmapi
.
NodeRegistrationOptions
{
...
@@ -161,7 +161,7 @@ func TestGetEtcdCommand(t *testing.T) {
...
@@ -161,7 +161,7 @@ func TestGetEtcdCommand(t *testing.T) {
{
{
name
:
"Default args - With an existing etcd cluster"
,
name
:
"Default args - With an existing etcd cluster"
,
cfg
:
&
kubeadmapi
.
InitConfiguration
{
cfg
:
&
kubeadmapi
.
InitConfiguration
{
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
Local
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
AdvertiseAddress
:
"1.2.3.4"
,
AdvertiseAddress
:
"1.2.3.4"
,
},
},
NodeRegistration
:
kubeadmapi
.
NodeRegistrationOptions
{
NodeRegistration
:
kubeadmapi
.
NodeRegistrationOptions
{
...
@@ -203,7 +203,7 @@ func TestGetEtcdCommand(t *testing.T) {
...
@@ -203,7 +203,7 @@ func TestGetEtcdCommand(t *testing.T) {
{
{
name
:
"Extra args"
,
name
:
"Extra args"
,
cfg
:
&
kubeadmapi
.
InitConfiguration
{
cfg
:
&
kubeadmapi
.
InitConfiguration
{
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
Local
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
AdvertiseAddress
:
"1.2.3.4"
,
AdvertiseAddress
:
"1.2.3.4"
,
},
},
NodeRegistration
:
kubeadmapi
.
NodeRegistrationOptions
{
NodeRegistration
:
kubeadmapi
.
NodeRegistrationOptions
{
...
...
cmd/kubeadm/app/phases/kubeconfig/kubeconfig_test.go
View file @
5656338b
...
@@ -69,14 +69,14 @@ func TestGetKubeConfigSpecs(t *testing.T) {
...
@@ -69,14 +69,14 @@ func TestGetKubeConfigSpecs(t *testing.T) {
// Creates Master Configurations pointing to the pkidir folder
// Creates Master Configurations pointing to the pkidir folder
cfgs
:=
[]
*
kubeadmapi
.
InitConfiguration
{
cfgs
:=
[]
*
kubeadmapi
.
InitConfiguration
{
{
{
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
AdvertiseAddress
:
"1.2.3.4"
,
BindPort
:
1234
},
Local
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
AdvertiseAddress
:
"1.2.3.4"
,
BindPort
:
1234
},
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
CertificatesDir
:
pkidir
,
CertificatesDir
:
pkidir
,
},
},
NodeRegistration
:
kubeadmapi
.
NodeRegistrationOptions
{
Name
:
"valid-node-name"
},
NodeRegistration
:
kubeadmapi
.
NodeRegistrationOptions
{
Name
:
"valid-node-name"
},
},
},
{
{
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
AdvertiseAddress
:
"1.2.3.4"
,
BindPort
:
1234
},
Local
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
AdvertiseAddress
:
"1.2.3.4"
,
BindPort
:
1234
},
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
ControlPlaneEndpoint
:
"api.k8s.io"
,
ControlPlaneEndpoint
:
"api.k8s.io"
,
CertificatesDir
:
pkidir
,
CertificatesDir
:
pkidir
,
...
@@ -84,7 +84,7 @@ func TestGetKubeConfigSpecs(t *testing.T) {
...
@@ -84,7 +84,7 @@ func TestGetKubeConfigSpecs(t *testing.T) {
NodeRegistration
:
kubeadmapi
.
NodeRegistrationOptions
{
Name
:
"valid-node-name"
},
NodeRegistration
:
kubeadmapi
.
NodeRegistrationOptions
{
Name
:
"valid-node-name"
},
},
},
{
{
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
AdvertiseAddress
:
"1.2.3.4"
,
BindPort
:
1234
},
Local
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
AdvertiseAddress
:
"1.2.3.4"
,
BindPort
:
1234
},
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
ControlPlaneEndpoint
:
"api.k8s.io:4321"
,
ControlPlaneEndpoint
:
"api.k8s.io:4321"
,
CertificatesDir
:
pkidir
,
CertificatesDir
:
pkidir
,
...
@@ -92,7 +92,7 @@ func TestGetKubeConfigSpecs(t *testing.T) {
...
@@ -92,7 +92,7 @@ func TestGetKubeConfigSpecs(t *testing.T) {
NodeRegistration
:
kubeadmapi
.
NodeRegistrationOptions
{
Name
:
"valid-node-name"
},
NodeRegistration
:
kubeadmapi
.
NodeRegistrationOptions
{
Name
:
"valid-node-name"
},
},
},
{
{
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
AdvertiseAddress
:
"1.2.3.4"
,
BindPort
:
1234
},
Local
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
AdvertiseAddress
:
"1.2.3.4"
,
BindPort
:
1234
},
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
ControlPlaneEndpoint
:
"api.k8s.io"
,
ControlPlaneEndpoint
:
"api.k8s.io"
,
CertificatesDir
:
pkidir
,
CertificatesDir
:
pkidir
,
...
@@ -100,7 +100,7 @@ func TestGetKubeConfigSpecs(t *testing.T) {
...
@@ -100,7 +100,7 @@ func TestGetKubeConfigSpecs(t *testing.T) {
NodeRegistration
:
kubeadmapi
.
NodeRegistrationOptions
{
Name
:
"valid-node-name"
},
NodeRegistration
:
kubeadmapi
.
NodeRegistrationOptions
{
Name
:
"valid-node-name"
},
},
},
{
{
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
AdvertiseAddress
:
"1.2.3.4"
,
BindPort
:
1234
},
Local
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
AdvertiseAddress
:
"1.2.3.4"
,
BindPort
:
1234
},
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
ControlPlaneEndpoint
:
"api.k8s.io:4321"
,
ControlPlaneEndpoint
:
"api.k8s.io:4321"
,
CertificatesDir
:
pkidir
,
CertificatesDir
:
pkidir
,
...
@@ -307,7 +307,7 @@ func TestCreateKubeconfigFilesAndWrappers(t *testing.T) {
...
@@ -307,7 +307,7 @@ func TestCreateKubeconfigFilesAndWrappers(t *testing.T) {
// Creates a Master Configuration pointing to the pkidir folder
// Creates a Master Configuration pointing to the pkidir folder
cfg
:=
&
kubeadmapi
.
InitConfiguration
{
cfg
:=
&
kubeadmapi
.
InitConfiguration
{
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
AdvertiseAddress
:
"1.2.3.4"
,
BindPort
:
1234
},
Local
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
AdvertiseAddress
:
"1.2.3.4"
,
BindPort
:
1234
},
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
CertificatesDir
:
pkidir
,
CertificatesDir
:
pkidir
,
},
},
...
@@ -384,7 +384,7 @@ func TestWriteKubeConfig(t *testing.T) {
...
@@ -384,7 +384,7 @@ func TestWriteKubeConfig(t *testing.T) {
// Creates a Master Configuration pointing to the pkidir folder
// Creates a Master Configuration pointing to the pkidir folder
cfg
:=
&
kubeadmapi
.
InitConfiguration
{
cfg
:=
&
kubeadmapi
.
InitConfiguration
{
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
AdvertiseAddress
:
"1.2.3.4"
,
BindPort
:
1234
},
Local
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
AdvertiseAddress
:
"1.2.3.4"
,
BindPort
:
1234
},
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
CertificatesDir
:
pkidir
,
CertificatesDir
:
pkidir
,
},
},
...
@@ -506,7 +506,7 @@ func TestValidateKubeconfigsForExternalCA(t *testing.T) {
...
@@ -506,7 +506,7 @@ func TestValidateKubeconfigsForExternalCA(t *testing.T) {
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
CertificatesDir
:
pkiDir
,
CertificatesDir
:
pkiDir
,
},
},
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
Local
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
BindPort
:
1234
,
BindPort
:
1234
,
AdvertiseAddress
:
"1.2.3.4"
,
AdvertiseAddress
:
"1.2.3.4"
,
},
},
...
...
cmd/kubeadm/app/phases/upgrade/postupgrade_test.go
View file @
5656338b
...
@@ -130,7 +130,7 @@ func TestRollbackFiles(t *testing.T) {
...
@@ -130,7 +130,7 @@ func TestRollbackFiles(t *testing.T) {
func
TestShouldBackupAPIServerCertAndKey
(
t
*
testing
.
T
)
{
func
TestShouldBackupAPIServerCertAndKey
(
t
*
testing
.
T
)
{
cfg
:=
&
kubeadmapi
.
InitConfiguration
{
cfg
:=
&
kubeadmapi
.
InitConfiguration
{
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
AdvertiseAddress
:
"1.2.3.4"
},
Local
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
AdvertiseAddress
:
"1.2.3.4"
},
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
Networking
:
kubeadmapi
.
Networking
{
ServiceSubnet
:
"10.96.0.0/12"
,
DNSDomain
:
"cluster.local"
},
Networking
:
kubeadmapi
.
Networking
{
ServiceSubnet
:
"10.96.0.0/12"
,
DNSDomain
:
"cluster.local"
},
},
},
...
...
cmd/kubeadm/app/phases/uploadconfig/uploadconfig_test.go
View file @
5656338b
...
@@ -65,7 +65,7 @@ func TestUploadConfiguration(t *testing.T) {
...
@@ -65,7 +65,7 @@ func TestUploadConfiguration(t *testing.T) {
for
_
,
tt
:=
range
tests
{
for
_
,
tt
:=
range
tests
{
t
.
Run
(
tt
.
name
,
func
(
t2
*
testing
.
T
)
{
t
.
Run
(
tt
.
name
,
func
(
t2
*
testing
.
T
)
{
initialcfg
:=
&
kubeadmapiv1beta1
.
InitConfiguration
{
initialcfg
:=
&
kubeadmapiv1beta1
.
InitConfiguration
{
APIEndpoint
:
kubeadmapiv1beta1
.
APIEndpoint
{
Local
APIEndpoint
:
kubeadmapiv1beta1
.
APIEndpoint
{
AdvertiseAddress
:
"1.2.3.4"
,
AdvertiseAddress
:
"1.2.3.4"
,
},
},
ClusterConfiguration
:
kubeadmapiv1beta1
.
ClusterConfiguration
{
ClusterConfiguration
:
kubeadmapiv1beta1
.
ClusterConfiguration
{
...
@@ -95,7 +95,7 @@ func TestUploadConfiguration(t *testing.T) {
...
@@ -95,7 +95,7 @@ func TestUploadConfiguration(t *testing.T) {
status
:=
&
kubeadmapi
.
ClusterStatus
{
status
:=
&
kubeadmapi
.
ClusterStatus
{
APIEndpoints
:
map
[
string
]
kubeadmapi
.
APIEndpoint
{
APIEndpoints
:
map
[
string
]
kubeadmapi
.
APIEndpoint
{
"node-foo"
:
cfg
.
APIEndpoint
,
"node-foo"
:
cfg
.
Local
APIEndpoint
,
},
},
}
}
...
...
cmd/kubeadm/app/preflight/checks_test.go
View file @
5656338b
...
@@ -191,7 +191,7 @@ func TestRunInitMasterChecks(t *testing.T) {
...
@@ -191,7 +191,7 @@ func TestRunInitMasterChecks(t *testing.T) {
}{
}{
{
name
:
"Test valid advertised address"
,
{
name
:
"Test valid advertised address"
,
cfg
:
&
kubeadmapi
.
InitConfiguration
{
cfg
:
&
kubeadmapi
.
InitConfiguration
{
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
AdvertiseAddress
:
"foo"
},
Local
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
AdvertiseAddress
:
"foo"
},
},
},
expected
:
false
,
expected
:
false
,
},
},
...
@@ -224,7 +224,7 @@ func TestRunInitMasterChecks(t *testing.T) {
...
@@ -224,7 +224,7 @@ func TestRunInitMasterChecks(t *testing.T) {
},
},
{
{
cfg
:
&
kubeadmapi
.
InitConfiguration
{
cfg
:
&
kubeadmapi
.
InitConfiguration
{
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
AdvertiseAddress
:
"2001:1234::1:15"
},
Local
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
AdvertiseAddress
:
"2001:1234::1:15"
},
},
},
expected
:
false
,
expected
:
false
,
},
},
...
...
cmd/kubeadm/app/util/config/cluster_test.go
View file @
5656338b
...
@@ -459,7 +459,7 @@ func TestGetAPIEndpoint(t *testing.T) {
...
@@ -459,7 +459,7 @@ func TestGetAPIEndpoint(t *testing.T) {
for
_
,
rt
:=
range
tests
{
for
_
,
rt
:=
range
tests
{
t
.
Run
(
rt
.
name
,
func
(
t
*
testing
.
T
)
{
t
.
Run
(
rt
.
name
,
func
(
t
*
testing
.
T
)
{
cfg
:=
&
kubeadmapi
.
InitConfiguration
{}
cfg
:=
&
kubeadmapi
.
InitConfiguration
{}
err
:=
getAPIEndpoint
(
rt
.
configMap
.
data
,
nodeName
,
&
cfg
.
APIEndpoint
)
err
:=
getAPIEndpoint
(
rt
.
configMap
.
data
,
nodeName
,
&
cfg
.
Local
APIEndpoint
)
if
rt
.
expectedError
!=
(
err
!=
nil
)
{
if
rt
.
expectedError
!=
(
err
!=
nil
)
{
t
.
Errorf
(
"unexpected return err from getInitConfigurationFromCluster: %v"
,
err
)
t
.
Errorf
(
"unexpected return err from getInitConfigurationFromCluster: %v"
,
err
)
return
return
...
@@ -468,7 +468,7 @@ func TestGetAPIEndpoint(t *testing.T) {
...
@@ -468,7 +468,7 @@ func TestGetAPIEndpoint(t *testing.T) {
return
return
}
}
if
cfg
.
APIEndpoint
.
AdvertiseAddress
!=
"1.2.3.4"
||
cfg
.
APIEndpoint
.
BindPort
!=
1234
{
if
cfg
.
LocalAPIEndpoint
.
AdvertiseAddress
!=
"1.2.3.4"
||
cfg
.
Local
APIEndpoint
.
BindPort
!=
1234
{
t
.
Errorf
(
"invalid cfg.APIEndpoint"
)
t
.
Errorf
(
"invalid cfg.APIEndpoint"
)
}
}
})
})
...
@@ -757,8 +757,8 @@ func TestGetInitConfigurationFromCluster(t *testing.T) {
...
@@ -757,8 +757,8 @@ func TestGetInitConfigurationFromCluster(t *testing.T) {
if
cfg
.
ClusterConfiguration
.
KubernetesVersion
!=
k8sVersionString
{
if
cfg
.
ClusterConfiguration
.
KubernetesVersion
!=
k8sVersionString
{
t
.
Errorf
(
"invalid ClusterConfiguration.KubernetesVersion"
)
t
.
Errorf
(
"invalid ClusterConfiguration.KubernetesVersion"
)
}
}
if
!
rt
.
newControlPlane
&&
(
cfg
.
APIEndpoint
.
AdvertiseAddress
!=
"1.2.3.4"
||
cfg
.
APIEndpoint
.
BindPort
!=
1234
)
{
if
!
rt
.
newControlPlane
&&
(
cfg
.
LocalAPIEndpoint
.
AdvertiseAddress
!=
"1.2.3.4"
||
cfg
.
Local
APIEndpoint
.
BindPort
!=
1234
)
{
t
.
Errorf
(
"invalid cfg.APIEndpoint"
)
t
.
Errorf
(
"invalid cfg.
Local
APIEndpoint"
)
}
}
if
cfg
.
ComponentConfigs
.
Kubelet
==
nil
{
if
cfg
.
ComponentConfigs
.
Kubelet
==
nil
{
t
.
Errorf
(
"invalid cfg.ComponentConfigs.Kubelet"
)
t
.
Errorf
(
"invalid cfg.ComponentConfigs.Kubelet"
)
...
...
cmd/kubeadm/app/util/config/testdata/conversion/master/internal.yaml
View file @
5656338b
APIEndpoint
:
AdvertiseAddress
:
192.168.2.2
BindPort
:
6443
APIServer
:
APIServer
:
CertSANs
:
null
CertSANs
:
null
ExtraArgs
:
ExtraArgs
:
...
@@ -186,6 +183,9 @@ Etcd:
...
@@ -186,6 +183,9 @@ Etcd:
FeatureGates
:
null
FeatureGates
:
null
ImageRepository
:
k8s.gcr.io
ImageRepository
:
k8s.gcr.io
KubernetesVersion
:
v1.11.2
KubernetesVersion
:
v1.11.2
LocalAPIEndpoint
:
AdvertiseAddress
:
192.168.2.2
BindPort
:
6443
Networking
:
Networking
:
DNSDomain
:
cluster.local
DNSDomain
:
cluster.local
PodSubnet
:
"
"
PodSubnet
:
"
"
...
...
cmd/kubeadm/app/util/config/testdata/conversion/master/v1beta1.yaml
View file @
5656338b
apiEndpoint
:
advertiseAddress
:
192.168.2.2
bindPort
:
6443
apiVersion
:
kubeadm.k8s.io/v1beta1
apiVersion
:
kubeadm.k8s.io/v1beta1
bootstrapTokens
:
bootstrapTokens
:
-
groups
:
-
groups
:
...
@@ -11,6 +8,9 @@ bootstrapTokens:
...
@@ -11,6 +8,9 @@ bootstrapTokens:
-
signing
-
signing
-
authentication
-
authentication
kind
:
InitConfiguration
kind
:
InitConfiguration
localAPIEndpoint
:
advertiseAddress
:
192.168.2.2
bindPort
:
6443
nodeRegistration
:
nodeRegistration
:
criSocket
:
/var/run/dockershim.sock
criSocket
:
/var/run/dockershim.sock
name
:
master-1
name
:
master-1
...
...
cmd/kubeadm/app/util/config/testdata/defaulting/master/defaulted.yaml
View file @
5656338b
apiEndpoint
:
advertiseAddress
:
192.168.2.2
bindPort
:
6443
apiVersion
:
kubeadm.k8s.io/v1beta1
apiVersion
:
kubeadm.k8s.io/v1beta1
bootstrapTokens
:
bootstrapTokens
:
-
groups
:
-
groups
:
...
@@ -11,6 +8,9 @@ bootstrapTokens:
...
@@ -11,6 +8,9 @@ bootstrapTokens:
-
signing
-
signing
-
authentication
-
authentication
kind
:
InitConfiguration
kind
:
InitConfiguration
localAPIEndpoint
:
advertiseAddress
:
192.168.2.2
bindPort
:
6443
nodeRegistration
:
nodeRegistration
:
criSocket
:
/var/run/criruntime.sock
criSocket
:
/var/run/criruntime.sock
name
:
master-1
name
:
master-1
...
...
cmd/kubeadm/app/util/config/testdata/defaulting/master/incomplete.yaml
View file @
5656338b
apiVersion
:
kubeadm.k8s.io/v1beta1
apiVersion
:
kubeadm.k8s.io/v1beta1
kind
:
InitConfiguration
kind
:
InitConfiguration
apiEndpoint
:
advertiseAddress
:
192.168.2.2
bootstrapTokens
:
bootstrapTokens
:
-
token
:
s73ybu.6tw6wnqgp5z0wb77
-
token
:
s73ybu.6tw6wnqgp5z0wb77
localAPIEndpoint
:
advertiseAddress
:
192.168.2.2
nodeRegistration
:
nodeRegistration
:
criSocket
:
/var/run/criruntime.sock
criSocket
:
/var/run/criruntime.sock
name
:
master-1
name
:
master-1
...
...
cmd/kubeadm/app/util/endpoint_test.go
View file @
5656338b
...
@@ -32,7 +32,7 @@ func TestGetMasterEndpoint(t *testing.T) {
...
@@ -32,7 +32,7 @@ func TestGetMasterEndpoint(t *testing.T) {
{
{
name
:
"use ControlPlaneEndpoint (dns) if fully defined"
,
name
:
"use ControlPlaneEndpoint (dns) if fully defined"
,
cfg
:
&
kubeadmapi
.
InitConfiguration
{
cfg
:
&
kubeadmapi
.
InitConfiguration
{
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
Local
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
BindPort
:
4567
,
BindPort
:
4567
,
AdvertiseAddress
:
"4.5.6.7"
,
AdvertiseAddress
:
"4.5.6.7"
,
},
},
...
@@ -45,7 +45,7 @@ func TestGetMasterEndpoint(t *testing.T) {
...
@@ -45,7 +45,7 @@ func TestGetMasterEndpoint(t *testing.T) {
{
{
name
:
"use ControlPlaneEndpoint (ipv4) if fully defined"
,
name
:
"use ControlPlaneEndpoint (ipv4) if fully defined"
,
cfg
:
&
kubeadmapi
.
InitConfiguration
{
cfg
:
&
kubeadmapi
.
InitConfiguration
{
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
Local
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
BindPort
:
4567
,
BindPort
:
4567
,
AdvertiseAddress
:
"4.5.6.7"
,
AdvertiseAddress
:
"4.5.6.7"
,
},
},
...
@@ -58,7 +58,7 @@ func TestGetMasterEndpoint(t *testing.T) {
...
@@ -58,7 +58,7 @@ func TestGetMasterEndpoint(t *testing.T) {
{
{
name
:
"use ControlPlaneEndpoint (ipv6) if fully defined"
,
name
:
"use ControlPlaneEndpoint (ipv6) if fully defined"
,
cfg
:
&
kubeadmapi
.
InitConfiguration
{
cfg
:
&
kubeadmapi
.
InitConfiguration
{
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
Local
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
BindPort
:
4567
,
BindPort
:
4567
,
AdvertiseAddress
:
"4.5.6.7"
,
AdvertiseAddress
:
"4.5.6.7"
,
},
},
...
@@ -71,7 +71,7 @@ func TestGetMasterEndpoint(t *testing.T) {
...
@@ -71,7 +71,7 @@ func TestGetMasterEndpoint(t *testing.T) {
{
{
name
:
"use ControlPlaneEndpoint (dns) + BindPort if ControlPlaneEndpoint defined without port"
,
name
:
"use ControlPlaneEndpoint (dns) + BindPort if ControlPlaneEndpoint defined without port"
,
cfg
:
&
kubeadmapi
.
InitConfiguration
{
cfg
:
&
kubeadmapi
.
InitConfiguration
{
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
Local
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
BindPort
:
4567
,
BindPort
:
4567
,
AdvertiseAddress
:
"4.5.6.7"
,
AdvertiseAddress
:
"4.5.6.7"
,
},
},
...
@@ -85,7 +85,7 @@ func TestGetMasterEndpoint(t *testing.T) {
...
@@ -85,7 +85,7 @@ func TestGetMasterEndpoint(t *testing.T) {
{
{
name
:
"use ControlPlaneEndpoint (ipv4) + BindPort if ControlPlaneEndpoint defined without port"
,
name
:
"use ControlPlaneEndpoint (ipv4) + BindPort if ControlPlaneEndpoint defined without port"
,
cfg
:
&
kubeadmapi
.
InitConfiguration
{
cfg
:
&
kubeadmapi
.
InitConfiguration
{
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
Local
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
BindPort
:
4567
,
BindPort
:
4567
,
AdvertiseAddress
:
"4.5.6.7"
,
AdvertiseAddress
:
"4.5.6.7"
,
},
},
...
@@ -98,7 +98,7 @@ func TestGetMasterEndpoint(t *testing.T) {
...
@@ -98,7 +98,7 @@ func TestGetMasterEndpoint(t *testing.T) {
{
{
name
:
"use ControlPlaneEndpoint (ipv6) + BindPort if ControlPlaneEndpoint defined without port"
,
name
:
"use ControlPlaneEndpoint (ipv6) + BindPort if ControlPlaneEndpoint defined without port"
,
cfg
:
&
kubeadmapi
.
InitConfiguration
{
cfg
:
&
kubeadmapi
.
InitConfiguration
{
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
Local
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
BindPort
:
4567
,
BindPort
:
4567
,
AdvertiseAddress
:
"4.5.6.7"
,
AdvertiseAddress
:
"4.5.6.7"
,
},
},
...
@@ -112,7 +112,7 @@ func TestGetMasterEndpoint(t *testing.T) {
...
@@ -112,7 +112,7 @@ func TestGetMasterEndpoint(t *testing.T) {
{
{
name
:
"use AdvertiseAddress (ipv4) + BindPort if ControlPlaneEndpoint is not defined"
,
name
:
"use AdvertiseAddress (ipv4) + BindPort if ControlPlaneEndpoint is not defined"
,
cfg
:
&
kubeadmapi
.
InitConfiguration
{
cfg
:
&
kubeadmapi
.
InitConfiguration
{
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
Local
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
BindPort
:
4567
,
BindPort
:
4567
,
AdvertiseAddress
:
"4.5.6.7"
,
AdvertiseAddress
:
"4.5.6.7"
,
},
},
...
@@ -122,7 +122,7 @@ func TestGetMasterEndpoint(t *testing.T) {
...
@@ -122,7 +122,7 @@ func TestGetMasterEndpoint(t *testing.T) {
{
{
name
:
"use AdvertiseAddress (ipv6) + BindPort if ControlPlaneEndpoint is not defined"
,
name
:
"use AdvertiseAddress (ipv6) + BindPort if ControlPlaneEndpoint is not defined"
,
cfg
:
&
kubeadmapi
.
InitConfiguration
{
cfg
:
&
kubeadmapi
.
InitConfiguration
{
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
Local
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
BindPort
:
4567
,
BindPort
:
4567
,
AdvertiseAddress
:
"2001:db8::1"
,
AdvertiseAddress
:
"2001:db8::1"
,
},
},
...
@@ -132,7 +132,7 @@ func TestGetMasterEndpoint(t *testing.T) {
...
@@ -132,7 +132,7 @@ func TestGetMasterEndpoint(t *testing.T) {
{
{
name
:
"fail if invalid BindPort"
,
name
:
"fail if invalid BindPort"
,
cfg
:
&
kubeadmapi
.
InitConfiguration
{
cfg
:
&
kubeadmapi
.
InitConfiguration
{
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
Local
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
BindPort
:
0
,
BindPort
:
0
,
},
},
},
},
...
@@ -177,7 +177,7 @@ func TestGetMasterEndpoint(t *testing.T) {
...
@@ -177,7 +177,7 @@ func TestGetMasterEndpoint(t *testing.T) {
{
{
name
:
"fail if invalid AdvertiseAddress (ip4)"
,
name
:
"fail if invalid AdvertiseAddress (ip4)"
,
cfg
:
&
kubeadmapi
.
InitConfiguration
{
cfg
:
&
kubeadmapi
.
InitConfiguration
{
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
Local
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
AdvertiseAddress
:
"1..0"
,
AdvertiseAddress
:
"1..0"
,
BindPort
:
4567
,
BindPort
:
4567
,
},
},
...
@@ -187,7 +187,7 @@ func TestGetMasterEndpoint(t *testing.T) {
...
@@ -187,7 +187,7 @@ func TestGetMasterEndpoint(t *testing.T) {
{
{
name
:
"fail if invalid AdvertiseAddress (ip6)"
,
name
:
"fail if invalid AdvertiseAddress (ip6)"
,
cfg
:
&
kubeadmapi
.
InitConfiguration
{
cfg
:
&
kubeadmapi
.
InitConfiguration
{
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
Local
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
AdvertiseAddress
:
"1200::AB00:1234::2552:7777:1313"
,
AdvertiseAddress
:
"1200::AB00:1234::2552:7777:1313"
,
BindPort
:
4567
,
BindPort
:
4567
,
},
},
...
...
cmd/kubeadm/app/util/pkiutil/pki_helpers_test.go
View file @
5656338b
...
@@ -446,7 +446,7 @@ func TestGetAPIServerAltNames(t *testing.T) {
...
@@ -446,7 +446,7 @@ func TestGetAPIServerAltNames(t *testing.T) {
{
{
name
:
"ControlPlaneEndpoint DNS"
,
name
:
"ControlPlaneEndpoint DNS"
,
cfg
:
&
kubeadmapi
.
InitConfiguration
{
cfg
:
&
kubeadmapi
.
InitConfiguration
{
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
AdvertiseAddress
:
"1.2.3.4"
},
Local
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
AdvertiseAddress
:
"1.2.3.4"
},
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
ControlPlaneEndpoint
:
"api.k8s.io:6443"
,
ControlPlaneEndpoint
:
"api.k8s.io:6443"
,
Networking
:
kubeadmapi
.
Networking
{
ServiceSubnet
:
"10.96.0.0/12"
,
DNSDomain
:
"cluster.local"
},
Networking
:
kubeadmapi
.
Networking
{
ServiceSubnet
:
"10.96.0.0/12"
,
DNSDomain
:
"cluster.local"
},
...
@@ -462,7 +462,7 @@ func TestGetAPIServerAltNames(t *testing.T) {
...
@@ -462,7 +462,7 @@ func TestGetAPIServerAltNames(t *testing.T) {
{
{
name
:
"ControlPlaneEndpoint IP"
,
name
:
"ControlPlaneEndpoint IP"
,
cfg
:
&
kubeadmapi
.
InitConfiguration
{
cfg
:
&
kubeadmapi
.
InitConfiguration
{
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
AdvertiseAddress
:
"1.2.3.4"
},
Local
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
AdvertiseAddress
:
"1.2.3.4"
},
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
ControlPlaneEndpoint
:
"4.5.6.7:6443"
,
ControlPlaneEndpoint
:
"4.5.6.7:6443"
,
Networking
:
kubeadmapi
.
Networking
{
ServiceSubnet
:
"10.96.0.0/12"
,
DNSDomain
:
"cluster.local"
},
Networking
:
kubeadmapi
.
Networking
{
ServiceSubnet
:
"10.96.0.0/12"
,
DNSDomain
:
"cluster.local"
},
...
@@ -517,7 +517,7 @@ func TestGetEtcdAltNames(t *testing.T) {
...
@@ -517,7 +517,7 @@ func TestGetEtcdAltNames(t *testing.T) {
proxy
:=
"user-etcd-proxy"
proxy
:=
"user-etcd-proxy"
proxyIP
:=
"10.10.10.100"
proxyIP
:=
"10.10.10.100"
cfg
:=
&
kubeadmapi
.
InitConfiguration
{
cfg
:=
&
kubeadmapi
.
InitConfiguration
{
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
Local
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
AdvertiseAddress
:
"1.2.3.4"
,
AdvertiseAddress
:
"1.2.3.4"
,
},
},
NodeRegistration
:
kubeadmapi
.
NodeRegistrationOptions
{
NodeRegistration
:
kubeadmapi
.
NodeRegistrationOptions
{
...
@@ -579,7 +579,7 @@ func TestGetEtcdPeerAltNames(t *testing.T) {
...
@@ -579,7 +579,7 @@ func TestGetEtcdPeerAltNames(t *testing.T) {
proxyIP
:=
"10.10.10.100"
proxyIP
:=
"10.10.10.100"
advertiseIP
:=
"1.2.3.4"
advertiseIP
:=
"1.2.3.4"
cfg
:=
&
kubeadmapi
.
InitConfiguration
{
cfg
:=
&
kubeadmapi
.
InitConfiguration
{
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
AdvertiseAddress
:
advertiseIP
},
Local
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
AdvertiseAddress
:
advertiseIP
},
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
ClusterConfiguration
:
kubeadmapi
.
ClusterConfiguration
{
Etcd
:
kubeadmapi
.
Etcd
{
Etcd
:
kubeadmapi
.
Etcd
{
Local
:
&
kubeadmapi
.
LocalEtcd
{
Local
:
&
kubeadmapi
.
LocalEtcd
{
...
...
cmd/kubeadm/app/util/staticpod/utils_test.go
View file @
5656338b
...
@@ -55,7 +55,7 @@ func TestComponentProbe(t *testing.T) {
...
@@ -55,7 +55,7 @@ func TestComponentProbe(t *testing.T) {
{
{
name
:
"default apiserver advertise address with http"
,
name
:
"default apiserver advertise address with http"
,
cfg
:
&
kubeadmapi
.
InitConfiguration
{
cfg
:
&
kubeadmapi
.
InitConfiguration
{
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
Local
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
AdvertiseAddress
:
""
,
AdvertiseAddress
:
""
,
},
},
},
},
...
@@ -68,7 +68,7 @@ func TestComponentProbe(t *testing.T) {
...
@@ -68,7 +68,7 @@ func TestComponentProbe(t *testing.T) {
{
{
name
:
"default apiserver advertise address with https"
,
name
:
"default apiserver advertise address with https"
,
cfg
:
&
kubeadmapi
.
InitConfiguration
{
cfg
:
&
kubeadmapi
.
InitConfiguration
{
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
Local
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
AdvertiseAddress
:
""
,
AdvertiseAddress
:
""
,
},
},
},
},
...
@@ -81,7 +81,7 @@ func TestComponentProbe(t *testing.T) {
...
@@ -81,7 +81,7 @@ func TestComponentProbe(t *testing.T) {
{
{
name
:
"valid ipv4 apiserver advertise address with http"
,
name
:
"valid ipv4 apiserver advertise address with http"
,
cfg
:
&
kubeadmapi
.
InitConfiguration
{
cfg
:
&
kubeadmapi
.
InitConfiguration
{
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
Local
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
AdvertiseAddress
:
"1.2.3.4"
,
AdvertiseAddress
:
"1.2.3.4"
,
},
},
},
},
...
@@ -94,7 +94,7 @@ func TestComponentProbe(t *testing.T) {
...
@@ -94,7 +94,7 @@ func TestComponentProbe(t *testing.T) {
{
{
name
:
"valid ipv6 apiserver advertise address with http"
,
name
:
"valid ipv6 apiserver advertise address with http"
,
cfg
:
&
kubeadmapi
.
InitConfiguration
{
cfg
:
&
kubeadmapi
.
InitConfiguration
{
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
Local
APIEndpoint
:
kubeadmapi
.
APIEndpoint
{
AdvertiseAddress
:
"2001:db8::1"
,
AdvertiseAddress
:
"2001:db8::1"
,
},
},
},
},
...
...
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