Skip to content

Commit 465f7eb

Browse files
authored
Merge pull request kubernetes#74557 from vanduc95/cleanup-kubeadm-cont.5-20190225
kubeadm cleanup: master -> control-plane (cont.5)
2 parents 0d98463 + 0296cfb commit 465f7eb

File tree

13 files changed

+36
-36
lines changed

13 files changed

+36
-36
lines changed

cmd/kubeadm/app/cmd/util/join.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import (
3030
)
3131

3232
var joinCommandTemplate = template.Must(template.New("join").Parse(`` +
33-
`kubeadm join {{.MasterHostPort}} --token {{.Token}}{{range $h := .CAPubKeyPins}} --discovery-token-ca-cert-hash {{$h}}{{end}}{{if .UploadCerts}} --certificate-key {{.CertificateKey}}{{end}}`,
33+
`kubeadm join {{.ControlPlaneHostPort}} --token {{.Token}}{{range $h := .CAPubKeyPins}} --discovery-token-ca-cert-hash {{$h}}{{end}}{{if .UploadCerts}} --certificate-key {{.CertificateKey}}{{end}}`,
3434
))
3535

3636
// GetJoinCommand returns the kubeadm join command for a given token and
@@ -71,11 +71,11 @@ func GetJoinCommand(kubeConfigFile, token, key string, skipTokenPrint, uploadCer
7171
}
7272

7373
ctx := map[string]interface{}{
74-
"Token": token,
75-
"CAPubKeyPins": publicKeyPins,
76-
"MasterHostPort": strings.Replace(clusterConfig.Server, "https://", "", -1),
77-
"UploadCerts": uploadCerts,
78-
"CertificateKey": key,
74+
"Token": token,
75+
"CAPubKeyPins": publicKeyPins,
76+
"ControlPlaneHostPort": strings.Replace(clusterConfig.Server, "https://", "", -1),
77+
"UploadCerts": uploadCerts,
78+
"CertificateKey": key,
7979
}
8080

8181
if skipTokenPrint {

cmd/kubeadm/app/discovery/token/token.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,16 +172,16 @@ func RetrieveValidatedConfigInfo(cfg *kubeadmapi.JoinConfiguration) (*clientcmda
172172

173173
// buildInsecureBootstrapKubeConfig makes a kubeconfig object that connects insecurely to the API Server for bootstrapping purposes
174174
func buildInsecureBootstrapKubeConfig(endpoint, clustername string) *clientcmdapi.Config {
175-
masterEndpoint := fmt.Sprintf("https://%s", endpoint)
176-
bootstrapConfig := kubeconfigutil.CreateBasic(masterEndpoint, clustername, BootstrapUser, []byte{})
175+
controlPlaneEndpoint := fmt.Sprintf("https://%s", endpoint)
176+
bootstrapConfig := kubeconfigutil.CreateBasic(controlPlaneEndpoint, clustername, BootstrapUser, []byte{})
177177
bootstrapConfig.Clusters[clustername].InsecureSkipTLSVerify = true
178178
return bootstrapConfig
179179
}
180180

181181
// buildSecureBootstrapKubeConfig makes a kubeconfig object that connects securely to the API Server for bootstrapping purposes (validating with the specified CA)
182182
func buildSecureBootstrapKubeConfig(endpoint string, caCert []byte, clustername string) *clientcmdapi.Config {
183-
masterEndpoint := fmt.Sprintf("https://%s", endpoint)
184-
bootstrapConfig := kubeconfigutil.CreateBasic(masterEndpoint, clustername, BootstrapUser, caCert)
183+
controlPlaneEndpoint := fmt.Sprintf("https://%s", endpoint)
184+
bootstrapConfig := kubeconfigutil.CreateBasic(controlPlaneEndpoint, clustername, BootstrapUser, caCert)
185185
return bootstrapConfig
186186
}
187187

cmd/kubeadm/app/util/config/initconfiguration_test.go

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,16 @@ import (
3434
)
3535

3636
const (
37-
masterV1alpha3YAML = "testdata/conversion/master/v1alpha3.yaml"
38-
masterV1alpha3YAMLNonLinux = "testdata/conversion/master/v1alpha3_non_linux.yaml"
39-
masterV1beta1YAML = "testdata/conversion/master/v1beta1.yaml"
40-
masterV1beta1YAMLNonLinux = "testdata/conversion/master/v1beta1_non_linux.yaml"
41-
masterInternalYAML = "testdata/conversion/master/internal.yaml"
42-
masterInternalYAMLNonLinux = "testdata/conversion/master/internal_non_linux.yaml"
43-
masterIncompleteYAML = "testdata/defaulting/master/incomplete.yaml"
44-
masterDefaultedYAML = "testdata/defaulting/master/defaulted.yaml"
45-
masterDefaultedYAMLNonLinux = "testdata/defaulting/master/defaulted_non_linux.yaml"
46-
masterInvalidYAML = "testdata/validation/invalid_mastercfg.yaml"
37+
controlPlaneV1alpha3YAML = "testdata/conversion/controlplane/v1alpha3.yaml"
38+
controlPlaneV1alpha3YAMLNonLinux = "testdata/conversion/controlplane/v1alpha3_non_linux.yaml"
39+
controlPlaneV1beta1YAML = "testdata/conversion/controlplane/v1beta1.yaml"
40+
controlPlaneV1beta1YAMLNonLinux = "testdata/conversion/controlplane/v1beta1_non_linux.yaml"
41+
controlPlaneInternalYAML = "testdata/conversion/controlplane/internal.yaml"
42+
controlPlaneInternalYAMLNonLinux = "testdata/conversion/controlplane/internal_non_linux.yaml"
43+
controlPlaneIncompleteYAML = "testdata/defaulting/controlplane/incomplete.yaml"
44+
controlPlaneDefaultedYAML = "testdata/defaulting/controlplane/defaulted.yaml"
45+
controlPlaneDefaultedYAMLNonLinux = "testdata/defaulting/controlplane/defaulted_non_linux.yaml"
46+
controlPlaneInvalidYAML = "testdata/validation/invalid_controlplanecfg.yaml"
4747
)
4848

4949
func diff(expected, actual []byte) string {
@@ -141,15 +141,15 @@ func TestLoadInitConfigurationFromFile(t *testing.T) {
141141
}
142142

143143
func TestInitConfigurationMarshallingFromFile(t *testing.T) {
144-
masterV1alpha3YAMLAbstracted := masterV1alpha3YAML
145-
masterV1beta1YAMLAbstracted := masterV1beta1YAML
146-
masterInternalYAMLAbstracted := masterInternalYAML
147-
masterDefaultedYAMLAbstracted := masterDefaultedYAML
144+
controlPlaneV1alpha3YAMLAbstracted := controlPlaneV1alpha3YAML
145+
controlPlaneV1beta1YAMLAbstracted := controlPlaneV1beta1YAML
146+
controlPlaneInternalYAMLAbstracted := controlPlaneInternalYAML
147+
controlPlaneDefaultedYAMLAbstracted := controlPlaneDefaultedYAML
148148
if runtime.GOOS != "linux" {
149-
masterV1alpha3YAMLAbstracted = masterV1alpha3YAMLNonLinux
150-
masterV1beta1YAMLAbstracted = masterV1beta1YAMLNonLinux
151-
masterInternalYAMLAbstracted = masterInternalYAMLNonLinux
152-
masterDefaultedYAMLAbstracted = masterDefaultedYAMLNonLinux
149+
controlPlaneV1alpha3YAMLAbstracted = controlPlaneV1alpha3YAMLNonLinux
150+
controlPlaneV1beta1YAMLAbstracted = controlPlaneV1beta1YAMLNonLinux
151+
controlPlaneInternalYAMLAbstracted = controlPlaneInternalYAMLNonLinux
152+
controlPlaneDefaultedYAMLAbstracted = controlPlaneDefaultedYAMLNonLinux
153153
}
154154

155155
var tests = []struct {
@@ -161,32 +161,32 @@ func TestInitConfigurationMarshallingFromFile(t *testing.T) {
161161
// and then marshals the internal object to the expected groupVersion
162162
{ // v1alpha3 -> internal
163163
name: "v1alpha3IsDeprecated",
164-
in: masterV1alpha3YAMLAbstracted,
164+
in: controlPlaneV1alpha3YAMLAbstracted,
165165
expectedErr: true,
166166
},
167167
{ // v1beta1 -> internal
168168
name: "v1beta1ToInternal",
169-
in: masterV1beta1YAMLAbstracted,
170-
out: masterInternalYAMLAbstracted,
169+
in: controlPlaneV1beta1YAMLAbstracted,
170+
out: controlPlaneInternalYAMLAbstracted,
171171
groupVersion: kubeadm.SchemeGroupVersion,
172172
},
173173
{ // v1beta1 -> internal -> v1beta1
174174
name: "v1beta1Tov1beta1",
175-
in: masterV1beta1YAMLAbstracted,
176-
out: masterV1beta1YAMLAbstracted,
175+
in: controlPlaneV1beta1YAMLAbstracted,
176+
out: controlPlaneV1beta1YAMLAbstracted,
177177
groupVersion: kubeadmapiv1beta1.SchemeGroupVersion,
178178
},
179179
// These tests are reading one file that has only a subset of the fields populated, loading it using LoadInitConfigurationFromFile,
180180
// and then marshals the internal object to the expected groupVersion
181181
{ // v1beta1 -> default -> validate -> internal -> v1beta1
182182
name: "incompleteYAMLToDefaultedv1beta1",
183-
in: masterIncompleteYAML,
184-
out: masterDefaultedYAMLAbstracted,
183+
in: controlPlaneIncompleteYAML,
184+
out: controlPlaneDefaultedYAMLAbstracted,
185185
groupVersion: kubeadmapiv1beta1.SchemeGroupVersion,
186186
},
187187
{ // v1beta1 -> validation should fail
188188
name: "invalidYAMLShouldFail",
189-
in: masterInvalidYAML,
189+
in: controlPlaneInvalidYAML,
190190
expectedErr: true,
191191
},
192192
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)