Skip to content

Commit 41b8536

Browse files
committed
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 <[email protected]>
1 parent cba0dce commit 41b8536

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

cmd/kubeadm/app/cmd/phases/workflow/runner.go

+6-4
Original file line numberDiff line numberDiff line change
@@ -221,10 +221,12 @@ func (e *Runner) Run(args []string) error {
221221
return errors.New(msg.String())
222222
}
223223

224-
// builds the runner data
225-
var data RunData
226-
if data, err = e.InitData(args); err != nil {
227-
return err
224+
// builds the runner data if the runtime data is not initialized
225+
data := e.runData
226+
if data == nil {
227+
if data, err = e.InitData(args); err != nil {
228+
return err
229+
}
228230
}
229231

230232
err = e.visitAll(func(p *phaseRunner) error {

0 commit comments

Comments
 (0)