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()
This commit is contained in:
Lubomir I. Ivanov 2019-02-20 03:53:44 +02:00
parent e1b8cb515c
commit 5db0c61788

View File

@ -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 {