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
e11916da
Commit
e11916da
authored
Feb 24, 2019
by
ducnv
Committed by
vanduc95
Feb 25, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kubeadm cleanup: master -> control-plane (cont.4)
parent
139a13d3
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
110 additions
and
110 deletions
+110
-110
dns.go
cmd/kubeadm/app/phases/addons/dns/dns.go
+13
-13
dns_test.go
cmd/kubeadm/app/phases/addons/dns/dns_test.go
+26
-26
manifests.go
cmd/kubeadm/app/phases/addons/dns/manifests.go
+3
-3
manifests.go
cmd/kubeadm/app/phases/addons/proxy/manifests.go
+1
-1
proxy.go
cmd/kubeadm/app/phases/addons/proxy/proxy.go
+8
-8
proxy_test.go
cmd/kubeadm/app/phases/addons/proxy/proxy_test.go
+19
-19
kubeconfig.go
cmd/kubeadm/app/phases/kubeconfig/kubeconfig.go
+9
-9
kubeconfig_test.go
cmd/kubeadm/app/phases/kubeconfig/kubeconfig_test.go
+2
-2
markcontrolplane.go
cmd/kubeadm/app/phases/markcontrolplane/markcontrolplane.go
+2
-2
podspec_mutation.go
cmd/kubeadm/app/phases/selfhosting/podspec_mutation.go
+6
-6
podspec_mutation_test.go
cmd/kubeadm/app/phases/selfhosting/podspec_mutation_test.go
+3
-3
health.go
cmd/kubeadm/app/phases/upgrade/health.go
+10
-10
postupgrade.go
cmd/kubeadm/app/phases/upgrade/postupgrade.go
+4
-4
prepull.go
cmd/kubeadm/app/phases/upgrade/prepull.go
+1
-1
uploadconfig_test.go
cmd/kubeadm/app/phases/uploadconfig/uploadconfig_test.go
+3
-3
No files found.
cmd/kubeadm/app/phases/addons/dns/dns.go
View file @
e11916da
...
@@ -101,15 +101,15 @@ func kubeDNSAddon(cfg *kubeadmapi.ClusterConfiguration, client clientset.Interfa
...
@@ -101,15 +101,15 @@ func kubeDNSAddon(cfg *kubeadmapi.ClusterConfiguration, client clientset.Interfa
}
}
dnsDeploymentBytes
,
err
:=
kubeadmutil
.
ParseTemplate
(
KubeDNSDeployment
,
dnsDeploymentBytes
,
err
:=
kubeadmutil
.
ParseTemplate
(
KubeDNSDeployment
,
struct
{
DeploymentName
,
KubeDNSImage
,
DNSMasqImage
,
SidecarImage
,
DNSBindAddr
,
DNSProbeAddr
,
DNSDomain
,
Master
TaintKey
string
}{
struct
{
DeploymentName
,
KubeDNSImage
,
DNSMasqImage
,
SidecarImage
,
DNSBindAddr
,
DNSProbeAddr
,
DNSDomain
,
ControlPlane
TaintKey
string
}{
DeploymentName
:
kubeadmconstants
.
KubeDNSDeploymentName
,
DeploymentName
:
kubeadmconstants
.
KubeDNSDeploymentName
,
KubeDNSImage
:
images
.
GetDNSImage
(
cfg
,
kubeadmconstants
.
KubeDNSKubeDNSImageName
),
KubeDNSImage
:
images
.
GetDNSImage
(
cfg
,
kubeadmconstants
.
KubeDNSKubeDNSImageName
),
DNSMasqImage
:
images
.
GetDNSImage
(
cfg
,
kubeadmconstants
.
KubeDNSDnsMasqNannyImageName
),
DNSMasqImage
:
images
.
GetDNSImage
(
cfg
,
kubeadmconstants
.
KubeDNSDnsMasqNannyImageName
),
SidecarImage
:
images
.
GetDNSImage
(
cfg
,
kubeadmconstants
.
KubeDNSSidecarImageName
),
SidecarImage
:
images
.
GetDNSImage
(
cfg
,
kubeadmconstants
.
KubeDNSSidecarImageName
),
DNSBindAddr
:
dnsBindAddr
,
DNSBindAddr
:
dnsBindAddr
,
DNSProbeAddr
:
dnsProbeAddr
,
DNSProbeAddr
:
dnsProbeAddr
,
DNSDomain
:
cfg
.
Networking
.
DNSDomain
,
DNSDomain
:
cfg
.
Networking
.
DNSDomain
,
Master
TaintKey
:
kubeadmconstants
.
LabelNodeRoleMaster
,
ControlPlane
TaintKey
:
kubeadmconstants
.
LabelNodeRoleMaster
,
})
})
if
err
!=
nil
{
if
err
!=
nil
{
return
errors
.
Wrap
(
err
,
"error when parsing kube-dns deployment template"
)
return
errors
.
Wrap
(
err
,
"error when parsing kube-dns deployment template"
)
...
@@ -157,10 +157,10 @@ func createKubeDNSAddon(deploymentBytes, serviceBytes []byte, client clientset.I
...
@@ -157,10 +157,10 @@ func createKubeDNSAddon(deploymentBytes, serviceBytes []byte, client clientset.I
func
coreDNSAddon
(
cfg
*
kubeadmapi
.
ClusterConfiguration
,
client
clientset
.
Interface
)
error
{
func
coreDNSAddon
(
cfg
*
kubeadmapi
.
ClusterConfiguration
,
client
clientset
.
Interface
)
error
{
// Get the YAML manifest
// Get the YAML manifest
coreDNSDeploymentBytes
,
err
:=
kubeadmutil
.
ParseTemplate
(
CoreDNSDeployment
,
struct
{
DeploymentName
,
Image
,
Master
TaintKey
string
}{
coreDNSDeploymentBytes
,
err
:=
kubeadmutil
.
ParseTemplate
(
CoreDNSDeployment
,
struct
{
DeploymentName
,
Image
,
ControlPlane
TaintKey
string
}{
DeploymentName
:
kubeadmconstants
.
CoreDNSDeploymentName
,
DeploymentName
:
kubeadmconstants
.
CoreDNSDeploymentName
,
Image
:
images
.
GetDNSImage
(
cfg
,
kubeadmconstants
.
CoreDNSImageName
),
Image
:
images
.
GetDNSImage
(
cfg
,
kubeadmconstants
.
CoreDNSImageName
),
Master
TaintKey
:
kubeadmconstants
.
LabelNodeRoleMaster
,
ControlPlane
TaintKey
:
kubeadmconstants
.
LabelNodeRoleMaster
,
})
})
if
err
!=
nil
{
if
err
!=
nil
{
return
errors
.
Wrap
(
err
,
"error when parsing CoreDNS deployment template"
)
return
errors
.
Wrap
(
err
,
"error when parsing CoreDNS deployment template"
)
...
...
cmd/kubeadm/app/phases/addons/dns/dns_test.go
View file @
e11916da
...
@@ -98,15 +98,15 @@ func TestCompileManifests(t *testing.T) {
...
@@ -98,15 +98,15 @@ func TestCompileManifests(t *testing.T) {
}{
}{
{
{
manifest
:
KubeDNSDeployment
,
manifest
:
KubeDNSDeployment
,
data
:
struct
{
DeploymentName
,
KubeDNSImage
,
DNSMasqImage
,
SidecarImage
,
DNSBindAddr
,
DNSProbeAddr
,
DNSDomain
,
Master
TaintKey
string
}{
data
:
struct
{
DeploymentName
,
KubeDNSImage
,
DNSMasqImage
,
SidecarImage
,
DNSBindAddr
,
DNSProbeAddr
,
DNSDomain
,
ControlPlane
TaintKey
string
}{
DeploymentName
:
"foo"
,
DeploymentName
:
"foo"
,
KubeDNSImage
:
"foo"
,
KubeDNSImage
:
"foo"
,
DNSMasqImage
:
"foo"
,
DNSMasqImage
:
"foo"
,
SidecarImage
:
"foo"
,
SidecarImage
:
"foo"
,
DNSBindAddr
:
"foo"
,
DNSBindAddr
:
"foo"
,
DNSProbeAddr
:
"foo"
,
DNSProbeAddr
:
"foo"
,
DNSDomain
:
"foo"
,
DNSDomain
:
"foo"
,
Master
TaintKey
:
"foo"
,
ControlPlane
TaintKey
:
"foo"
,
},
},
expected
:
true
,
expected
:
true
,
},
},
...
@@ -119,10 +119,10 @@ func TestCompileManifests(t *testing.T) {
...
@@ -119,10 +119,10 @@ func TestCompileManifests(t *testing.T) {
},
},
{
{
manifest
:
CoreDNSDeployment
,
manifest
:
CoreDNSDeployment
,
data
:
struct
{
DeploymentName
,
Image
,
Master
TaintKey
string
}{
data
:
struct
{
DeploymentName
,
Image
,
ControlPlane
TaintKey
string
}{
DeploymentName
:
"foo"
,
DeploymentName
:
"foo"
,
Image
:
"foo"
,
Image
:
"foo"
,
Master
TaintKey
:
"foo"
,
ControlPlane
TaintKey
:
"foo"
,
},
},
expected
:
true
,
expected
:
true
,
},
},
...
@@ -436,23 +436,23 @@ func TestDeploymentsHaveSystemClusterCriticalPriorityClassName(t *testing.T) {
...
@@ -436,23 +436,23 @@ func TestDeploymentsHaveSystemClusterCriticalPriorityClassName(t *testing.T) {
}{
}{
{
{
manifest
:
KubeDNSDeployment
,
manifest
:
KubeDNSDeployment
,
data
:
struct
{
DeploymentName
,
KubeDNSImage
,
DNSMasqImage
,
SidecarImage
,
DNSBindAddr
,
DNSProbeAddr
,
DNSDomain
,
Master
TaintKey
string
}{
data
:
struct
{
DeploymentName
,
KubeDNSImage
,
DNSMasqImage
,
SidecarImage
,
DNSBindAddr
,
DNSProbeAddr
,
DNSDomain
,
ControlPlane
TaintKey
string
}{
DeploymentName
:
"foo"
,
DeploymentName
:
"foo"
,
KubeDNSImage
:
"foo"
,
KubeDNSImage
:
"foo"
,
DNSMasqImage
:
"foo"
,
DNSMasqImage
:
"foo"
,
SidecarImage
:
"foo"
,
SidecarImage
:
"foo"
,
DNSBindAddr
:
"foo"
,
DNSBindAddr
:
"foo"
,
DNSProbeAddr
:
"foo"
,
DNSProbeAddr
:
"foo"
,
DNSDomain
:
"foo"
,
DNSDomain
:
"foo"
,
Master
TaintKey
:
"foo"
,
ControlPlane
TaintKey
:
"foo"
,
},
},
},
},
{
{
manifest
:
CoreDNSDeployment
,
manifest
:
CoreDNSDeployment
,
data
:
struct
{
DeploymentName
,
Image
,
Master
TaintKey
string
}{
data
:
struct
{
DeploymentName
,
Image
,
ControlPlane
TaintKey
string
}{
DeploymentName
:
"foo"
,
DeploymentName
:
"foo"
,
Image
:
"foo"
,
Image
:
"foo"
,
Master
TaintKey
:
"foo"
,
ControlPlane
TaintKey
:
"foo"
,
},
},
},
},
}
}
...
...
cmd/kubeadm/app/phases/addons/dns/manifests.go
View file @
e11916da
...
@@ -77,7 +77,7 @@ spec:
...
@@ -77,7 +77,7 @@ spec:
path: /readiness
path: /readiness
port: 8081
port: 8081
scheme: HTTP
scheme: HTTP
# we poll on pod startup for the Kubernetes
master
service and
# we poll on pod startup for the Kubernetes
control-plane
service and
# only setup the /readiness HTTP server once that's available.
# only setup the /readiness HTTP server once that's available.
initialDelaySeconds: 3
initialDelaySeconds: 3
timeoutSeconds: 5
timeoutSeconds: 5
...
@@ -173,7 +173,7 @@ spec:
...
@@ -173,7 +173,7 @@ spec:
tolerations:
tolerations:
- key: CriticalAddonsOnly
- key: CriticalAddonsOnly
operator: Exists
operator: Exists
- key: {{ .
Master
TaintKey }}
- key: {{ .
ControlPlane
TaintKey }}
effect: NoSchedule
effect: NoSchedule
`
`
...
@@ -241,7 +241,7 @@ spec:
...
@@ -241,7 +241,7 @@ spec:
tolerations:
tolerations:
- key: CriticalAddonsOnly
- key: CriticalAddonsOnly
operator: Exists
operator: Exists
- key: {{ .
Master
TaintKey }}
- key: {{ .
ControlPlane
TaintKey }}
effect: NoSchedule
effect: NoSchedule
nodeSelector:
nodeSelector:
beta.kubernetes.io/os: linux
beta.kubernetes.io/os: linux
...
...
cmd/kubeadm/app/phases/addons/proxy/manifests.go
View file @
e11916da
...
@@ -33,7 +33,7 @@ data:
...
@@ -33,7 +33,7 @@ data:
clusters:
clusters:
- cluster:
- cluster:
certificate-authority: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
certificate-authority: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
server: {{ .
Master
Endpoint }}
server: {{ .
ControlPlane
Endpoint }}
name: default
name: default
contexts:
contexts:
- context:
- context:
...
...
cmd/kubeadm/app/phases/addons/proxy/proxy.go
View file @
e11916da
...
@@ -67,15 +67,15 @@ func EnsureProxyAddon(cfg *kubeadmapi.ClusterConfiguration, localEndpoint *kubea
...
@@ -67,15 +67,15 @@ func EnsureProxyAddon(cfg *kubeadmapi.ClusterConfiguration, localEndpoint *kubea
var
proxyConfigMapBytes
,
proxyDaemonSetBytes
[]
byte
var
proxyConfigMapBytes
,
proxyDaemonSetBytes
[]
byte
proxyConfigMapBytes
,
err
=
kubeadmutil
.
ParseTemplate
(
KubeProxyConfigMap19
,
proxyConfigMapBytes
,
err
=
kubeadmutil
.
ParseTemplate
(
KubeProxyConfigMap19
,
struct
{
struct
{
MasterEndpoint
string
ControlPlaneEndpoint
string
ProxyConfig
string
ProxyConfig
string
ProxyConfigMap
string
ProxyConfigMap
string
ProxyConfigMapKey
string
ProxyConfigMapKey
string
}{
}{
MasterEndpoint
:
controlPlaneEndpoint
,
ControlPlaneEndpoint
:
controlPlaneEndpoint
,
ProxyConfig
:
prefixBytes
.
String
(),
ProxyConfig
:
prefixBytes
.
String
(),
ProxyConfigMap
:
constants
.
KubeProxyConfigMap
,
ProxyConfigMap
:
constants
.
KubeProxyConfigMap
,
ProxyConfigMapKey
:
constants
.
KubeProxyConfigMapKey
,
ProxyConfigMapKey
:
constants
.
KubeProxyConfigMapKey
,
})
})
if
err
!=
nil
{
if
err
!=
nil
{
return
errors
.
Wrap
(
err
,
"error when parsing kube-proxy configmap template"
)
return
errors
.
Wrap
(
err
,
"error when parsing kube-proxy configmap template"
)
...
...
cmd/kubeadm/app/phases/addons/proxy/proxy_test.go
View file @
e11916da
...
@@ -103,12 +103,12 @@ func TestCompileManifests(t *testing.T) {
...
@@ -103,12 +103,12 @@ func TestCompileManifests(t *testing.T) {
{
{
manifest
:
KubeProxyConfigMap19
,
manifest
:
KubeProxyConfigMap19
,
data
:
struct
{
data
:
struct
{
Master
Endpoint
,
ProxyConfig
,
ProxyConfigMap
,
ProxyConfigMapKey
string
ControlPlane
Endpoint
,
ProxyConfig
,
ProxyConfigMap
,
ProxyConfigMapKey
string
}{
}{
MasterEndpoint
:
"foo"
,
ControlPlaneEndpoint
:
"foo"
,
ProxyConfig
:
" bindAddress: 0.0.0.0
\n
clusterCIDR: 192.168.1.1
\n
enableProfiling: false"
,
ProxyConfig
:
" bindAddress: 0.0.0.0
\n
clusterCIDR: 192.168.1.1
\n
enableProfiling: false"
,
ProxyConfigMap
:
"bar"
,
ProxyConfigMap
:
"bar"
,
ProxyConfigMapKey
:
"baz"
,
ProxyConfigMapKey
:
"baz"
,
},
},
expected
:
true
,
expected
:
true
,
},
},
...
@@ -140,7 +140,7 @@ func TestEnsureProxyAddon(t *testing.T) {
...
@@ -140,7 +140,7 @@ func TestEnsureProxyAddon(t *testing.T) {
const
(
const
(
NoError
SimulatedError
=
iota
NoError
SimulatedError
=
iota
ServiceAccountError
ServiceAccountError
Invalid
Master
Endpoint
Invalid
ControlPlane
Endpoint
IPv6SetBindAddress
IPv6SetBindAddress
)
)
...
@@ -177,7 +177,7 @@ func TestEnsureProxyAddon(t *testing.T) {
...
@@ -177,7 +177,7 @@ func TestEnsureProxyAddon(t *testing.T) {
// Create a fake client and set up default test configuration
// Create a fake client and set up default test configuration
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
master
Config
:=
&
kubeadmapiv1beta1
.
InitConfiguration
{
controlPlane
Config
:=
&
kubeadmapiv1beta1
.
InitConfiguration
{
LocalAPIEndpoint
:
kubeadmapiv1beta1
.
APIEndpoint
{
LocalAPIEndpoint
:
kubeadmapiv1beta1
.
APIEndpoint
{
AdvertiseAddress
:
"1.2.3.4"
,
AdvertiseAddress
:
"1.2.3.4"
,
BindPort
:
1234
,
BindPort
:
1234
,
...
@@ -197,19 +197,19 @@ func TestEnsureProxyAddon(t *testing.T) {
...
@@ -197,19 +197,19 @@ func TestEnsureProxyAddon(t *testing.T) {
client
.
PrependReactor
(
"create"
,
"serviceaccounts"
,
func
(
action
core
.
Action
)
(
bool
,
runtime
.
Object
,
error
)
{
client
.
PrependReactor
(
"create"
,
"serviceaccounts"
,
func
(
action
core
.
Action
)
(
bool
,
runtime
.
Object
,
error
)
{
return
true
,
nil
,
apierrors
.
NewUnauthorized
(
""
)
return
true
,
nil
,
apierrors
.
NewUnauthorized
(
""
)
})
})
case
Invalid
Master
Endpoint
:
case
Invalid
ControlPlane
Endpoint
:
master
Config
.
LocalAPIEndpoint
.
AdvertiseAddress
=
"1.2.3"
controlPlane
Config
.
LocalAPIEndpoint
.
AdvertiseAddress
=
"1.2.3"
case
IPv6SetBindAddress
:
case
IPv6SetBindAddress
:
master
Config
.
LocalAPIEndpoint
.
AdvertiseAddress
=
"1:2::3:4"
controlPlane
Config
.
LocalAPIEndpoint
.
AdvertiseAddress
=
"1:2::3:4"
master
Config
.
Networking
.
PodSubnet
=
"2001:101::/96"
controlPlane
Config
.
Networking
.
PodSubnet
=
"2001:101::/96"
}
}
int
Master
,
err
:=
configutil
.
DefaultedInitConfiguration
(
master
Config
)
int
ControlPlane
,
err
:=
configutil
.
DefaultedInitConfiguration
(
controlPlane
Config
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Errorf
(
"test failed to convert external to internal version"
)
t
.
Errorf
(
"test failed to convert external to internal version"
)
break
break
}
}
int
Master
.
ComponentConfigs
.
KubeProxy
=
&
kubeproxyconfig
.
KubeProxyConfiguration
{
int
ControlPlane
.
ComponentConfigs
.
KubeProxy
=
&
kubeproxyconfig
.
KubeProxyConfiguration
{
BindAddress
:
""
,
BindAddress
:
""
,
HealthzBindAddress
:
"0.0.0.0:10256"
,
HealthzBindAddress
:
"0.0.0.0:10256"
,
MetricsBindAddress
:
"127.0.0.1:10249"
,
MetricsBindAddress
:
"127.0.0.1:10249"
,
...
@@ -222,11 +222,11 @@ func TestEnsureProxyAddon(t *testing.T) {
...
@@ -222,11 +222,11 @@ func TestEnsureProxyAddon(t *testing.T) {
},
},
}
}
// Run dynamic defaulting again as we changed the internal cfg
// Run dynamic defaulting again as we changed the internal cfg
if
err
:=
configutil
.
SetInitDynamicDefaults
(
int
Master
);
err
!=
nil
{
if
err
:=
configutil
.
SetInitDynamicDefaults
(
int
ControlPlane
);
err
!=
nil
{
t
.
Errorf
(
"test failed to set dynamic defaults: %v"
,
err
)
t
.
Errorf
(
"test failed to set dynamic defaults: %v"
,
err
)
break
break
}
}
err
=
EnsureProxyAddon
(
&
int
Master
.
ClusterConfiguration
,
&
intMaster
.
LocalAPIEndpoint
,
client
)
err
=
EnsureProxyAddon
(
&
int
ControlPlane
.
ClusterConfiguration
,
&
intControlPlane
.
LocalAPIEndpoint
,
client
)
// Compare actual to expected errors
// Compare actual to expected errors
actErr
:=
"No error"
actErr
:=
"No error"
...
@@ -244,17 +244,17 @@ func TestEnsureProxyAddon(t *testing.T) {
...
@@ -244,17 +244,17 @@ func TestEnsureProxyAddon(t *testing.T) {
expErr
,
expErr
,
actErr
)
actErr
)
}
}
if
int
Master
.
ComponentConfigs
.
KubeProxy
.
BindAddress
!=
tc
.
expBindAddr
{
if
int
ControlPlane
.
ComponentConfigs
.
KubeProxy
.
BindAddress
!=
tc
.
expBindAddr
{
t
.
Errorf
(
"%s test failed, expected: %s, got: %s"
,
t
.
Errorf
(
"%s test failed, expected: %s, got: %s"
,
tc
.
name
,
tc
.
name
,
tc
.
expBindAddr
,
tc
.
expBindAddr
,
int
Master
.
ComponentConfigs
.
KubeProxy
.
BindAddress
)
int
ControlPlane
.
ComponentConfigs
.
KubeProxy
.
BindAddress
)
}
}
if
int
Master
.
ComponentConfigs
.
KubeProxy
.
ClusterCIDR
!=
tc
.
expClusterCIDR
{
if
int
ControlPlane
.
ComponentConfigs
.
KubeProxy
.
ClusterCIDR
!=
tc
.
expClusterCIDR
{
t
.
Errorf
(
"%s test failed, expected: %s, got: %s"
,
t
.
Errorf
(
"%s test failed, expected: %s, got: %s"
,
tc
.
name
,
tc
.
name
,
tc
.
expClusterCIDR
,
tc
.
expClusterCIDR
,
int
Master
.
ComponentConfigs
.
KubeProxy
.
ClusterCIDR
)
int
ControlPlane
.
ComponentConfigs
.
KubeProxy
.
ClusterCIDR
)
}
}
}
}
}
}
...
...
cmd/kubeadm/app/phases/kubeconfig/kubeconfig.go
View file @
e11916da
...
@@ -136,7 +136,7 @@ func getKubeConfigSpecs(cfg *kubeadmapi.InitConfiguration) (map[string]*kubeConf
...
@@ -136,7 +136,7 @@ func getKubeConfigSpecs(cfg *kubeadmapi.InitConfiguration) (map[string]*kubeConf
return
nil
,
errors
.
Wrap
(
err
,
"couldn't create a kubeconfig; the CA files couldn't be loaded"
)
return
nil
,
errors
.
Wrap
(
err
,
"couldn't create a kubeconfig; the CA files couldn't be loaded"
)
}
}
master
Endpoint
,
err
:=
kubeadmutil
.
GetControlPlaneEndpoint
(
cfg
.
ControlPlaneEndpoint
,
&
cfg
.
LocalAPIEndpoint
)
controlPlane
Endpoint
,
err
:=
kubeadmutil
.
GetControlPlaneEndpoint
(
cfg
.
ControlPlaneEndpoint
,
&
cfg
.
LocalAPIEndpoint
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
@@ -144,7 +144,7 @@ func getKubeConfigSpecs(cfg *kubeadmapi.InitConfiguration) (map[string]*kubeConf
...
@@ -144,7 +144,7 @@ func getKubeConfigSpecs(cfg *kubeadmapi.InitConfiguration) (map[string]*kubeConf
var
kubeConfigSpec
=
map
[
string
]
*
kubeConfigSpec
{
var
kubeConfigSpec
=
map
[
string
]
*
kubeConfigSpec
{
kubeadmconstants
.
AdminKubeConfigFileName
:
{
kubeadmconstants
.
AdminKubeConfigFileName
:
{
CACert
:
caCert
,
CACert
:
caCert
,
APIServer
:
master
Endpoint
,
APIServer
:
controlPlane
Endpoint
,
ClientName
:
"kubernetes-admin"
,
ClientName
:
"kubernetes-admin"
,
ClientCertAuth
:
&
clientCertAuth
{
ClientCertAuth
:
&
clientCertAuth
{
CAKey
:
caKey
,
CAKey
:
caKey
,
...
@@ -153,7 +153,7 @@ func getKubeConfigSpecs(cfg *kubeadmapi.InitConfiguration) (map[string]*kubeConf
...
@@ -153,7 +153,7 @@ func getKubeConfigSpecs(cfg *kubeadmapi.InitConfiguration) (map[string]*kubeConf
},
},
kubeadmconstants
.
KubeletKubeConfigFileName
:
{
kubeadmconstants
.
KubeletKubeConfigFileName
:
{
CACert
:
caCert
,
CACert
:
caCert
,
APIServer
:
master
Endpoint
,
APIServer
:
controlPlane
Endpoint
,
ClientName
:
fmt
.
Sprintf
(
"%s%s"
,
kubeadmconstants
.
NodesUserPrefix
,
cfg
.
NodeRegistration
.
Name
),
ClientName
:
fmt
.
Sprintf
(
"%s%s"
,
kubeadmconstants
.
NodesUserPrefix
,
cfg
.
NodeRegistration
.
Name
),
ClientCertAuth
:
&
clientCertAuth
{
ClientCertAuth
:
&
clientCertAuth
{
CAKey
:
caKey
,
CAKey
:
caKey
,
...
@@ -162,7 +162,7 @@ func getKubeConfigSpecs(cfg *kubeadmapi.InitConfiguration) (map[string]*kubeConf
...
@@ -162,7 +162,7 @@ func getKubeConfigSpecs(cfg *kubeadmapi.InitConfiguration) (map[string]*kubeConf
},
},
kubeadmconstants
.
ControllerManagerKubeConfigFileName
:
{
kubeadmconstants
.
ControllerManagerKubeConfigFileName
:
{
CACert
:
caCert
,
CACert
:
caCert
,
APIServer
:
master
Endpoint
,
APIServer
:
controlPlane
Endpoint
,
ClientName
:
kubeadmconstants
.
ControllerManagerUser
,
ClientName
:
kubeadmconstants
.
ControllerManagerUser
,
ClientCertAuth
:
&
clientCertAuth
{
ClientCertAuth
:
&
clientCertAuth
{
CAKey
:
caKey
,
CAKey
:
caKey
,
...
@@ -170,7 +170,7 @@ func getKubeConfigSpecs(cfg *kubeadmapi.InitConfiguration) (map[string]*kubeConf
...
@@ -170,7 +170,7 @@ func getKubeConfigSpecs(cfg *kubeadmapi.InitConfiguration) (map[string]*kubeConf
},
},
kubeadmconstants
.
SchedulerKubeConfigFileName
:
{
kubeadmconstants
.
SchedulerKubeConfigFileName
:
{
CACert
:
caCert
,
CACert
:
caCert
,
APIServer
:
master
Endpoint
,
APIServer
:
controlPlane
Endpoint
,
ClientName
:
kubeadmconstants
.
SchedulerUser
,
ClientName
:
kubeadmconstants
.
SchedulerUser
,
ClientCertAuth
:
&
clientCertAuth
{
ClientCertAuth
:
&
clientCertAuth
{
CAKey
:
caKey
,
CAKey
:
caKey
,
...
@@ -290,14 +290,14 @@ func WriteKubeConfigWithClientCert(out io.Writer, cfg *kubeadmapi.InitConfigurat
...
@@ -290,14 +290,14 @@ func WriteKubeConfigWithClientCert(out io.Writer, cfg *kubeadmapi.InitConfigurat
return
errors
.
Wrap
(
err
,
"couldn't create a kubeconfig; the CA files couldn't be loaded"
)
return
errors
.
Wrap
(
err
,
"couldn't create a kubeconfig; the CA files couldn't be loaded"
)
}
}
master
Endpoint
,
err
:=
kubeadmutil
.
GetControlPlaneEndpoint
(
cfg
.
ControlPlaneEndpoint
,
&
cfg
.
LocalAPIEndpoint
)
controlPlane
Endpoint
,
err
:=
kubeadmutil
.
GetControlPlaneEndpoint
(
cfg
.
ControlPlaneEndpoint
,
&
cfg
.
LocalAPIEndpoint
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
spec
:=
&
kubeConfigSpec
{
spec
:=
&
kubeConfigSpec
{
ClientName
:
clientName
,
ClientName
:
clientName
,
APIServer
:
master
Endpoint
,
APIServer
:
controlPlane
Endpoint
,
CACert
:
caCert
,
CACert
:
caCert
,
ClientCertAuth
:
&
clientCertAuth
{
ClientCertAuth
:
&
clientCertAuth
{
CAKey
:
caKey
,
CAKey
:
caKey
,
...
@@ -317,14 +317,14 @@ func WriteKubeConfigWithToken(out io.Writer, cfg *kubeadmapi.InitConfiguration,
...
@@ -317,14 +317,14 @@ func WriteKubeConfigWithToken(out io.Writer, cfg *kubeadmapi.InitConfiguration,
return
errors
.
Wrap
(
err
,
"couldn't create a kubeconfig; the CA files couldn't be loaded"
)
return
errors
.
Wrap
(
err
,
"couldn't create a kubeconfig; the CA files couldn't be loaded"
)
}
}
master
Endpoint
,
err
:=
kubeadmutil
.
GetControlPlaneEndpoint
(
cfg
.
ControlPlaneEndpoint
,
&
cfg
.
LocalAPIEndpoint
)
controlPlane
Endpoint
,
err
:=
kubeadmutil
.
GetControlPlaneEndpoint
(
cfg
.
ControlPlaneEndpoint
,
&
cfg
.
LocalAPIEndpoint
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
spec
:=
&
kubeConfigSpec
{
spec
:=
&
kubeConfigSpec
{
ClientName
:
clientName
,
ClientName
:
clientName
,
APIServer
:
master
Endpoint
,
APIServer
:
controlPlane
Endpoint
,
CACert
:
caCert
,
CACert
:
caCert
,
TokenAuth
:
&
tokenAuth
{
TokenAuth
:
&
tokenAuth
{
Token
:
token
,
Token
:
token
,
...
...
cmd/kubeadm/app/phases/kubeconfig/kubeconfig_test.go
View file @
e11916da
...
@@ -162,11 +162,11 @@ func TestGetKubeConfigSpecs(t *testing.T) {
...
@@ -162,11 +162,11 @@ func TestGetKubeConfigSpecs(t *testing.T) {
}
}
// Asserts InitConfiguration values injected into spec
// Asserts InitConfiguration values injected into spec
master
Endpoint
,
err
:=
kubeadmutil
.
GetControlPlaneEndpoint
(
cfg
.
ControlPlaneEndpoint
,
&
cfg
.
LocalAPIEndpoint
)
controlPlane
Endpoint
,
err
:=
kubeadmutil
.
GetControlPlaneEndpoint
(
cfg
.
ControlPlaneEndpoint
,
&
cfg
.
LocalAPIEndpoint
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Error
(
err
)
t
.
Error
(
err
)
}
}
if
spec
.
APIServer
!=
master
Endpoint
{
if
spec
.
APIServer
!=
controlPlane
Endpoint
{
t
.
Errorf
(
"getKubeConfigSpecs didn't injected cfg.APIServer endpoint into spec for %s"
,
assertion
.
kubeConfigFile
)
t
.
Errorf
(
"getKubeConfigSpecs didn't injected cfg.APIServer endpoint into spec for %s"
,
assertion
.
kubeConfigFile
)
}
}
...
...
cmd/kubeadm/app/phases/markcontrolplane/markcontrolplane.go
View file @
e11916da
...
@@ -39,7 +39,7 @@ func MarkControlPlane(client clientset.Interface, controlPlaneName string, taint
...
@@ -39,7 +39,7 @@ func MarkControlPlane(client clientset.Interface, controlPlaneName string, taint
}
}
return
apiclient
.
PatchNode
(
client
,
controlPlaneName
,
func
(
n
*
v1
.
Node
)
{
return
apiclient
.
PatchNode
(
client
,
controlPlaneName
,
func
(
n
*
v1
.
Node
)
{
mark
Master
Node
(
n
,
taints
)
mark
ControlPlane
Node
(
n
,
taints
)
})
})
}
}
...
@@ -53,7 +53,7 @@ func taintExists(taint v1.Taint, taints []v1.Taint) bool {
...
@@ -53,7 +53,7 @@ func taintExists(taint v1.Taint, taints []v1.Taint) bool {
return
false
return
false
}
}
func
mark
Master
Node
(
n
*
v1
.
Node
,
taints
[]
v1
.
Taint
)
{
func
mark
ControlPlane
Node
(
n
*
v1
.
Node
,
taints
[]
v1
.
Taint
)
{
n
.
ObjectMeta
.
Labels
[
constants
.
LabelNodeRoleMaster
]
=
""
n
.
ObjectMeta
.
Labels
[
constants
.
LabelNodeRoleMaster
]
=
""
for
_
,
nt
:=
range
n
.
Spec
.
Taints
{
for
_
,
nt
:=
range
n
.
Spec
.
Taints
{
...
...
cmd/kubeadm/app/phases/selfhosting/podspec_mutation.go
View file @
e11916da
...
@@ -40,18 +40,18 @@ func GetDefaultMutators() map[string][]PodSpecMutatorFunc {
...
@@ -40,18 +40,18 @@ func GetDefaultMutators() map[string][]PodSpecMutatorFunc {
return
map
[
string
][]
PodSpecMutatorFunc
{
return
map
[
string
][]
PodSpecMutatorFunc
{
kubeadmconstants
.
KubeAPIServer
:
{
kubeadmconstants
.
KubeAPIServer
:
{
addNodeSelectorToPodSpec
,
addNodeSelectorToPodSpec
,
set
Master
TolerationOnPodSpec
,
set
ControlPlane
TolerationOnPodSpec
,
setRightDNSPolicyOnPodSpec
,
setRightDNSPolicyOnPodSpec
,
setHostIPOnPodSpec
,
setHostIPOnPodSpec
,
},
},
kubeadmconstants
.
KubeControllerManager
:
{
kubeadmconstants
.
KubeControllerManager
:
{
addNodeSelectorToPodSpec
,
addNodeSelectorToPodSpec
,
set
Master
TolerationOnPodSpec
,
set
ControlPlane
TolerationOnPodSpec
,
setRightDNSPolicyOnPodSpec
,
setRightDNSPolicyOnPodSpec
,
},
},
kubeadmconstants
.
KubeScheduler
:
{
kubeadmconstants
.
KubeScheduler
:
{
addNodeSelectorToPodSpec
,
addNodeSelectorToPodSpec
,
set
Master
TolerationOnPodSpec
,
set
ControlPlane
TolerationOnPodSpec
,
setRightDNSPolicyOnPodSpec
,
setRightDNSPolicyOnPodSpec
,
},
},
}
}
...
@@ -82,7 +82,7 @@ func mutatePodSpec(mutators map[string][]PodSpecMutatorFunc, name string, podSpe
...
@@ -82,7 +82,7 @@ func mutatePodSpec(mutators map[string][]PodSpecMutatorFunc, name string, podSpe
}
}
}
}
// addNodeSelectorToPodSpec makes Pod require to be scheduled on a node marked with the
master
label
// addNodeSelectorToPodSpec makes Pod require to be scheduled on a node marked with the
control-plane
label
func
addNodeSelectorToPodSpec
(
podSpec
*
v1
.
PodSpec
)
{
func
addNodeSelectorToPodSpec
(
podSpec
*
v1
.
PodSpec
)
{
if
podSpec
.
NodeSelector
==
nil
{
if
podSpec
.
NodeSelector
==
nil
{
podSpec
.
NodeSelector
=
map
[
string
]
string
{
kubeadmconstants
.
LabelNodeRoleMaster
:
""
}
podSpec
.
NodeSelector
=
map
[
string
]
string
{
kubeadmconstants
.
LabelNodeRoleMaster
:
""
}
...
@@ -92,8 +92,8 @@ func addNodeSelectorToPodSpec(podSpec *v1.PodSpec) {
...
@@ -92,8 +92,8 @@ func addNodeSelectorToPodSpec(podSpec *v1.PodSpec) {
podSpec
.
NodeSelector
[
kubeadmconstants
.
LabelNodeRoleMaster
]
=
""
podSpec
.
NodeSelector
[
kubeadmconstants
.
LabelNodeRoleMaster
]
=
""
}
}
// set
MasterTolerationOnPodSpec makes the Pod tolerate the master
taint
// set
ControlPlaneTolerationOnPodSpec makes the Pod tolerate the control-plane
taint
func
set
Master
TolerationOnPodSpec
(
podSpec
*
v1
.
PodSpec
)
{
func
set
ControlPlane
TolerationOnPodSpec
(
podSpec
*
v1
.
PodSpec
)
{
if
podSpec
.
Tolerations
==
nil
{
if
podSpec
.
Tolerations
==
nil
{
podSpec
.
Tolerations
=
[]
v1
.
Toleration
{
kubeadmconstants
.
ControlPlaneToleration
}
podSpec
.
Tolerations
=
[]
v1
.
Toleration
{
kubeadmconstants
.
ControlPlaneToleration
}
return
return
...
...
cmd/kubeadm/app/phases/selfhosting/podspec_mutation_test.go
View file @
e11916da
...
@@ -157,7 +157,7 @@ func TestAddNodeSelectorToPodSpec(t *testing.T) {
...
@@ -157,7 +157,7 @@ func TestAddNodeSelectorToPodSpec(t *testing.T) {
}
}
}
}
func
TestSet
Master
TolerationOnPodSpec
(
t
*
testing
.
T
)
{
func
TestSet
ControlPlane
TolerationOnPodSpec
(
t
*
testing
.
T
)
{
var
tests
=
[]
struct
{
var
tests
=
[]
struct
{
name
string
name
string
podSpec
*
v1
.
PodSpec
podSpec
*
v1
.
PodSpec
...
@@ -190,10 +190,10 @@ func TestSetMasterTolerationOnPodSpec(t *testing.T) {
...
@@ -190,10 +190,10 @@ func TestSetMasterTolerationOnPodSpec(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
)
{
set
Master
TolerationOnPodSpec
(
rt
.
podSpec
)
set
ControlPlane
TolerationOnPodSpec
(
rt
.
podSpec
)
if
!
reflect
.
DeepEqual
(
*
rt
.
podSpec
,
rt
.
expected
)
{
if
!
reflect
.
DeepEqual
(
*
rt
.
podSpec
,
rt
.
expected
)
{
t
.
Errorf
(
"failed set
Master
TolerationOnPodSpec:
\n
expected:
\n
%v
\n
saw:
\n
%v"
,
rt
.
expected
,
*
rt
.
podSpec
)
t
.
Errorf
(
"failed set
ControlPlane
TolerationOnPodSpec:
\n
expected:
\n
%v
\n
saw:
\n
%v"
,
rt
.
expected
,
*
rt
.
podSpec
)
}
}
})
})
}
}
...
...
cmd/kubeadm/app/phases/upgrade/health.go
View file @
e11916da
...
@@ -56,7 +56,7 @@ func (c *healthCheck) Name() string {
...
@@ -56,7 +56,7 @@ func (c *healthCheck) Name() string {
// CheckClusterHealth makes sure:
// CheckClusterHealth makes sure:
// - the API /healthz endpoint is healthy
// - the API /healthz endpoint is healthy
// - all
master
Nodes are Ready
// - all
control-plane
Nodes are Ready
// - (if self-hosted) that there are DaemonSets with at least one Pod for all control plane components
// - (if self-hosted) that there are DaemonSets with at least one Pod for all control plane components
// - (if static pod-hosted) that all required Static Pod manifests exist on disk
// - (if static pod-hosted) that all required Static Pod manifests exist on disk
func
CheckClusterHealth
(
client
clientset
.
Interface
,
ignoreChecksErrors
sets
.
String
)
error
{
func
CheckClusterHealth
(
client
clientset
.
Interface
,
ignoreChecksErrors
sets
.
String
)
error
{
...
@@ -69,9 +69,9 @@ func CheckClusterHealth(client clientset.Interface, ignoreChecksErrors sets.Stri
...
@@ -69,9 +69,9 @@ func CheckClusterHealth(client clientset.Interface, ignoreChecksErrors sets.Stri
f
:
apiServerHealthy
,
f
:
apiServerHealthy
,
},
},
&
healthCheck
{
&
healthCheck
{
name
:
"
Master
NodesReady"
,
name
:
"
ControlPlane
NodesReady"
,
client
:
client
,
client
:
client
,
f
:
master
NodesReady
,
f
:
controlPlane
NodesReady
,
},
},
// TODO: Add a check for ComponentStatuses here?
// TODO: Add a check for ComponentStatuses here?
}
}
...
@@ -100,25 +100,25 @@ func apiServerHealthy(client clientset.Interface) error {
...
@@ -100,25 +100,25 @@ func apiServerHealthy(client clientset.Interface) error {
return
nil
return
nil
}
}
//
masterNodesReady checks whether all master
Nodes in the cluster are in the Running state
//
controlPlaneNodesReady checks whether all control-plane
Nodes in the cluster are in the Running state
func
master
NodesReady
(
client
clientset
.
Interface
)
error
{
func
controlPlane
NodesReady
(
client
clientset
.
Interface
)
error
{
selector
:=
labels
.
SelectorFromSet
(
labels
.
Set
(
map
[
string
]
string
{
selector
:=
labels
.
SelectorFromSet
(
labels
.
Set
(
map
[
string
]
string
{
constants
.
LabelNodeRoleMaster
:
""
,
constants
.
LabelNodeRoleMaster
:
""
,
}))
}))
master
s
,
err
:=
client
.
CoreV1
()
.
Nodes
()
.
List
(
metav1
.
ListOptions
{
controlPlane
s
,
err
:=
client
.
CoreV1
()
.
Nodes
()
.
List
(
metav1
.
ListOptions
{
LabelSelector
:
selector
.
String
(),
LabelSelector
:
selector
.
String
(),
})
})
if
err
!=
nil
{
if
err
!=
nil
{
return
errors
.
Wrap
(
err
,
"couldn't list control-planes in cluster"
)
return
errors
.
Wrap
(
err
,
"couldn't list control-planes in cluster"
)
}
}
if
len
(
master
s
.
Items
)
==
0
{
if
len
(
controlPlane
s
.
Items
)
==
0
{
return
errors
.
New
(
"failed to find any nodes with a control-plane role"
)
return
errors
.
New
(
"failed to find any nodes with a control-plane role"
)
}
}
notReady
Masters
:=
getNotReadyNodes
(
master
s
.
Items
)
notReady
ControlPlanes
:=
getNotReadyNodes
(
controlPlane
s
.
Items
)
if
len
(
notReady
Master
s
)
!=
0
{
if
len
(
notReady
ControlPlane
s
)
!=
0
{
return
errors
.
Errorf
(
"there are NotReady control-planes in the cluster: %v"
,
notReady
Master
s
)
return
errors
.
Errorf
(
"there are NotReady control-planes in the cluster: %v"
,
notReady
ControlPlane
s
)
}
}
return
nil
return
nil
}
}
...
...
cmd/kubeadm/app/phases/upgrade/postupgrade.go
View file @
e11916da
...
@@ -49,7 +49,7 @@ import (
...
@@ -49,7 +49,7 @@ import (
var
expiry
=
180
*
24
*
time
.
Hour
var
expiry
=
180
*
24
*
time
.
Hour
// PerformPostUpgradeTasks runs nearly the same functions as 'kubeadm init' would do
// PerformPostUpgradeTasks runs nearly the same functions as 'kubeadm init' would do
// Note that the mark
master
phase is left out, not needed, and no token is created as that doesn't belong to the upgrade
// Note that the mark
-control-plane
phase is left out, not needed, and no token is created as that doesn't belong to the upgrade
func
PerformPostUpgradeTasks
(
client
clientset
.
Interface
,
cfg
*
kubeadmapi
.
InitConfiguration
,
newK8sVer
*
version
.
Version
,
dryRun
bool
)
error
{
func
PerformPostUpgradeTasks
(
client
clientset
.
Interface
,
cfg
*
kubeadmapi
.
InitConfiguration
,
newK8sVer
*
version
.
Version
,
dryRun
bool
)
error
{
errs
:=
[]
error
{}
errs
:=
[]
error
{}
...
@@ -207,9 +207,9 @@ func writeKubeletConfigFiles(client clientset.Interface, cfg *kubeadmapi.InitCon
...
@@ -207,9 +207,9 @@ func writeKubeletConfigFiles(client clientset.Interface, cfg *kubeadmapi.InitCon
envFilePath
:=
filepath
.
Join
(
kubeadmconstants
.
KubeletRunDirectory
,
kubeadmconstants
.
KubeletEnvFileName
)
envFilePath
:=
filepath
.
Join
(
kubeadmconstants
.
KubeletRunDirectory
,
kubeadmconstants
.
KubeletEnvFileName
)
if
_
,
err
:=
os
.
Stat
(
envFilePath
);
os
.
IsNotExist
(
err
)
{
if
_
,
err
:=
os
.
Stat
(
envFilePath
);
os
.
IsNotExist
(
err
)
{
// Write env file with flags for the kubelet to use. We do not need to write the --register-with-taints for the
master
,
// Write env file with flags for the kubelet to use. We do not need to write the --register-with-taints for the
control-plane
,
// as we handle that ourselves in the mark
master
phase
// as we handle that ourselves in the mark
-control-plane
phase
// TODO: Maybe we want to do that some time in the future, in order to remove some logic from the mark
master
phase?
// TODO: Maybe we want to do that some time in the future, in order to remove some logic from the mark
-control-plane
phase?
if
err
:=
kubeletphase
.
WriteKubeletDynamicEnvFile
(
&
cfg
.
ClusterConfiguration
,
&
cfg
.
NodeRegistration
,
false
,
kubeletDir
);
err
!=
nil
{
if
err
:=
kubeletphase
.
WriteKubeletDynamicEnvFile
(
&
cfg
.
ClusterConfiguration
,
&
cfg
.
NodeRegistration
,
false
,
kubeletDir
);
err
!=
nil
{
errs
=
append
(
errs
,
errors
.
Wrap
(
err
,
"error writing a dynamic environment file for the kubelet"
))
errs
=
append
(
errs
,
errors
.
Wrap
(
err
,
"error writing a dynamic environment file for the kubelet"
))
}
}
...
...
cmd/kubeadm/app/phases/upgrade/prepull.go
View file @
e11916da
...
@@ -42,7 +42,7 @@ type Prepuller interface {
...
@@ -42,7 +42,7 @@ type Prepuller interface {
DeleteFunc
(
string
)
error
DeleteFunc
(
string
)
error
}
}
// DaemonSetPrepuller makes sure the control-plane images are available on all
master
s
// DaemonSetPrepuller makes sure the control-plane images are available on all
control-plane
s
type
DaemonSetPrepuller
struct
{
type
DaemonSetPrepuller
struct
{
client
clientset
.
Interface
client
clientset
.
Interface
cfg
*
kubeadmapi
.
ClusterConfiguration
cfg
*
kubeadmapi
.
ClusterConfiguration
...
...
cmd/kubeadm/app/phases/uploadconfig/uploadconfig_test.go
View file @
e11916da
...
@@ -120,11 +120,11 @@ func TestUploadConfiguration(t *testing.T) {
...
@@ -120,11 +120,11 @@ func TestUploadConfiguration(t *testing.T) {
}
}
}
}
if
tt
.
verifyResult
{
if
tt
.
verifyResult
{
master
Cfg
,
err
:=
client
.
CoreV1
()
.
ConfigMaps
(
metav1
.
NamespaceSystem
)
.
Get
(
kubeadmconstants
.
KubeadmConfigConfigMap
,
metav1
.
GetOptions
{})
controlPlane
Cfg
,
err
:=
client
.
CoreV1
()
.
ConfigMaps
(
metav1
.
NamespaceSystem
)
.
Get
(
kubeadmconstants
.
KubeadmConfigConfigMap
,
metav1
.
GetOptions
{})
if
err
!=
nil
{
if
err
!=
nil
{
t2
.
Fatalf
(
"Fail to query ConfigMap error = %v"
,
err
)
t2
.
Fatalf
(
"Fail to query ConfigMap error = %v"
,
err
)
}
}
configData
:=
master
Cfg
.
Data
[
kubeadmconstants
.
ClusterConfigurationConfigMapKey
]
configData
:=
controlPlane
Cfg
.
Data
[
kubeadmconstants
.
ClusterConfigurationConfigMapKey
]
if
configData
==
""
{
if
configData
==
""
{
t2
.
Fatal
(
"Fail to find ClusterConfigurationConfigMapKey key"
)
t2
.
Fatal
(
"Fail to find ClusterConfigurationConfigMapKey key"
)
}
}
...
@@ -138,7 +138,7 @@ func TestUploadConfiguration(t *testing.T) {
...
@@ -138,7 +138,7 @@ func TestUploadConfiguration(t *testing.T) {
t2
.
Errorf
(
"the initial and decoded ClusterConfiguration didn't match"
)
t2
.
Errorf
(
"the initial and decoded ClusterConfiguration didn't match"
)
}
}
statusData
:=
master
Cfg
.
Data
[
kubeadmconstants
.
ClusterStatusConfigMapKey
]
statusData
:=
controlPlane
Cfg
.
Data
[
kubeadmconstants
.
ClusterStatusConfigMapKey
]
if
statusData
==
""
{
if
statusData
==
""
{
t2
.
Fatal
(
"failed to find ClusterStatusConfigMapKey key"
)
t2
.
Fatal
(
"failed to find ClusterStatusConfigMapKey key"
)
}
}
...
...
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