Skip to content

Commit

Permalink
Merge pull request #71817 from yagonobre/automated-cherry-pick-of-#71…
Browse files Browse the repository at this point in the history
…803-upstream-release-1.13

Automated cherry pick of #71803: Use kubeconfig flag instead of kubeconfig-dir in kubeadm init
  • Loading branch information
k8s-ci-robot committed Dec 10, 2018
2 parents c213003 + 90783e7 commit 99078be
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions cmd/kubeadm/app/cmd/phases/bootstraptoken.go
Original file line number Diff line number Diff line change
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 99078be

Please sign in to comment.