From 5db0c61788dab5db635d86961630b72d2006280e Mon Sep 17 00:00:00 2001 From: "Lubomir I. Ivanov" Date: Wed, 20 Feb 2019 03:53:44 +0200 Subject: [PATCH] kubeadm/join: expose the KubeConfigPath() method to joinData This fixes the following error: "error execution phase control-plane-join/etcd: control-plane-join phase invoked with an invalid data struct" The problem here is that joinData cannot be type-asserted to the interface type under controlplanejoin.go (controlPlaneJoinData) because joinData lacks KubeConfigPath. Given we use KubeConfigPath in more than one place for join it makes sense to define define the method and make it return: kubeadmconstants.GetAdminKubeConfigPath() --- cmd/kubeadm/app/cmd/join.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cmd/kubeadm/app/cmd/join.go b/cmd/kubeadm/app/cmd/join.go index 2f6de07d9a..fdb44537c2 100644 --- a/cmd/kubeadm/app/cmd/join.go +++ b/cmd/kubeadm/app/cmd/join.go @@ -173,7 +173,7 @@ func NewCmdJoin(out io.Writer, joinOptions *joinOptions) *cobra.Command { } ctx := map[string]string{ - "KubeConfigPath": kubeadmconstants.GetAdminKubeConfigPath(), + "KubeConfigPath": data.KubeConfigPath(), "etcdMessage": etcdMessage, } joinControPlaneDoneTemp.Execute(data.outputWriter, ctx) @@ -380,6 +380,11 @@ func (j *joinData) Cfg() *kubeadmapi.JoinConfiguration { return j.cfg } +// KubeConfigPath returns the default kubeconfig path. +func (j *joinData) KubeConfigPath() string { + return kubeadmconstants.GetAdminKubeConfigPath() +} + // TLSBootstrapCfg returns the cluster-info (kubeconfig). func (j *joinData) TLSBootstrapCfg() (*clientcmdapi.Config, error) { if j.tlsBootstrapCfg != nil {