diff --git a/cmd/kubeadm/app/constants/constants.go b/cmd/kubeadm/app/constants/constants.go index 2f0d30bd488..1631fe1b6a6 100644 --- a/cmd/kubeadm/app/constants/constants.go +++ b/cmd/kubeadm/app/constants/constants.go @@ -146,8 +146,11 @@ const ( // FrontProxyClientCertCommonName defines front proxy certificate common name FrontProxyClientCertCommonName = "front-proxy-client" //used as subject.commonname attribute (CN) - // AdminKubeConfigFileName defines name for the kubeconfig aimed to be used by the superuser/admin of the cluster + // AdminKubeConfigFileName defines name for the kubeconfig aimed to be used by the admin of the cluster AdminKubeConfigFileName = "admin.conf" + // SuperAdminKubeConfigFileName defines name for the kubeconfig aimed to be used by the super-admin of the cluster + SuperAdminKubeConfigFileName = "super-admin.conf" + // KubeletBootstrapKubeConfigFileName defines the file name for the kubeconfig that the kubelet will use to do // the TLS bootstrap to get itself an unique credential KubeletBootstrapKubeConfigFileName = "bootstrap-kubelet.conf" @@ -201,6 +204,10 @@ const ( NodeAutoApproveBootstrapClusterRoleBinding = "kubeadm:node-autoapprove-bootstrap" // NodeAutoApproveCertificateRotationClusterRoleBinding defines name of the ClusterRoleBinding that makes the csrapprover approve node auto rotated CSRs NodeAutoApproveCertificateRotationClusterRoleBinding = "kubeadm:node-autoapprove-certificate-rotation" + // ClusterAdminsGroupAndClusterRoleBinding is the name of the Group used for kubeadm generated cluster + // admin credentials and the name of the ClusterRoleBinding that binds the same Group to the "cluster-admin" + // built-in ClusterRole. + ClusterAdminsGroupAndClusterRoleBinding = "kubeadm:cluster-admins" // APICallRetryInterval defines how long kubeadm should wait before retrying a failed API operation APICallRetryInterval = 500 * time.Millisecond @@ -570,6 +577,11 @@ func GetAdminKubeConfigPath() string { return filepath.Join(KubernetesDir, AdminKubeConfigFileName) } +// GetSuperAdminKubeConfigPath returns the location on the disk where admin kubeconfig is located by default +func GetSuperAdminKubeConfigPath() string { + return filepath.Join(KubernetesDir, SuperAdminKubeConfigFileName) +} + // GetBootstrapKubeletKubeConfigPath returns the location on the disk where bootstrap kubelet kubeconfig is located by default func GetBootstrapKubeletKubeConfigPath() string { return filepath.Join(KubernetesDir, KubeletBootstrapKubeConfigFileName) diff --git a/cmd/kubeadm/app/constants/constants_test.go b/cmd/kubeadm/app/constants/constants_test.go index 3b1dabb3912..bc33346a8d2 100644 --- a/cmd/kubeadm/app/constants/constants_test.go +++ b/cmd/kubeadm/app/constants/constants_test.go @@ -50,6 +50,19 @@ func TestGetAdminKubeConfigPath(t *testing.T) { } } +func TestGetSuperAdminKubeConfigPath(t *testing.T) { + expected := filepath.Join(KubernetesDir, SuperAdminKubeConfigFileName) + actual := GetSuperAdminKubeConfigPath() + + if actual != expected { + t.Errorf( + "failed GetSuperAdminKubeConfigPath:\n\texpected: %s\n\t actual: %s", + expected, + actual, + ) + } +} + func TestGetBootstrapKubeletKubeConfigPath(t *testing.T) { expected := filepath.FromSlash("/etc/kubernetes/bootstrap-kubelet.conf") actual := GetBootstrapKubeletKubeConfigPath()