mirror of https://github.com/k3s-io/k3s
Change to [bootstrap-token] in kubeadm output
In output of "kubeadm init", there are two strings for meaning of bootstrap token which are "bootstraptoken" and "bootstrap-token". This changes `[bootstraptoken]` to `[bootstrap-token]`.pull/564/head
parent
a5d55f49b0
commit
4a3b990bbe
|
@ -41,9 +41,9 @@ const (
|
||||||
// CreateBootstrapConfigMapIfNotExists creates the kube-public ConfigMap if it doesn't exist already
|
// CreateBootstrapConfigMapIfNotExists creates the kube-public ConfigMap if it doesn't exist already
|
||||||
func CreateBootstrapConfigMapIfNotExists(client clientset.Interface, file string) error {
|
func CreateBootstrapConfigMapIfNotExists(client clientset.Interface, file string) error {
|
||||||
|
|
||||||
fmt.Printf("[bootstraptoken] creating the %q ConfigMap in the %q namespace\n", bootstrapapi.ConfigMapClusterInfo, metav1.NamespacePublic)
|
fmt.Printf("[bootstrap-token] creating the %q ConfigMap in the %q namespace\n", bootstrapapi.ConfigMapClusterInfo, metav1.NamespacePublic)
|
||||||
|
|
||||||
klog.V(1).Infoln("[bootstraptoken] loading admin kubeconfig")
|
klog.V(1).Infoln("[bootstrap-token] loading admin kubeconfig")
|
||||||
adminConfig, err := clientcmd.LoadFromFile(file)
|
adminConfig, err := clientcmd.LoadFromFile(file)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "failed to load admin kubeconfig")
|
return errors.Wrap(err, "failed to load admin kubeconfig")
|
||||||
|
@ -51,7 +51,7 @@ func CreateBootstrapConfigMapIfNotExists(client clientset.Interface, file string
|
||||||
|
|
||||||
adminCluster := adminConfig.Contexts[adminConfig.CurrentContext].Cluster
|
adminCluster := adminConfig.Contexts[adminConfig.CurrentContext].Cluster
|
||||||
// Copy the cluster from admin.conf to the bootstrap kubeconfig, contains the CA cert and the server URL
|
// Copy the cluster from admin.conf to the bootstrap kubeconfig, contains the CA cert and the server URL
|
||||||
klog.V(1).Infoln("[bootstraptoken] copying the cluster from admin.conf to the bootstrap kubeconfig")
|
klog.V(1).Infoln("[bootstrap-token] copying the cluster from admin.conf to the bootstrap kubeconfig")
|
||||||
bootstrapConfig := &clientcmdapi.Config{
|
bootstrapConfig := &clientcmdapi.Config{
|
||||||
Clusters: map[string]*clientcmdapi.Cluster{
|
Clusters: map[string]*clientcmdapi.Cluster{
|
||||||
"": adminConfig.Clusters[adminCluster],
|
"": adminConfig.Clusters[adminCluster],
|
||||||
|
@ -63,7 +63,7 @@ func CreateBootstrapConfigMapIfNotExists(client clientset.Interface, file string
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create or update the ConfigMap in the kube-public namespace
|
// Create or update the ConfigMap in the kube-public namespace
|
||||||
klog.V(1).Infoln("[bootstraptoken] creating/updating ConfigMap in kube-public namespace")
|
klog.V(1).Infoln("[bootstrap-token] creating/updating ConfigMap in kube-public namespace")
|
||||||
return apiclient.CreateOrUpdateConfigMap(client, &v1.ConfigMap{
|
return apiclient.CreateOrUpdateConfigMap(client, &v1.ConfigMap{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: bootstrapapi.ConfigMapClusterInfo,
|
Name: bootstrapapi.ConfigMapClusterInfo,
|
||||||
|
|
|
@ -47,7 +47,7 @@ const (
|
||||||
|
|
||||||
// AllowBootstrapTokensToPostCSRs creates RBAC rules in a way the makes Node Bootstrap Tokens able to post CSRs
|
// AllowBootstrapTokensToPostCSRs creates RBAC rules in a way the makes Node Bootstrap Tokens able to post CSRs
|
||||||
func AllowBootstrapTokensToPostCSRs(client clientset.Interface) error {
|
func AllowBootstrapTokensToPostCSRs(client clientset.Interface) error {
|
||||||
fmt.Println("[bootstraptoken] configured RBAC rules to allow Node Bootstrap tokens to post CSRs in order for nodes to get long term certificate credentials")
|
fmt.Println("[bootstrap-token] configured RBAC rules to allow Node Bootstrap tokens to post CSRs in order for nodes to get long term certificate credentials")
|
||||||
|
|
||||||
return apiclient.CreateOrUpdateClusterRoleBinding(client, &rbac.ClusterRoleBinding{
|
return apiclient.CreateOrUpdateClusterRoleBinding(client, &rbac.ClusterRoleBinding{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
|
@ -69,7 +69,7 @@ func AllowBootstrapTokensToPostCSRs(client clientset.Interface) error {
|
||||||
|
|
||||||
// AutoApproveNodeBootstrapTokens creates RBAC rules in a way that makes Node Bootstrap Tokens' CSR auto-approved by the csrapprover controller
|
// AutoApproveNodeBootstrapTokens creates RBAC rules in a way that makes Node Bootstrap Tokens' CSR auto-approved by the csrapprover controller
|
||||||
func AutoApproveNodeBootstrapTokens(client clientset.Interface) error {
|
func AutoApproveNodeBootstrapTokens(client clientset.Interface) error {
|
||||||
fmt.Println("[bootstraptoken] configured RBAC rules to allow the csrapprover controller automatically approve CSRs from a Node Bootstrap Token")
|
fmt.Println("[bootstrap-token] configured RBAC rules to allow the csrapprover controller automatically approve CSRs from a Node Bootstrap Token")
|
||||||
|
|
||||||
// Always create this kubeadm-specific binding though
|
// Always create this kubeadm-specific binding though
|
||||||
return apiclient.CreateOrUpdateClusterRoleBinding(client, &rbac.ClusterRoleBinding{
|
return apiclient.CreateOrUpdateClusterRoleBinding(client, &rbac.ClusterRoleBinding{
|
||||||
|
@ -92,7 +92,7 @@ func AutoApproveNodeBootstrapTokens(client clientset.Interface) error {
|
||||||
|
|
||||||
// AutoApproveNodeCertificateRotation creates RBAC rules in a way that makes Node certificate rotation CSR auto-approved by the csrapprover controller
|
// AutoApproveNodeCertificateRotation creates RBAC rules in a way that makes Node certificate rotation CSR auto-approved by the csrapprover controller
|
||||||
func AutoApproveNodeCertificateRotation(client clientset.Interface) error {
|
func AutoApproveNodeCertificateRotation(client clientset.Interface) error {
|
||||||
fmt.Println("[bootstraptoken] configured RBAC rules to allow certificate rotation for all node client certificates in the cluster")
|
fmt.Println("[bootstrap-token] configured RBAC rules to allow certificate rotation for all node client certificates in the cluster")
|
||||||
|
|
||||||
return apiclient.CreateOrUpdateClusterRoleBinding(client, &rbac.ClusterRoleBinding{
|
return apiclient.CreateOrUpdateClusterRoleBinding(client, &rbac.ClusterRoleBinding{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
|
|
Loading…
Reference in New Issue