@@ -213,7 +213,7 @@ func NewCmdJoin(out io.Writer, joinOptions *joinOptions) *cobra.Command {
213
213
// sets the data builder function, that will be used by the runner
214
214
// both when running the entire workflow or single phases
215
215
joinRunner .SetDataInitializer (func (cmd * cobra.Command , args []string ) (workflow.RunData , error ) {
216
- return newJoinData (cmd , args , joinOptions , out )
216
+ return newJoinData (cmd , args , joinOptions , out , kubeadmconstants . GetAdminKubeConfigPath () )
217
217
})
218
218
219
219
// binds the Runner to kubeadm join command by altering
@@ -315,7 +315,7 @@ func newJoinOptions() *joinOptions {
315
315
// newJoinData returns a new joinData struct to be used for the execution of the kubeadm join workflow.
316
316
// This func takes care of validating joinOptions passed to the command, and then it converts
317
317
// options into the internal JoinConfiguration type that is used as input all the phases in the kubeadm join workflow
318
- func newJoinData (cmd * cobra.Command , args []string , opt * joinOptions , out io.Writer ) (* joinData , error ) {
318
+ func newJoinData (cmd * cobra.Command , args []string , opt * joinOptions , out io.Writer , adminKubeConfigPath string ) (* joinData , error ) {
319
319
320
320
// Validate the mixed arguments with --config and return early on errors
321
321
if err := validation .ValidateMixedArguments (cmd .Flags ()); err != nil {
@@ -379,7 +379,6 @@ func newJoinData(cmd *cobra.Command, args []string, opt *joinOptions, out io.Wri
379
379
380
380
// if the admin.conf file already exists, use it for skipping the discovery process.
381
381
// NB. this case can happen when we are joining a control-plane node only (and phases are invoked atomically)
382
- var adminKubeConfigPath = kubeadmconstants .GetAdminKubeConfigPath ()
383
382
var tlsBootstrapCfg * clientcmdapi.Config
384
383
if _ , err := os .Stat (adminKubeConfigPath ); err == nil && opt .controlPlane {
385
384
// use the admin.conf as tlsBootstrapCfg, that is the kubeconfig file used for reading the kubeadm-config during discovery
0 commit comments