kubeadm: try to reuse RunData if possible

The generation of `RunData` for init and join is relative time consuming,
the data should be shared / reused whenever possible.

Signed-off-by: Dave Chen <dave.chen@arm.com>
This commit is contained in:
Dave Chen 2022-09-20 18:07:18 +08:00
parent cba0dcecc9
commit 41b8536a50

View File

@ -221,11 +221,13 @@ func (e *Runner) Run(args []string) error {
return errors.New(msg.String())
}
// builds the runner data
var data RunData
// builds the runner data if the runtime data is not initialized
data := e.runData
if data == nil {
if data, err = e.InitData(args); err != nil {
return err
}
}
err = e.visitAll(func(p *phaseRunner) error {
// if the phase should not be run, skip the phase.