mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	Merge pull request #71803 from yagonobre/fix-init-bootstrap
Use kubeconfig flag instead of kubeconfig-dir in kubeadm init phase bootstrap-token
This commit is contained in:
		@@ -18,7 +18,6 @@ package phases
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
	"fmt"
 | 
						"fmt"
 | 
				
			||||||
	"path/filepath"
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/pkg/errors"
 | 
						"github.com/pkg/errors"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -26,7 +25,6 @@ import (
 | 
				
			|||||||
	kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
 | 
						kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
 | 
				
			||||||
	"k8s.io/kubernetes/cmd/kubeadm/app/cmd/options"
 | 
						"k8s.io/kubernetes/cmd/kubeadm/app/cmd/options"
 | 
				
			||||||
	"k8s.io/kubernetes/cmd/kubeadm/app/cmd/phases/workflow"
 | 
						"k8s.io/kubernetes/cmd/kubeadm/app/cmd/phases/workflow"
 | 
				
			||||||
	kubeadmconstants "k8s.io/kubernetes/cmd/kubeadm/app/constants"
 | 
					 | 
				
			||||||
	clusterinfophase "k8s.io/kubernetes/cmd/kubeadm/app/phases/bootstraptoken/clusterinfo"
 | 
						clusterinfophase "k8s.io/kubernetes/cmd/kubeadm/app/phases/bootstraptoken/clusterinfo"
 | 
				
			||||||
	nodebootstraptokenphase "k8s.io/kubernetes/cmd/kubeadm/app/phases/bootstraptoken/node"
 | 
						nodebootstraptokenphase "k8s.io/kubernetes/cmd/kubeadm/app/phases/bootstraptoken/node"
 | 
				
			||||||
	"k8s.io/kubernetes/pkg/util/normalizer"
 | 
						"k8s.io/kubernetes/pkg/util/normalizer"
 | 
				
			||||||
@@ -51,7 +49,7 @@ var (
 | 
				
			|||||||
type bootstrapTokenData interface {
 | 
					type bootstrapTokenData interface {
 | 
				
			||||||
	Cfg() *kubeadmapi.InitConfiguration
 | 
						Cfg() *kubeadmapi.InitConfiguration
 | 
				
			||||||
	Client() (clientset.Interface, error)
 | 
						Client() (clientset.Interface, error)
 | 
				
			||||||
	KubeConfigDir() string
 | 
						KubeConfigPath() string
 | 
				
			||||||
	SkipTokenPrint() bool
 | 
						SkipTokenPrint() bool
 | 
				
			||||||
	Tokens() []string
 | 
						Tokens() []string
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -66,7 +64,7 @@ func NewBootstrapTokenPhase() workflow.Phase {
 | 
				
			|||||||
		Long:    bootstrapTokenLongDesc,
 | 
							Long:    bootstrapTokenLongDesc,
 | 
				
			||||||
		InheritFlags: []string{
 | 
							InheritFlags: []string{
 | 
				
			||||||
			options.CfgPath,
 | 
								options.CfgPath,
 | 
				
			||||||
			options.KubeconfigDir,
 | 
								options.KubeconfigPath,
 | 
				
			||||||
			options.SkipTokenPrint,
 | 
								options.SkipTokenPrint,
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		Run: runBoostrapToken,
 | 
							Run: runBoostrapToken,
 | 
				
			||||||
@@ -113,8 +111,7 @@ func runBoostrapToken(c workflow.RunData) error {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Create the cluster-info ConfigMap with the associated RBAC rules
 | 
						// Create the cluster-info ConfigMap with the associated RBAC rules
 | 
				
			||||||
	adminKubeConfigPath := filepath.Join(data.KubeConfigDir(), kubeadmconstants.AdminKubeConfigFileName)
 | 
						if err := clusterinfophase.CreateBootstrapConfigMapIfNotExists(client, data.KubeConfigPath()); err != nil {
 | 
				
			||||||
	if err := clusterinfophase.CreateBootstrapConfigMapIfNotExists(client, adminKubeConfigPath); err != nil {
 | 
					 | 
				
			||||||
		return errors.Wrap(err, "error creating bootstrap ConfigMap")
 | 
							return errors.Wrap(err, "error creating bootstrap ConfigMap")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if err := clusterinfophase.CreateClusterInfoRBACRules(client); err != nil {
 | 
						if err := clusterinfophase.CreateClusterInfoRBACRules(client); err != nil {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user