Skip to content

Commit e11916d

Browse files
committed
kubeadm cleanup: master -> control-plane (cont.4)
1 parent 139a13d commit e11916d

File tree

15 files changed

+110
-110
lines changed

15 files changed

+110
-110
lines changed

cmd/kubeadm/app/phases/addons/dns/dns.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,15 @@ func kubeDNSAddon(cfg *kubeadmapi.ClusterConfiguration, client clientset.Interfa
101101
}
102102

103103
dnsDeploymentBytes, err := kubeadmutil.ParseTemplate(KubeDNSDeployment,
104-
struct{ DeploymentName, KubeDNSImage, DNSMasqImage, SidecarImage, DNSBindAddr, DNSProbeAddr, DNSDomain, MasterTaintKey string }{
105-
DeploymentName: kubeadmconstants.KubeDNSDeploymentName,
106-
KubeDNSImage: images.GetDNSImage(cfg, kubeadmconstants.KubeDNSKubeDNSImageName),
107-
DNSMasqImage: images.GetDNSImage(cfg, kubeadmconstants.KubeDNSDnsMasqNannyImageName),
108-
SidecarImage: images.GetDNSImage(cfg, kubeadmconstants.KubeDNSSidecarImageName),
109-
DNSBindAddr: dnsBindAddr,
110-
DNSProbeAddr: dnsProbeAddr,
111-
DNSDomain: cfg.Networking.DNSDomain,
112-
MasterTaintKey: kubeadmconstants.LabelNodeRoleMaster,
104+
struct{ DeploymentName, KubeDNSImage, DNSMasqImage, SidecarImage, DNSBindAddr, DNSProbeAddr, DNSDomain, ControlPlaneTaintKey string }{
105+
DeploymentName: kubeadmconstants.KubeDNSDeploymentName,
106+
KubeDNSImage: images.GetDNSImage(cfg, kubeadmconstants.KubeDNSKubeDNSImageName),
107+
DNSMasqImage: images.GetDNSImage(cfg, kubeadmconstants.KubeDNSDnsMasqNannyImageName),
108+
SidecarImage: images.GetDNSImage(cfg, kubeadmconstants.KubeDNSSidecarImageName),
109+
DNSBindAddr: dnsBindAddr,
110+
DNSProbeAddr: dnsProbeAddr,
111+
DNSDomain: cfg.Networking.DNSDomain,
112+
ControlPlaneTaintKey: kubeadmconstants.LabelNodeRoleMaster,
113113
})
114114
if err != nil {
115115
return errors.Wrap(err, "error when parsing kube-dns deployment template")
@@ -157,10 +157,10 @@ func createKubeDNSAddon(deploymentBytes, serviceBytes []byte, client clientset.I
157157

158158
func coreDNSAddon(cfg *kubeadmapi.ClusterConfiguration, client clientset.Interface) error {
159159
// Get the YAML manifest
160-
coreDNSDeploymentBytes, err := kubeadmutil.ParseTemplate(CoreDNSDeployment, struct{ DeploymentName, Image, MasterTaintKey string }{
161-
DeploymentName: kubeadmconstants.CoreDNSDeploymentName,
162-
Image: images.GetDNSImage(cfg, kubeadmconstants.CoreDNSImageName),
163-
MasterTaintKey: kubeadmconstants.LabelNodeRoleMaster,
160+
coreDNSDeploymentBytes, err := kubeadmutil.ParseTemplate(CoreDNSDeployment, struct{ DeploymentName, Image, ControlPlaneTaintKey string }{
161+
DeploymentName: kubeadmconstants.CoreDNSDeploymentName,
162+
Image: images.GetDNSImage(cfg, kubeadmconstants.CoreDNSImageName),
163+
ControlPlaneTaintKey: kubeadmconstants.LabelNodeRoleMaster,
164164
})
165165
if err != nil {
166166
return errors.Wrap(err, "error when parsing CoreDNS deployment template")

cmd/kubeadm/app/phases/addons/dns/dns_test.go

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -98,15 +98,15 @@ func TestCompileManifests(t *testing.T) {
9898
}{
9999
{
100100
manifest: KubeDNSDeployment,
101-
data: struct{ DeploymentName, KubeDNSImage, DNSMasqImage, SidecarImage, DNSBindAddr, DNSProbeAddr, DNSDomain, MasterTaintKey string }{
102-
DeploymentName: "foo",
103-
KubeDNSImage: "foo",
104-
DNSMasqImage: "foo",
105-
SidecarImage: "foo",
106-
DNSBindAddr: "foo",
107-
DNSProbeAddr: "foo",
108-
DNSDomain: "foo",
109-
MasterTaintKey: "foo",
101+
data: struct{ DeploymentName, KubeDNSImage, DNSMasqImage, SidecarImage, DNSBindAddr, DNSProbeAddr, DNSDomain, ControlPlaneTaintKey string }{
102+
DeploymentName: "foo",
103+
KubeDNSImage: "foo",
104+
DNSMasqImage: "foo",
105+
SidecarImage: "foo",
106+
DNSBindAddr: "foo",
107+
DNSProbeAddr: "foo",
108+
DNSDomain: "foo",
109+
ControlPlaneTaintKey: "foo",
110110
},
111111
expected: true,
112112
},
@@ -119,10 +119,10 @@ func TestCompileManifests(t *testing.T) {
119119
},
120120
{
121121
manifest: CoreDNSDeployment,
122-
data: struct{ DeploymentName, Image, MasterTaintKey string }{
123-
DeploymentName: "foo",
124-
Image: "foo",
125-
MasterTaintKey: "foo",
122+
data: struct{ DeploymentName, Image, ControlPlaneTaintKey string }{
123+
DeploymentName: "foo",
124+
Image: "foo",
125+
ControlPlaneTaintKey: "foo",
126126
},
127127
expected: true,
128128
},
@@ -436,23 +436,23 @@ func TestDeploymentsHaveSystemClusterCriticalPriorityClassName(t *testing.T) {
436436
}{
437437
{
438438
manifest: KubeDNSDeployment,
439-
data: struct{ DeploymentName, KubeDNSImage, DNSMasqImage, SidecarImage, DNSBindAddr, DNSProbeAddr, DNSDomain, MasterTaintKey string }{
440-
DeploymentName: "foo",
441-
KubeDNSImage: "foo",
442-
DNSMasqImage: "foo",
443-
SidecarImage: "foo",
444-
DNSBindAddr: "foo",
445-
DNSProbeAddr: "foo",
446-
DNSDomain: "foo",
447-
MasterTaintKey: "foo",
439+
data: struct{ DeploymentName, KubeDNSImage, DNSMasqImage, SidecarImage, DNSBindAddr, DNSProbeAddr, DNSDomain, ControlPlaneTaintKey string }{
440+
DeploymentName: "foo",
441+
KubeDNSImage: "foo",
442+
DNSMasqImage: "foo",
443+
SidecarImage: "foo",
444+
DNSBindAddr: "foo",
445+
DNSProbeAddr: "foo",
446+
DNSDomain: "foo",
447+
ControlPlaneTaintKey: "foo",
448448
},
449449
},
450450
{
451451
manifest: CoreDNSDeployment,
452-
data: struct{ DeploymentName, Image, MasterTaintKey string }{
453-
DeploymentName: "foo",
454-
Image: "foo",
455-
MasterTaintKey: "foo",
452+
data: struct{ DeploymentName, Image, ControlPlaneTaintKey string }{
453+
DeploymentName: "foo",
454+
Image: "foo",
455+
ControlPlaneTaintKey: "foo",
456456
},
457457
},
458458
}

cmd/kubeadm/app/phases/addons/dns/manifests.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ spec:
7777
path: /readiness
7878
port: 8081
7979
scheme: HTTP
80-
# we poll on pod startup for the Kubernetes master service and
80+
# we poll on pod startup for the Kubernetes control-plane service and
8181
# only setup the /readiness HTTP server once that's available.
8282
initialDelaySeconds: 3
8383
timeoutSeconds: 5
@@ -173,7 +173,7 @@ spec:
173173
tolerations:
174174
- key: CriticalAddonsOnly
175175
operator: Exists
176-
- key: {{ .MasterTaintKey }}
176+
- key: {{ .ControlPlaneTaintKey }}
177177
effect: NoSchedule
178178
`
179179

@@ -241,7 +241,7 @@ spec:
241241
tolerations:
242242
- key: CriticalAddonsOnly
243243
operator: Exists
244-
- key: {{ .MasterTaintKey }}
244+
- key: {{ .ControlPlaneTaintKey }}
245245
effect: NoSchedule
246246
nodeSelector:
247247
beta.kubernetes.io/os: linux

cmd/kubeadm/app/phases/addons/proxy/manifests.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ data:
3333
clusters:
3434
- cluster:
3535
certificate-authority: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
36-
server: {{ .MasterEndpoint }}
36+
server: {{ .ControlPlaneEndpoint }}
3737
name: default
3838
contexts:
3939
- context:

cmd/kubeadm/app/phases/addons/proxy/proxy.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,15 @@ func EnsureProxyAddon(cfg *kubeadmapi.ClusterConfiguration, localEndpoint *kubea
6767
var proxyConfigMapBytes, proxyDaemonSetBytes []byte
6868
proxyConfigMapBytes, err = kubeadmutil.ParseTemplate(KubeProxyConfigMap19,
6969
struct {
70-
MasterEndpoint string
71-
ProxyConfig string
72-
ProxyConfigMap string
73-
ProxyConfigMapKey string
70+
ControlPlaneEndpoint string
71+
ProxyConfig string
72+
ProxyConfigMap string
73+
ProxyConfigMapKey string
7474
}{
75-
MasterEndpoint: controlPlaneEndpoint,
76-
ProxyConfig: prefixBytes.String(),
77-
ProxyConfigMap: constants.KubeProxyConfigMap,
78-
ProxyConfigMapKey: constants.KubeProxyConfigMapKey,
75+
ControlPlaneEndpoint: controlPlaneEndpoint,
76+
ProxyConfig: prefixBytes.String(),
77+
ProxyConfigMap: constants.KubeProxyConfigMap,
78+
ProxyConfigMapKey: constants.KubeProxyConfigMapKey,
7979
})
8080
if err != nil {
8181
return errors.Wrap(err, "error when parsing kube-proxy configmap template")

cmd/kubeadm/app/phases/addons/proxy/proxy_test.go

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,12 @@ func TestCompileManifests(t *testing.T) {
103103
{
104104
manifest: KubeProxyConfigMap19,
105105
data: struct {
106-
MasterEndpoint, ProxyConfig, ProxyConfigMap, ProxyConfigMapKey string
106+
ControlPlaneEndpoint, ProxyConfig, ProxyConfigMap, ProxyConfigMapKey string
107107
}{
108-
MasterEndpoint: "foo",
109-
ProxyConfig: " bindAddress: 0.0.0.0\n clusterCIDR: 192.168.1.1\n enableProfiling: false",
110-
ProxyConfigMap: "bar",
111-
ProxyConfigMapKey: "baz",
108+
ControlPlaneEndpoint: "foo",
109+
ProxyConfig: " bindAddress: 0.0.0.0\n clusterCIDR: 192.168.1.1\n enableProfiling: false",
110+
ProxyConfigMap: "bar",
111+
ProxyConfigMapKey: "baz",
112112
},
113113
expected: true,
114114
},
@@ -140,7 +140,7 @@ func TestEnsureProxyAddon(t *testing.T) {
140140
const (
141141
NoError SimulatedError = iota
142142
ServiceAccountError
143-
InvalidMasterEndpoint
143+
InvalidControlPlaneEndpoint
144144
IPv6SetBindAddress
145145
)
146146

@@ -177,7 +177,7 @@ func TestEnsureProxyAddon(t *testing.T) {
177177
// Create a fake client and set up default test configuration
178178
client := clientsetfake.NewSimpleClientset()
179179
// TODO: Consider using a YAML file instead for this that makes it possible to specify YAML documents for the ComponentConfigs
180-
masterConfig := &kubeadmapiv1beta1.InitConfiguration{
180+
controlPlaneConfig := &kubeadmapiv1beta1.InitConfiguration{
181181
LocalAPIEndpoint: kubeadmapiv1beta1.APIEndpoint{
182182
AdvertiseAddress: "1.2.3.4",
183183
BindPort: 1234,
@@ -197,19 +197,19 @@ func TestEnsureProxyAddon(t *testing.T) {
197197
client.PrependReactor("create", "serviceaccounts", func(action core.Action) (bool, runtime.Object, error) {
198198
return true, nil, apierrors.NewUnauthorized("")
199199
})
200-
case InvalidMasterEndpoint:
201-
masterConfig.LocalAPIEndpoint.AdvertiseAddress = "1.2.3"
200+
case InvalidControlPlaneEndpoint:
201+
controlPlaneConfig.LocalAPIEndpoint.AdvertiseAddress = "1.2.3"
202202
case IPv6SetBindAddress:
203-
masterConfig.LocalAPIEndpoint.AdvertiseAddress = "1:2::3:4"
204-
masterConfig.Networking.PodSubnet = "2001:101::/96"
203+
controlPlaneConfig.LocalAPIEndpoint.AdvertiseAddress = "1:2::3:4"
204+
controlPlaneConfig.Networking.PodSubnet = "2001:101::/96"
205205
}
206206

207-
intMaster, err := configutil.DefaultedInitConfiguration(masterConfig)
207+
intControlPlane, err := configutil.DefaultedInitConfiguration(controlPlaneConfig)
208208
if err != nil {
209209
t.Errorf("test failed to convert external to internal version")
210210
break
211211
}
212-
intMaster.ComponentConfigs.KubeProxy = &kubeproxyconfig.KubeProxyConfiguration{
212+
intControlPlane.ComponentConfigs.KubeProxy = &kubeproxyconfig.KubeProxyConfiguration{
213213
BindAddress: "",
214214
HealthzBindAddress: "0.0.0.0:10256",
215215
MetricsBindAddress: "127.0.0.1:10249",
@@ -222,11 +222,11 @@ func TestEnsureProxyAddon(t *testing.T) {
222222
},
223223
}
224224
// Run dynamic defaulting again as we changed the internal cfg
225-
if err := configutil.SetInitDynamicDefaults(intMaster); err != nil {
225+
if err := configutil.SetInitDynamicDefaults(intControlPlane); err != nil {
226226
t.Errorf("test failed to set dynamic defaults: %v", err)
227227
break
228228
}
229-
err = EnsureProxyAddon(&intMaster.ClusterConfiguration, &intMaster.LocalAPIEndpoint, client)
229+
err = EnsureProxyAddon(&intControlPlane.ClusterConfiguration, &intControlPlane.LocalAPIEndpoint, client)
230230

231231
// Compare actual to expected errors
232232
actErr := "No error"
@@ -244,17 +244,17 @@ func TestEnsureProxyAddon(t *testing.T) {
244244
expErr,
245245
actErr)
246246
}
247-
if intMaster.ComponentConfigs.KubeProxy.BindAddress != tc.expBindAddr {
247+
if intControlPlane.ComponentConfigs.KubeProxy.BindAddress != tc.expBindAddr {
248248
t.Errorf("%s test failed, expected: %s, got: %s",
249249
tc.name,
250250
tc.expBindAddr,
251-
intMaster.ComponentConfigs.KubeProxy.BindAddress)
251+
intControlPlane.ComponentConfigs.KubeProxy.BindAddress)
252252
}
253-
if intMaster.ComponentConfigs.KubeProxy.ClusterCIDR != tc.expClusterCIDR {
253+
if intControlPlane.ComponentConfigs.KubeProxy.ClusterCIDR != tc.expClusterCIDR {
254254
t.Errorf("%s test failed, expected: %s, got: %s",
255255
tc.name,
256256
tc.expClusterCIDR,
257-
intMaster.ComponentConfigs.KubeProxy.ClusterCIDR)
257+
intControlPlane.ComponentConfigs.KubeProxy.ClusterCIDR)
258258
}
259259
}
260260
}

cmd/kubeadm/app/phases/kubeconfig/kubeconfig.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -136,15 +136,15 @@ func getKubeConfigSpecs(cfg *kubeadmapi.InitConfiguration) (map[string]*kubeConf
136136
return nil, errors.Wrap(err, "couldn't create a kubeconfig; the CA files couldn't be loaded")
137137
}
138138

139-
masterEndpoint, err := kubeadmutil.GetControlPlaneEndpoint(cfg.ControlPlaneEndpoint, &cfg.LocalAPIEndpoint)
139+
controlPlaneEndpoint, err := kubeadmutil.GetControlPlaneEndpoint(cfg.ControlPlaneEndpoint, &cfg.LocalAPIEndpoint)
140140
if err != nil {
141141
return nil, err
142142
}
143143

144144
var kubeConfigSpec = map[string]*kubeConfigSpec{
145145
kubeadmconstants.AdminKubeConfigFileName: {
146146
CACert: caCert,
147-
APIServer: masterEndpoint,
147+
APIServer: controlPlaneEndpoint,
148148
ClientName: "kubernetes-admin",
149149
ClientCertAuth: &clientCertAuth{
150150
CAKey: caKey,
@@ -153,7 +153,7 @@ func getKubeConfigSpecs(cfg *kubeadmapi.InitConfiguration) (map[string]*kubeConf
153153
},
154154
kubeadmconstants.KubeletKubeConfigFileName: {
155155
CACert: caCert,
156-
APIServer: masterEndpoint,
156+
APIServer: controlPlaneEndpoint,
157157
ClientName: fmt.Sprintf("%s%s", kubeadmconstants.NodesUserPrefix, cfg.NodeRegistration.Name),
158158
ClientCertAuth: &clientCertAuth{
159159
CAKey: caKey,
@@ -162,15 +162,15 @@ func getKubeConfigSpecs(cfg *kubeadmapi.InitConfiguration) (map[string]*kubeConf
162162
},
163163
kubeadmconstants.ControllerManagerKubeConfigFileName: {
164164
CACert: caCert,
165-
APIServer: masterEndpoint,
165+
APIServer: controlPlaneEndpoint,
166166
ClientName: kubeadmconstants.ControllerManagerUser,
167167
ClientCertAuth: &clientCertAuth{
168168
CAKey: caKey,
169169
},
170170
},
171171
kubeadmconstants.SchedulerKubeConfigFileName: {
172172
CACert: caCert,
173-
APIServer: masterEndpoint,
173+
APIServer: controlPlaneEndpoint,
174174
ClientName: kubeadmconstants.SchedulerUser,
175175
ClientCertAuth: &clientCertAuth{
176176
CAKey: caKey,
@@ -290,14 +290,14 @@ func WriteKubeConfigWithClientCert(out io.Writer, cfg *kubeadmapi.InitConfigurat
290290
return errors.Wrap(err, "couldn't create a kubeconfig; the CA files couldn't be loaded")
291291
}
292292

293-
masterEndpoint, err := kubeadmutil.GetControlPlaneEndpoint(cfg.ControlPlaneEndpoint, &cfg.LocalAPIEndpoint)
293+
controlPlaneEndpoint, err := kubeadmutil.GetControlPlaneEndpoint(cfg.ControlPlaneEndpoint, &cfg.LocalAPIEndpoint)
294294
if err != nil {
295295
return err
296296
}
297297

298298
spec := &kubeConfigSpec{
299299
ClientName: clientName,
300-
APIServer: masterEndpoint,
300+
APIServer: controlPlaneEndpoint,
301301
CACert: caCert,
302302
ClientCertAuth: &clientCertAuth{
303303
CAKey: caKey,
@@ -317,14 +317,14 @@ func WriteKubeConfigWithToken(out io.Writer, cfg *kubeadmapi.InitConfiguration,
317317
return errors.Wrap(err, "couldn't create a kubeconfig; the CA files couldn't be loaded")
318318
}
319319

320-
masterEndpoint, err := kubeadmutil.GetControlPlaneEndpoint(cfg.ControlPlaneEndpoint, &cfg.LocalAPIEndpoint)
320+
controlPlaneEndpoint, err := kubeadmutil.GetControlPlaneEndpoint(cfg.ControlPlaneEndpoint, &cfg.LocalAPIEndpoint)
321321
if err != nil {
322322
return err
323323
}
324324

325325
spec := &kubeConfigSpec{
326326
ClientName: clientName,
327-
APIServer: masterEndpoint,
327+
APIServer: controlPlaneEndpoint,
328328
CACert: caCert,
329329
TokenAuth: &tokenAuth{
330330
Token: token,

cmd/kubeadm/app/phases/kubeconfig/kubeconfig_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,11 +162,11 @@ func TestGetKubeConfigSpecs(t *testing.T) {
162162
}
163163

164164
// Asserts InitConfiguration values injected into spec
165-
masterEndpoint, err := kubeadmutil.GetControlPlaneEndpoint(cfg.ControlPlaneEndpoint, &cfg.LocalAPIEndpoint)
165+
controlPlaneEndpoint, err := kubeadmutil.GetControlPlaneEndpoint(cfg.ControlPlaneEndpoint, &cfg.LocalAPIEndpoint)
166166
if err != nil {
167167
t.Error(err)
168168
}
169-
if spec.APIServer != masterEndpoint {
169+
if spec.APIServer != controlPlaneEndpoint {
170170
t.Errorf("getKubeConfigSpecs didn't injected cfg.APIServer endpoint into spec for %s", assertion.kubeConfigFile)
171171
}
172172

cmd/kubeadm/app/phases/markcontrolplane/markcontrolplane.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func MarkControlPlane(client clientset.Interface, controlPlaneName string, taint
3939
}
4040

4141
return apiclient.PatchNode(client, controlPlaneName, func(n *v1.Node) {
42-
markMasterNode(n, taints)
42+
markControlPlaneNode(n, taints)
4343
})
4444
}
4545

@@ -53,7 +53,7 @@ func taintExists(taint v1.Taint, taints []v1.Taint) bool {
5353
return false
5454
}
5555

56-
func markMasterNode(n *v1.Node, taints []v1.Taint) {
56+
func markControlPlaneNode(n *v1.Node, taints []v1.Taint) {
5757
n.ObjectMeta.Labels[constants.LabelNodeRoleMaster] = ""
5858

5959
for _, nt := range n.Spec.Taints {

0 commit comments

Comments
 (0)