Merge pull request #85817 from ereslibre/set-cluster-name-on-controller-manager

kubeadm: set cluster name on the controller manager
This commit is contained in:
Kubernetes Prow Robot 2019-12-02 13:49:09 -08:00 committed by GitHub
commit 6e0ce9fb2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 0 deletions

View File

@ -324,6 +324,11 @@ func getControllerManagerCommand(cfg *kubeadmapi.ClusterConfiguration) []string
}
}
// Set cluster name
if cfg.ClusterName != "" {
defaultArguments["cluster-name"] = cfg.ClusterName
}
// TODO: The following code should be remvoved after dual-stack is GA.
// Note: The user still retains the ability to explicitly set feature-gates and that value will overwrite this base value.
enabled, present := cfg.FeatureGates[features.IPv6DualStack]

View File

@ -579,6 +579,31 @@ func TestGetControllerManagerCommand(t *testing.T) {
cfg *kubeadmapi.ClusterConfiguration
expected []string
}{
{
name: "custom cluster name for " + cpVersion,
cfg: &kubeadmapi.ClusterConfiguration{
KubernetesVersion: cpVersion,
CertificatesDir: testCertsDir,
ClusterName: "some-other-cluster-name",
},
expected: []string{
"kube-controller-manager",
"--bind-address=127.0.0.1",
"--leader-elect=true",
"--kubeconfig=" + kubeadmconstants.KubernetesDir + "/controller-manager.conf",
"--root-ca-file=" + testCertsDir + "/ca.crt",
"--service-account-private-key-file=" + testCertsDir + "/sa.key",
"--cluster-signing-cert-file=" + testCertsDir + "/ca.crt",
"--cluster-signing-key-file=" + testCertsDir + "/ca.key",
"--use-service-account-credentials=true",
"--controllers=*,bootstrapsigner,tokencleaner",
"--authentication-kubeconfig=" + kubeadmconstants.KubernetesDir + "/controller-manager.conf",
"--authorization-kubeconfig=" + kubeadmconstants.KubernetesDir + "/controller-manager.conf",
"--client-ca-file=" + testCertsDir + "/ca.crt",
"--requestheader-client-ca-file=" + testCertsDir + "/front-proxy-ca.crt",
"--cluster-name=some-other-cluster-name",
},
},
{
name: "custom certs dir for " + cpVersion,
cfg: &kubeadmapi.ClusterConfiguration{