mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-02 16:29:21 +00:00
kubeadm: set cluster name on the controller manager
On kubeadm's configuration it's possible to set up the cluster name. Forward this information to the controller manager's `--cluster-name` argument.
This commit is contained in:
parent
f6337c7624
commit
f0ea7bcf9e
@ -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.
|
// 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.
|
// 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]
|
enabled, present := cfg.FeatureGates[features.IPv6DualStack]
|
||||||
|
@ -579,6 +579,31 @@ func TestGetControllerManagerCommand(t *testing.T) {
|
|||||||
cfg *kubeadmapi.ClusterConfiguration
|
cfg *kubeadmapi.ClusterConfiguration
|
||||||
expected []string
|
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,
|
name: "custom certs dir for " + cpVersion,
|
||||||
cfg: &kubeadmapi.ClusterConfiguration{
|
cfg: &kubeadmapi.ClusterConfiguration{
|
||||||
|
Loading…
Reference in New Issue
Block a user