From 5656338b6ef05632f44929cabdbdd79dea7faa8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20K=C3=A4ldstr=C3=B6m?= Date: Fri, 9 Nov 2018 14:47:45 +0200 Subject: [PATCH] Update unit tests after the rename --- .../kubeadm/validation/validation_test.go | 12 ++++---- .../app/phases/addons/proxy/proxy_test.go | 6 ++-- cmd/kubeadm/app/phases/certs/certs_test.go | 4 +-- .../app/phases/controlplane/manifests_test.go | 30 +++++++++---------- cmd/kubeadm/app/phases/etcd/local_test.go | 6 ++-- .../app/phases/kubeconfig/kubeconfig_test.go | 16 +++++----- .../app/phases/upgrade/postupgrade_test.go | 2 +- .../phases/uploadconfig/uploadconfig_test.go | 4 +-- cmd/kubeadm/app/preflight/checks_test.go | 4 +-- cmd/kubeadm/app/util/config/cluster_test.go | 8 ++--- .../testdata/conversion/master/internal.yaml | 6 ++-- .../testdata/conversion/master/v1beta1.yaml | 6 ++-- .../testdata/defaulting/master/defaulted.yaml | 6 ++-- .../defaulting/master/incomplete.yaml | 4 +-- cmd/kubeadm/app/util/endpoint_test.go | 22 +++++++------- .../app/util/pkiutil/pki_helpers_test.go | 8 ++--- cmd/kubeadm/app/util/staticpod/utils_test.go | 8 ++--- 17 files changed, 76 insertions(+), 76 deletions(-) diff --git a/cmd/kubeadm/app/apis/kubeadm/validation/validation_test.go b/cmd/kubeadm/app/apis/kubeadm/validation/validation_test.go index d36192cd51f..8afec022736 100644 --- a/cmd/kubeadm/app/apis/kubeadm/validation/validation_test.go +++ b/cmd/kubeadm/app/apis/kubeadm/validation/validation_test.go @@ -359,7 +359,7 @@ func TestValidateInitConfiguration(t *testing.T) { &kubeadm.InitConfiguration{}, false}, {"invalid missing token with IPv4 service subnet", &kubeadm.InitConfiguration{ - APIEndpoint: kubeadm.APIEndpoint{ + LocalAPIEndpoint: kubeadm.APIEndpoint{ AdvertiseAddress: "1.2.3.4", BindPort: 6443, }, @@ -374,7 +374,7 @@ func TestValidateInitConfiguration(t *testing.T) { }, false}, {"invalid missing token with IPv6 service subnet", &kubeadm.InitConfiguration{ - APIEndpoint: kubeadm.APIEndpoint{ + LocalAPIEndpoint: kubeadm.APIEndpoint{ AdvertiseAddress: "1.2.3.4", BindPort: 6443, }, @@ -389,7 +389,7 @@ func TestValidateInitConfiguration(t *testing.T) { }, false}, {"invalid missing node name", &kubeadm.InitConfiguration{ - APIEndpoint: kubeadm.APIEndpoint{ + LocalAPIEndpoint: kubeadm.APIEndpoint{ AdvertiseAddress: "1.2.3.4", BindPort: 6443, }, @@ -403,7 +403,7 @@ func TestValidateInitConfiguration(t *testing.T) { }, false}, {"valid master configuration with incorrect IPv4 pod subnet", &kubeadm.InitConfiguration{ - APIEndpoint: kubeadm.APIEndpoint{ + LocalAPIEndpoint: kubeadm.APIEndpoint{ AdvertiseAddress: "1.2.3.4", BindPort: 6443, }, @@ -419,7 +419,7 @@ func TestValidateInitConfiguration(t *testing.T) { }, false}, {"valid master configuration with IPv4 service subnet", &kubeadm.InitConfiguration{ - APIEndpoint: kubeadm.APIEndpoint{ + LocalAPIEndpoint: kubeadm.APIEndpoint{ AdvertiseAddress: "1.2.3.4", BindPort: 6443, }, @@ -466,7 +466,7 @@ func TestValidateInitConfiguration(t *testing.T) { }, true}, {"valid master configuration using IPv6 service subnet", &kubeadm.InitConfiguration{ - APIEndpoint: kubeadm.APIEndpoint{ + LocalAPIEndpoint: kubeadm.APIEndpoint{ AdvertiseAddress: "1:2:3::4", BindPort: 3446, }, diff --git a/cmd/kubeadm/app/phases/addons/proxy/proxy_test.go b/cmd/kubeadm/app/phases/addons/proxy/proxy_test.go index 9d7ab37bcba..9bfe210d1a5 100644 --- a/cmd/kubeadm/app/phases/addons/proxy/proxy_test.go +++ b/cmd/kubeadm/app/phases/addons/proxy/proxy_test.go @@ -174,7 +174,7 @@ func TestEnsureProxyAddon(t *testing.T) { client := clientsetfake.NewSimpleClientset() // TODO: Consider using a YAML file instead for this that makes it possible to specify YAML documents for the ComponentConfigs masterConfig := &kubeadmapiv1beta1.InitConfiguration{ - APIEndpoint: kubeadmapiv1beta1.APIEndpoint{ + LocalAPIEndpoint: kubeadmapiv1beta1.APIEndpoint{ AdvertiseAddress: "1.2.3.4", BindPort: 1234, }, @@ -194,9 +194,9 @@ func TestEnsureProxyAddon(t *testing.T) { return true, nil, apierrors.NewUnauthorized("") }) case InvalidMasterEndpoint: - masterConfig.APIEndpoint.AdvertiseAddress = "1.2.3" + masterConfig.LocalAPIEndpoint.AdvertiseAddress = "1.2.3" case IPv6SetBindAddress: - masterConfig.APIEndpoint.AdvertiseAddress = "1:2::3:4" + masterConfig.LocalAPIEndpoint.AdvertiseAddress = "1:2::3:4" masterConfig.Networking.PodSubnet = "2001:101::/96" } diff --git a/cmd/kubeadm/app/phases/certs/certs_test.go b/cmd/kubeadm/app/phases/certs/certs_test.go index 5412303202b..3e32c03710e 100644 --- a/cmd/kubeadm/app/phases/certs/certs_test.go +++ b/cmd/kubeadm/app/phases/certs/certs_test.go @@ -506,7 +506,7 @@ func TestUsingExternalCA(t *testing.T) { defer os.RemoveAll(dir) cfg := &kubeadmapi.InitConfiguration{ - APIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4"}, + LocalAPIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4"}, ClusterConfiguration: kubeadmapi.ClusterConfiguration{ Networking: kubeadmapi.Networking{ServiceSubnet: "10.96.0.0/12", DNSDomain: "cluster.local"}, CertificatesDir: dir, @@ -675,7 +675,7 @@ func TestCreateCertificateFilesMethods(t *testing.T) { defer os.RemoveAll(tmpdir) cfg := &kubeadmapi.InitConfiguration{ - APIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4"}, + LocalAPIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4"}, ClusterConfiguration: kubeadmapi.ClusterConfiguration{ Etcd: kubeadmapi.Etcd{Local: &kubeadmapi.LocalEtcd{}}, Networking: kubeadmapi.Networking{ServiceSubnet: "10.96.0.0/12", DNSDomain: "cluster.local"}, diff --git a/cmd/kubeadm/app/phases/controlplane/manifests_test.go b/cmd/kubeadm/app/phases/controlplane/manifests_test.go index 11cf5e2a1e9..0aa23ec48db 100644 --- a/cmd/kubeadm/app/phases/controlplane/manifests_test.go +++ b/cmd/kubeadm/app/phases/controlplane/manifests_test.go @@ -146,7 +146,7 @@ func TestGetAPIServerCommand(t *testing.T) { { name: "testing defaults", cfg: &kubeadmapi.InitConfiguration{ - APIEndpoint: kubeadmapi.APIEndpoint{BindPort: 123, AdvertiseAddress: "1.2.3.4"}, + LocalAPIEndpoint: kubeadmapi.APIEndpoint{BindPort: 123, AdvertiseAddress: "1.2.3.4"}, ClusterConfiguration: kubeadmapi.ClusterConfiguration{ Networking: kubeadmapi.Networking{ServiceSubnet: "bar"}, CertificatesDir: testCertsDir, @@ -185,7 +185,7 @@ func TestGetAPIServerCommand(t *testing.T) { { name: "ignores the audit policy if the feature gate is not enabled", cfg: &kubeadmapi.InitConfiguration{ - APIEndpoint: kubeadmapi.APIEndpoint{BindPort: 123, AdvertiseAddress: "4.3.2.1"}, + LocalAPIEndpoint: kubeadmapi.APIEndpoint{BindPort: 123, AdvertiseAddress: "4.3.2.1"}, ClusterConfiguration: kubeadmapi.ClusterConfiguration{ Networking: kubeadmapi.Networking{ServiceSubnet: "bar"}, CertificatesDir: testCertsDir, @@ -229,7 +229,7 @@ func TestGetAPIServerCommand(t *testing.T) { { name: "ipv6 advertise address", cfg: &kubeadmapi.InitConfiguration{ - APIEndpoint: kubeadmapi.APIEndpoint{BindPort: 123, AdvertiseAddress: "2001:db8::1"}, + LocalAPIEndpoint: kubeadmapi.APIEndpoint{BindPort: 123, AdvertiseAddress: "2001:db8::1"}, ClusterConfiguration: kubeadmapi.ClusterConfiguration{ Networking: kubeadmapi.Networking{ServiceSubnet: "bar"}, CertificatesDir: testCertsDir, @@ -268,7 +268,7 @@ func TestGetAPIServerCommand(t *testing.T) { { name: "an external etcd with custom ca, certs and keys", cfg: &kubeadmapi.InitConfiguration{ - APIEndpoint: kubeadmapi.APIEndpoint{BindPort: 123, AdvertiseAddress: "2001:db8::1"}, + LocalAPIEndpoint: kubeadmapi.APIEndpoint{BindPort: 123, AdvertiseAddress: "2001:db8::1"}, ClusterConfiguration: kubeadmapi.ClusterConfiguration{ Networking: kubeadmapi.Networking{ServiceSubnet: "bar"}, Etcd: kubeadmapi.Etcd{ @@ -315,7 +315,7 @@ func TestGetAPIServerCommand(t *testing.T) { { name: "an insecure etcd", cfg: &kubeadmapi.InitConfiguration{ - APIEndpoint: kubeadmapi.APIEndpoint{BindPort: 123, AdvertiseAddress: "2001:db8::1"}, + LocalAPIEndpoint: kubeadmapi.APIEndpoint{BindPort: 123, AdvertiseAddress: "2001:db8::1"}, ClusterConfiguration: kubeadmapi.ClusterConfiguration{ Networking: kubeadmapi.Networking{ServiceSubnet: "bar"}, Etcd: kubeadmapi.Etcd{ @@ -356,7 +356,7 @@ func TestGetAPIServerCommand(t *testing.T) { { name: "auditing is enabled with a custom log max age of 0", cfg: &kubeadmapi.InitConfiguration{ - APIEndpoint: kubeadmapi.APIEndpoint{BindPort: 123, AdvertiseAddress: "2001:db8::1"}, + LocalAPIEndpoint: kubeadmapi.APIEndpoint{BindPort: 123, AdvertiseAddress: "2001:db8::1"}, ClusterConfiguration: kubeadmapi.ClusterConfiguration{ Networking: kubeadmapi.Networking{ServiceSubnet: "bar"}, FeatureGates: map[string]bool{features.Auditing: true}, @@ -402,7 +402,7 @@ func TestGetAPIServerCommand(t *testing.T) { { name: "ensure the DynamicKubelet flag gets passed through", cfg: &kubeadmapi.InitConfiguration{ - APIEndpoint: kubeadmapi.APIEndpoint{BindPort: 123, AdvertiseAddress: "1.2.3.4"}, + LocalAPIEndpoint: kubeadmapi.APIEndpoint{BindPort: 123, AdvertiseAddress: "1.2.3.4"}, ClusterConfiguration: kubeadmapi.ClusterConfiguration{ Networking: kubeadmapi.Networking{ServiceSubnet: "bar"}, CertificatesDir: testCertsDir, @@ -443,7 +443,7 @@ func TestGetAPIServerCommand(t *testing.T) { { name: "test APIServer.ExtraArgs works as expected", cfg: &kubeadmapi.InitConfiguration{ - APIEndpoint: kubeadmapi.APIEndpoint{BindPort: 123, AdvertiseAddress: "1.2.3.4"}, + LocalAPIEndpoint: kubeadmapi.APIEndpoint{BindPort: 123, AdvertiseAddress: "1.2.3.4"}, ClusterConfiguration: kubeadmapi.ClusterConfiguration{ Networking: kubeadmapi.Networking{ServiceSubnet: "bar"}, CertificatesDir: testCertsDir, @@ -497,7 +497,7 @@ func TestGetAPIServerCommand(t *testing.T) { { name: "authorization-mode extra-args ABAC", cfg: &kubeadmapi.InitConfiguration{ - APIEndpoint: kubeadmapi.APIEndpoint{BindPort: 123, AdvertiseAddress: "1.2.3.4"}, + LocalAPIEndpoint: kubeadmapi.APIEndpoint{BindPort: 123, AdvertiseAddress: "1.2.3.4"}, ClusterConfiguration: kubeadmapi.ClusterConfiguration{ Networking: kubeadmapi.Networking{ServiceSubnet: "bar"}, CertificatesDir: testCertsDir, @@ -543,7 +543,7 @@ func TestGetAPIServerCommand(t *testing.T) { { name: "insecure-port extra-args", cfg: &kubeadmapi.InitConfiguration{ - APIEndpoint: kubeadmapi.APIEndpoint{BindPort: 123, AdvertiseAddress: "1.2.3.4"}, + LocalAPIEndpoint: kubeadmapi.APIEndpoint{BindPort: 123, AdvertiseAddress: "1.2.3.4"}, ClusterConfiguration: kubeadmapi.ClusterConfiguration{ Networking: kubeadmapi.Networking{ServiceSubnet: "bar"}, CertificatesDir: testCertsDir, @@ -589,7 +589,7 @@ func TestGetAPIServerCommand(t *testing.T) { { name: "authorization-mode extra-args Webhook", cfg: &kubeadmapi.InitConfiguration{ - APIEndpoint: kubeadmapi.APIEndpoint{BindPort: 123, AdvertiseAddress: "1.2.3.4"}, + LocalAPIEndpoint: kubeadmapi.APIEndpoint{BindPort: 123, AdvertiseAddress: "1.2.3.4"}, ClusterConfiguration: kubeadmapi.ClusterConfiguration{ Networking: kubeadmapi.Networking{ServiceSubnet: "bar"}, CertificatesDir: testCertsDir, @@ -971,7 +971,7 @@ func TestGetControllerManagerCommandExternalCA(t *testing.T) { { name: "caKeyPresent-false for v1.12.0-beta.2", cfg: &kubeadmapi.InitConfiguration{ - APIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4"}, + LocalAPIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4"}, ClusterConfiguration: kubeadmapi.ClusterConfiguration{ KubernetesVersion: "v1.12.0-beta.2", Networking: kubeadmapi.Networking{ServiceSubnet: "10.96.0.0/12", DNSDomain: "cluster.local"}, @@ -1000,7 +1000,7 @@ func TestGetControllerManagerCommandExternalCA(t *testing.T) { { name: "caKeyPresent true for v1.12.0-beta.2", cfg: &kubeadmapi.InitConfiguration{ - APIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4"}, + LocalAPIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4"}, ClusterConfiguration: kubeadmapi.ClusterConfiguration{ KubernetesVersion: "v1.12.0-beta.2", Networking: kubeadmapi.Networking{ServiceSubnet: "10.96.0.0/12", DNSDomain: "cluster.local"}, @@ -1029,7 +1029,7 @@ func TestGetControllerManagerCommandExternalCA(t *testing.T) { { name: "caKeyPresent-false for v1.11.3", cfg: &kubeadmapi.InitConfiguration{ - APIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4"}, + LocalAPIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4"}, ClusterConfiguration: kubeadmapi.ClusterConfiguration{ KubernetesVersion: "v1.11.3", Networking: kubeadmapi.Networking{ServiceSubnet: "10.96.0.0/12", DNSDomain: "cluster.local"}, @@ -1054,7 +1054,7 @@ func TestGetControllerManagerCommandExternalCA(t *testing.T) { { name: "caKeyPresent true for v1.11.3", cfg: &kubeadmapi.InitConfiguration{ - APIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4"}, + LocalAPIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4"}, ClusterConfiguration: kubeadmapi.ClusterConfiguration{ KubernetesVersion: "v1.11.3", Networking: kubeadmapi.Networking{ServiceSubnet: "10.96.0.0/12", DNSDomain: "cluster.local"}, diff --git a/cmd/kubeadm/app/phases/etcd/local_test.go b/cmd/kubeadm/app/phases/etcd/local_test.go index 53c791a2706..f4badb7b508 100644 --- a/cmd/kubeadm/app/phases/etcd/local_test.go +++ b/cmd/kubeadm/app/phases/etcd/local_test.go @@ -124,7 +124,7 @@ func TestGetEtcdCommand(t *testing.T) { { name: "Default args - with empty etcd initial cluster", cfg: &kubeadmapi.InitConfiguration{ - APIEndpoint: kubeadmapi.APIEndpoint{ + LocalAPIEndpoint: kubeadmapi.APIEndpoint{ AdvertiseAddress: "1.2.3.4", }, NodeRegistration: kubeadmapi.NodeRegistrationOptions{ @@ -161,7 +161,7 @@ func TestGetEtcdCommand(t *testing.T) { { name: "Default args - With an existing etcd cluster", cfg: &kubeadmapi.InitConfiguration{ - APIEndpoint: kubeadmapi.APIEndpoint{ + LocalAPIEndpoint: kubeadmapi.APIEndpoint{ AdvertiseAddress: "1.2.3.4", }, NodeRegistration: kubeadmapi.NodeRegistrationOptions{ @@ -203,7 +203,7 @@ func TestGetEtcdCommand(t *testing.T) { { name: "Extra args", cfg: &kubeadmapi.InitConfiguration{ - APIEndpoint: kubeadmapi.APIEndpoint{ + LocalAPIEndpoint: kubeadmapi.APIEndpoint{ AdvertiseAddress: "1.2.3.4", }, NodeRegistration: kubeadmapi.NodeRegistrationOptions{ diff --git a/cmd/kubeadm/app/phases/kubeconfig/kubeconfig_test.go b/cmd/kubeadm/app/phases/kubeconfig/kubeconfig_test.go index 9fdbc81ee56..8416c672fc0 100644 --- a/cmd/kubeadm/app/phases/kubeconfig/kubeconfig_test.go +++ b/cmd/kubeadm/app/phases/kubeconfig/kubeconfig_test.go @@ -69,14 +69,14 @@ func TestGetKubeConfigSpecs(t *testing.T) { // Creates Master Configurations pointing to the pkidir folder cfgs := []*kubeadmapi.InitConfiguration{ { - APIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4", BindPort: 1234}, + LocalAPIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4", BindPort: 1234}, ClusterConfiguration: kubeadmapi.ClusterConfiguration{ CertificatesDir: pkidir, }, NodeRegistration: kubeadmapi.NodeRegistrationOptions{Name: "valid-node-name"}, }, { - APIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4", BindPort: 1234}, + LocalAPIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4", BindPort: 1234}, ClusterConfiguration: kubeadmapi.ClusterConfiguration{ ControlPlaneEndpoint: "api.k8s.io", CertificatesDir: pkidir, @@ -84,7 +84,7 @@ func TestGetKubeConfigSpecs(t *testing.T) { NodeRegistration: kubeadmapi.NodeRegistrationOptions{Name: "valid-node-name"}, }, { - APIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4", BindPort: 1234}, + LocalAPIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4", BindPort: 1234}, ClusterConfiguration: kubeadmapi.ClusterConfiguration{ ControlPlaneEndpoint: "api.k8s.io:4321", CertificatesDir: pkidir, @@ -92,7 +92,7 @@ func TestGetKubeConfigSpecs(t *testing.T) { NodeRegistration: kubeadmapi.NodeRegistrationOptions{Name: "valid-node-name"}, }, { - APIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4", BindPort: 1234}, + LocalAPIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4", BindPort: 1234}, ClusterConfiguration: kubeadmapi.ClusterConfiguration{ ControlPlaneEndpoint: "api.k8s.io", CertificatesDir: pkidir, @@ -100,7 +100,7 @@ func TestGetKubeConfigSpecs(t *testing.T) { NodeRegistration: kubeadmapi.NodeRegistrationOptions{Name: "valid-node-name"}, }, { - APIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4", BindPort: 1234}, + LocalAPIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4", BindPort: 1234}, ClusterConfiguration: kubeadmapi.ClusterConfiguration{ ControlPlaneEndpoint: "api.k8s.io:4321", CertificatesDir: pkidir, @@ -307,7 +307,7 @@ func TestCreateKubeconfigFilesAndWrappers(t *testing.T) { // Creates a Master Configuration pointing to the pkidir folder cfg := &kubeadmapi.InitConfiguration{ - APIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4", BindPort: 1234}, + LocalAPIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4", BindPort: 1234}, ClusterConfiguration: kubeadmapi.ClusterConfiguration{ CertificatesDir: pkidir, }, @@ -384,7 +384,7 @@ func TestWriteKubeConfig(t *testing.T) { // Creates a Master Configuration pointing to the pkidir folder cfg := &kubeadmapi.InitConfiguration{ - APIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4", BindPort: 1234}, + LocalAPIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4", BindPort: 1234}, ClusterConfiguration: kubeadmapi.ClusterConfiguration{ CertificatesDir: pkidir, }, @@ -506,7 +506,7 @@ func TestValidateKubeconfigsForExternalCA(t *testing.T) { ClusterConfiguration: kubeadmapi.ClusterConfiguration{ CertificatesDir: pkiDir, }, - APIEndpoint: kubeadmapi.APIEndpoint{ + LocalAPIEndpoint: kubeadmapi.APIEndpoint{ BindPort: 1234, AdvertiseAddress: "1.2.3.4", }, diff --git a/cmd/kubeadm/app/phases/upgrade/postupgrade_test.go b/cmd/kubeadm/app/phases/upgrade/postupgrade_test.go index d35d0c19c92..6b2aebded55 100644 --- a/cmd/kubeadm/app/phases/upgrade/postupgrade_test.go +++ b/cmd/kubeadm/app/phases/upgrade/postupgrade_test.go @@ -130,7 +130,7 @@ func TestRollbackFiles(t *testing.T) { func TestShouldBackupAPIServerCertAndKey(t *testing.T) { cfg := &kubeadmapi.InitConfiguration{ - APIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4"}, + LocalAPIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4"}, ClusterConfiguration: kubeadmapi.ClusterConfiguration{ Networking: kubeadmapi.Networking{ServiceSubnet: "10.96.0.0/12", DNSDomain: "cluster.local"}, }, diff --git a/cmd/kubeadm/app/phases/uploadconfig/uploadconfig_test.go b/cmd/kubeadm/app/phases/uploadconfig/uploadconfig_test.go index 7ef7191760a..1b69f49569e 100644 --- a/cmd/kubeadm/app/phases/uploadconfig/uploadconfig_test.go +++ b/cmd/kubeadm/app/phases/uploadconfig/uploadconfig_test.go @@ -65,7 +65,7 @@ func TestUploadConfiguration(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t2 *testing.T) { initialcfg := &kubeadmapiv1beta1.InitConfiguration{ - APIEndpoint: kubeadmapiv1beta1.APIEndpoint{ + LocalAPIEndpoint: kubeadmapiv1beta1.APIEndpoint{ AdvertiseAddress: "1.2.3.4", }, ClusterConfiguration: kubeadmapiv1beta1.ClusterConfiguration{ @@ -95,7 +95,7 @@ func TestUploadConfiguration(t *testing.T) { status := &kubeadmapi.ClusterStatus{ APIEndpoints: map[string]kubeadmapi.APIEndpoint{ - "node-foo": cfg.APIEndpoint, + "node-foo": cfg.LocalAPIEndpoint, }, } diff --git a/cmd/kubeadm/app/preflight/checks_test.go b/cmd/kubeadm/app/preflight/checks_test.go index 8132468f67e..1b7c01295ca 100644 --- a/cmd/kubeadm/app/preflight/checks_test.go +++ b/cmd/kubeadm/app/preflight/checks_test.go @@ -191,7 +191,7 @@ func TestRunInitMasterChecks(t *testing.T) { }{ {name: "Test valid advertised address", cfg: &kubeadmapi.InitConfiguration{ - APIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "foo"}, + LocalAPIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "foo"}, }, expected: false, }, @@ -224,7 +224,7 @@ func TestRunInitMasterChecks(t *testing.T) { }, { cfg: &kubeadmapi.InitConfiguration{ - APIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "2001:1234::1:15"}, + LocalAPIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "2001:1234::1:15"}, }, expected: false, }, diff --git a/cmd/kubeadm/app/util/config/cluster_test.go b/cmd/kubeadm/app/util/config/cluster_test.go index ecc6bae7661..5605ca6046a 100644 --- a/cmd/kubeadm/app/util/config/cluster_test.go +++ b/cmd/kubeadm/app/util/config/cluster_test.go @@ -459,7 +459,7 @@ func TestGetAPIEndpoint(t *testing.T) { for _, rt := range tests { t.Run(rt.name, func(t *testing.T) { cfg := &kubeadmapi.InitConfiguration{} - err := getAPIEndpoint(rt.configMap.data, nodeName, &cfg.APIEndpoint) + err := getAPIEndpoint(rt.configMap.data, nodeName, &cfg.LocalAPIEndpoint) if rt.expectedError != (err != nil) { t.Errorf("unexpected return err from getInitConfigurationFromCluster: %v", err) return @@ -468,7 +468,7 @@ func TestGetAPIEndpoint(t *testing.T) { return } - if cfg.APIEndpoint.AdvertiseAddress != "1.2.3.4" || cfg.APIEndpoint.BindPort != 1234 { + if cfg.LocalAPIEndpoint.AdvertiseAddress != "1.2.3.4" || cfg.LocalAPIEndpoint.BindPort != 1234 { t.Errorf("invalid cfg.APIEndpoint") } }) @@ -757,8 +757,8 @@ func TestGetInitConfigurationFromCluster(t *testing.T) { if cfg.ClusterConfiguration.KubernetesVersion != k8sVersionString { t.Errorf("invalid ClusterConfiguration.KubernetesVersion") } - if !rt.newControlPlane && (cfg.APIEndpoint.AdvertiseAddress != "1.2.3.4" || cfg.APIEndpoint.BindPort != 1234) { - t.Errorf("invalid cfg.APIEndpoint") + if !rt.newControlPlane && (cfg.LocalAPIEndpoint.AdvertiseAddress != "1.2.3.4" || cfg.LocalAPIEndpoint.BindPort != 1234) { + t.Errorf("invalid cfg.LocalAPIEndpoint") } if cfg.ComponentConfigs.Kubelet == nil { t.Errorf("invalid cfg.ComponentConfigs.Kubelet") diff --git a/cmd/kubeadm/app/util/config/testdata/conversion/master/internal.yaml b/cmd/kubeadm/app/util/config/testdata/conversion/master/internal.yaml index af08a33e5e5..fd76b45507c 100644 --- a/cmd/kubeadm/app/util/config/testdata/conversion/master/internal.yaml +++ b/cmd/kubeadm/app/util/config/testdata/conversion/master/internal.yaml @@ -1,6 +1,3 @@ -APIEndpoint: - AdvertiseAddress: 192.168.2.2 - BindPort: 6443 APIServer: CertSANs: null ExtraArgs: @@ -186,6 +183,9 @@ Etcd: FeatureGates: null ImageRepository: k8s.gcr.io KubernetesVersion: v1.11.2 +LocalAPIEndpoint: + AdvertiseAddress: 192.168.2.2 + BindPort: 6443 Networking: DNSDomain: cluster.local PodSubnet: "" diff --git a/cmd/kubeadm/app/util/config/testdata/conversion/master/v1beta1.yaml b/cmd/kubeadm/app/util/config/testdata/conversion/master/v1beta1.yaml index 92758f57c30..1fdc4253d7b 100644 --- a/cmd/kubeadm/app/util/config/testdata/conversion/master/v1beta1.yaml +++ b/cmd/kubeadm/app/util/config/testdata/conversion/master/v1beta1.yaml @@ -1,6 +1,3 @@ -apiEndpoint: - advertiseAddress: 192.168.2.2 - bindPort: 6443 apiVersion: kubeadm.k8s.io/v1beta1 bootstrapTokens: - groups: @@ -11,6 +8,9 @@ bootstrapTokens: - signing - authentication kind: InitConfiguration +localAPIEndpoint: + advertiseAddress: 192.168.2.2 + bindPort: 6443 nodeRegistration: criSocket: /var/run/dockershim.sock name: master-1 diff --git a/cmd/kubeadm/app/util/config/testdata/defaulting/master/defaulted.yaml b/cmd/kubeadm/app/util/config/testdata/defaulting/master/defaulted.yaml index 1df4353c21f..3e818f3340c 100644 --- a/cmd/kubeadm/app/util/config/testdata/defaulting/master/defaulted.yaml +++ b/cmd/kubeadm/app/util/config/testdata/defaulting/master/defaulted.yaml @@ -1,6 +1,3 @@ -apiEndpoint: - advertiseAddress: 192.168.2.2 - bindPort: 6443 apiVersion: kubeadm.k8s.io/v1beta1 bootstrapTokens: - groups: @@ -11,6 +8,9 @@ bootstrapTokens: - signing - authentication kind: InitConfiguration +localAPIEndpoint: + advertiseAddress: 192.168.2.2 + bindPort: 6443 nodeRegistration: criSocket: /var/run/criruntime.sock name: master-1 diff --git a/cmd/kubeadm/app/util/config/testdata/defaulting/master/incomplete.yaml b/cmd/kubeadm/app/util/config/testdata/defaulting/master/incomplete.yaml index d402a1bfe15..362e8e31357 100644 --- a/cmd/kubeadm/app/util/config/testdata/defaulting/master/incomplete.yaml +++ b/cmd/kubeadm/app/util/config/testdata/defaulting/master/incomplete.yaml @@ -1,9 +1,9 @@ apiVersion: kubeadm.k8s.io/v1beta1 kind: InitConfiguration -apiEndpoint: - advertiseAddress: 192.168.2.2 bootstrapTokens: - token: s73ybu.6tw6wnqgp5z0wb77 +localAPIEndpoint: + advertiseAddress: 192.168.2.2 nodeRegistration: criSocket: /var/run/criruntime.sock name: master-1 diff --git a/cmd/kubeadm/app/util/endpoint_test.go b/cmd/kubeadm/app/util/endpoint_test.go index cdc877fe333..21b5931ba77 100644 --- a/cmd/kubeadm/app/util/endpoint_test.go +++ b/cmd/kubeadm/app/util/endpoint_test.go @@ -32,7 +32,7 @@ func TestGetMasterEndpoint(t *testing.T) { { name: "use ControlPlaneEndpoint (dns) if fully defined", cfg: &kubeadmapi.InitConfiguration{ - APIEndpoint: kubeadmapi.APIEndpoint{ + LocalAPIEndpoint: kubeadmapi.APIEndpoint{ BindPort: 4567, AdvertiseAddress: "4.5.6.7", }, @@ -45,7 +45,7 @@ func TestGetMasterEndpoint(t *testing.T) { { name: "use ControlPlaneEndpoint (ipv4) if fully defined", cfg: &kubeadmapi.InitConfiguration{ - APIEndpoint: kubeadmapi.APIEndpoint{ + LocalAPIEndpoint: kubeadmapi.APIEndpoint{ BindPort: 4567, AdvertiseAddress: "4.5.6.7", }, @@ -58,7 +58,7 @@ func TestGetMasterEndpoint(t *testing.T) { { name: "use ControlPlaneEndpoint (ipv6) if fully defined", cfg: &kubeadmapi.InitConfiguration{ - APIEndpoint: kubeadmapi.APIEndpoint{ + LocalAPIEndpoint: kubeadmapi.APIEndpoint{ BindPort: 4567, AdvertiseAddress: "4.5.6.7", }, @@ -71,7 +71,7 @@ func TestGetMasterEndpoint(t *testing.T) { { name: "use ControlPlaneEndpoint (dns) + BindPort if ControlPlaneEndpoint defined without port", cfg: &kubeadmapi.InitConfiguration{ - APIEndpoint: kubeadmapi.APIEndpoint{ + LocalAPIEndpoint: kubeadmapi.APIEndpoint{ BindPort: 4567, AdvertiseAddress: "4.5.6.7", }, @@ -85,7 +85,7 @@ func TestGetMasterEndpoint(t *testing.T) { { name: "use ControlPlaneEndpoint (ipv4) + BindPort if ControlPlaneEndpoint defined without port", cfg: &kubeadmapi.InitConfiguration{ - APIEndpoint: kubeadmapi.APIEndpoint{ + LocalAPIEndpoint: kubeadmapi.APIEndpoint{ BindPort: 4567, AdvertiseAddress: "4.5.6.7", }, @@ -98,7 +98,7 @@ func TestGetMasterEndpoint(t *testing.T) { { name: "use ControlPlaneEndpoint (ipv6) + BindPort if ControlPlaneEndpoint defined without port", cfg: &kubeadmapi.InitConfiguration{ - APIEndpoint: kubeadmapi.APIEndpoint{ + LocalAPIEndpoint: kubeadmapi.APIEndpoint{ BindPort: 4567, AdvertiseAddress: "4.5.6.7", }, @@ -112,7 +112,7 @@ func TestGetMasterEndpoint(t *testing.T) { { name: "use AdvertiseAddress (ipv4) + BindPort if ControlPlaneEndpoint is not defined", cfg: &kubeadmapi.InitConfiguration{ - APIEndpoint: kubeadmapi.APIEndpoint{ + LocalAPIEndpoint: kubeadmapi.APIEndpoint{ BindPort: 4567, AdvertiseAddress: "4.5.6.7", }, @@ -122,7 +122,7 @@ func TestGetMasterEndpoint(t *testing.T) { { name: "use AdvertiseAddress (ipv6) + BindPort if ControlPlaneEndpoint is not defined", cfg: &kubeadmapi.InitConfiguration{ - APIEndpoint: kubeadmapi.APIEndpoint{ + LocalAPIEndpoint: kubeadmapi.APIEndpoint{ BindPort: 4567, AdvertiseAddress: "2001:db8::1", }, @@ -132,7 +132,7 @@ func TestGetMasterEndpoint(t *testing.T) { { name: "fail if invalid BindPort", cfg: &kubeadmapi.InitConfiguration{ - APIEndpoint: kubeadmapi.APIEndpoint{ + LocalAPIEndpoint: kubeadmapi.APIEndpoint{ BindPort: 0, }, }, @@ -177,7 +177,7 @@ func TestGetMasterEndpoint(t *testing.T) { { name: "fail if invalid AdvertiseAddress (ip4)", cfg: &kubeadmapi.InitConfiguration{ - APIEndpoint: kubeadmapi.APIEndpoint{ + LocalAPIEndpoint: kubeadmapi.APIEndpoint{ AdvertiseAddress: "1..0", BindPort: 4567, }, @@ -187,7 +187,7 @@ func TestGetMasterEndpoint(t *testing.T) { { name: "fail if invalid AdvertiseAddress (ip6)", cfg: &kubeadmapi.InitConfiguration{ - APIEndpoint: kubeadmapi.APIEndpoint{ + LocalAPIEndpoint: kubeadmapi.APIEndpoint{ AdvertiseAddress: "1200::AB00:1234::2552:7777:1313", BindPort: 4567, }, diff --git a/cmd/kubeadm/app/util/pkiutil/pki_helpers_test.go b/cmd/kubeadm/app/util/pkiutil/pki_helpers_test.go index 5905796b3ca..41eba0c291b 100644 --- a/cmd/kubeadm/app/util/pkiutil/pki_helpers_test.go +++ b/cmd/kubeadm/app/util/pkiutil/pki_helpers_test.go @@ -446,7 +446,7 @@ func TestGetAPIServerAltNames(t *testing.T) { { name: "ControlPlaneEndpoint DNS", cfg: &kubeadmapi.InitConfiguration{ - APIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4"}, + LocalAPIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4"}, ClusterConfiguration: kubeadmapi.ClusterConfiguration{ ControlPlaneEndpoint: "api.k8s.io:6443", Networking: kubeadmapi.Networking{ServiceSubnet: "10.96.0.0/12", DNSDomain: "cluster.local"}, @@ -462,7 +462,7 @@ func TestGetAPIServerAltNames(t *testing.T) { { name: "ControlPlaneEndpoint IP", cfg: &kubeadmapi.InitConfiguration{ - APIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4"}, + LocalAPIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4"}, ClusterConfiguration: kubeadmapi.ClusterConfiguration{ ControlPlaneEndpoint: "4.5.6.7:6443", Networking: kubeadmapi.Networking{ServiceSubnet: "10.96.0.0/12", DNSDomain: "cluster.local"}, @@ -517,7 +517,7 @@ func TestGetEtcdAltNames(t *testing.T) { proxy := "user-etcd-proxy" proxyIP := "10.10.10.100" cfg := &kubeadmapi.InitConfiguration{ - APIEndpoint: kubeadmapi.APIEndpoint{ + LocalAPIEndpoint: kubeadmapi.APIEndpoint{ AdvertiseAddress: "1.2.3.4", }, NodeRegistration: kubeadmapi.NodeRegistrationOptions{ @@ -579,7 +579,7 @@ func TestGetEtcdPeerAltNames(t *testing.T) { proxyIP := "10.10.10.100" advertiseIP := "1.2.3.4" cfg := &kubeadmapi.InitConfiguration{ - APIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: advertiseIP}, + LocalAPIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: advertiseIP}, ClusterConfiguration: kubeadmapi.ClusterConfiguration{ Etcd: kubeadmapi.Etcd{ Local: &kubeadmapi.LocalEtcd{ diff --git a/cmd/kubeadm/app/util/staticpod/utils_test.go b/cmd/kubeadm/app/util/staticpod/utils_test.go index c569aba460d..84c552277aa 100644 --- a/cmd/kubeadm/app/util/staticpod/utils_test.go +++ b/cmd/kubeadm/app/util/staticpod/utils_test.go @@ -55,7 +55,7 @@ func TestComponentProbe(t *testing.T) { { name: "default apiserver advertise address with http", cfg: &kubeadmapi.InitConfiguration{ - APIEndpoint: kubeadmapi.APIEndpoint{ + LocalAPIEndpoint: kubeadmapi.APIEndpoint{ AdvertiseAddress: "", }, }, @@ -68,7 +68,7 @@ func TestComponentProbe(t *testing.T) { { name: "default apiserver advertise address with https", cfg: &kubeadmapi.InitConfiguration{ - APIEndpoint: kubeadmapi.APIEndpoint{ + LocalAPIEndpoint: kubeadmapi.APIEndpoint{ AdvertiseAddress: "", }, }, @@ -81,7 +81,7 @@ func TestComponentProbe(t *testing.T) { { name: "valid ipv4 apiserver advertise address with http", cfg: &kubeadmapi.InitConfiguration{ - APIEndpoint: kubeadmapi.APIEndpoint{ + LocalAPIEndpoint: kubeadmapi.APIEndpoint{ AdvertiseAddress: "1.2.3.4", }, }, @@ -94,7 +94,7 @@ func TestComponentProbe(t *testing.T) { { name: "valid ipv6 apiserver advertise address with http", cfg: &kubeadmapi.InitConfiguration{ - APIEndpoint: kubeadmapi.APIEndpoint{ + LocalAPIEndpoint: kubeadmapi.APIEndpoint{ AdvertiseAddress: "2001:db8::1", }, },