kubeadm: use "SkipPhases" from configuration for "init" and "join"

During Runner data initialization, if the value for the flag
"--skip-phases" was empty set the {init|join}Runner.Options.SkipPhases
to the {Init|Join}Configuration.SkipPhases value.
This commit is contained in:
Lubomir I. Ivanov 2021-05-12 00:35:48 +03:00
parent ac161866aa
commit 24a1f9d817
2 changed files with 18 additions and 2 deletions

View File

@ -192,7 +192,15 @@ func newCmdInit(out io.Writer, initOptions *initOptions) *cobra.Command {
// sets the data builder function, that will be used by the runner
// both when running the entire workflow or single phases
initRunner.SetDataInitializer(func(cmd *cobra.Command, args []string) (workflow.RunData, error) {
return newInitData(cmd, args, initOptions, out)
data, err := newInitData(cmd, args, initOptions, out)
if err != nil {
return nil, err
}
// If the flag for skipping phases was empty, use the values from config
if len(initRunner.Options.SkipPhases) == 0 {
initRunner.Options.SkipPhases = data.cfg.SkipPhases
}
return data, nil
})
// binds the Runner to kubeadm init command by altering

View File

@ -213,7 +213,15 @@ func newCmdJoin(out io.Writer, joinOptions *joinOptions) *cobra.Command {
// sets the data builder function, that will be used by the runner
// both when running the entire workflow or single phases
joinRunner.SetDataInitializer(func(cmd *cobra.Command, args []string) (workflow.RunData, error) {
return newJoinData(cmd, args, joinOptions, out, kubeadmconstants.GetAdminKubeConfigPath())
data, err := newJoinData(cmd, args, joinOptions, out, kubeadmconstants.GetAdminKubeConfigPath())
if err != nil {
return nil, err
}
// If the flag for skipping phases was empty, use the values from config
if len(joinRunner.Options.SkipPhases) == 0 {
joinRunner.Options.SkipPhases = data.cfg.SkipPhases
}
return data, nil
})
// binds the Runner to kubeadm join command by altering