Skip to content

Commit

Permalink
Merge pull request #71803 from yagonobre/fix-init-bootstrap
Browse files Browse the repository at this point in the history
Use kubeconfig flag instead of kubeconfig-dir in kubeadm init phase bootstrap-token
  • Loading branch information
k8s-ci-robot committed Dec 6, 2018
2 parents 257a6d5 + 05e5a34 commit fa0ef74
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions cmd/kubeadm/app/cmd/phases/bootstraptoken.go
Expand Up @@ -18,15 +18,13 @@ package phases

import (
"fmt"
"path/filepath"

"github.com/pkg/errors"

clientset "k8s.io/client-go/kubernetes"
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
"k8s.io/kubernetes/cmd/kubeadm/app/cmd/options"
"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"
nodebootstraptokenphase "k8s.io/kubernetes/cmd/kubeadm/app/phases/bootstraptoken/node"
"k8s.io/kubernetes/pkg/util/normalizer"
Expand All @@ -51,7 +49,7 @@ var (
type bootstrapTokenData interface {
Cfg() *kubeadmapi.InitConfiguration
Client() (clientset.Interface, error)
KubeConfigDir() string
KubeConfigPath() string
SkipTokenPrint() bool
Tokens() []string
}
Expand All @@ -66,7 +64,7 @@ func NewBootstrapTokenPhase() workflow.Phase {
Long: bootstrapTokenLongDesc,
InheritFlags: []string{
options.CfgPath,
options.KubeconfigDir,
options.KubeconfigPath,
options.SkipTokenPrint,
},
Run: runBoostrapToken,
Expand Down Expand Up @@ -113,8 +111,7 @@ func runBoostrapToken(c workflow.RunData) error {
}

// Create the cluster-info ConfigMap with the associated RBAC rules
adminKubeConfigPath := filepath.Join(data.KubeConfigDir(), kubeadmconstants.AdminKubeConfigFileName)
if err := clusterinfophase.CreateBootstrapConfigMapIfNotExists(client, adminKubeConfigPath); err != nil {
if err := clusterinfophase.CreateBootstrapConfigMapIfNotExists(client, data.KubeConfigPath()); err != nil {
return errors.Wrap(err, "error creating bootstrap ConfigMap")
}
if err := clusterinfophase.CreateClusterInfoRBACRules(client); err != nil {
Expand Down

0 comments on commit fa0ef74

Please sign in to comment.