Fix type assertion error in init and join commands for kubeadm

Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
yxxhero 2024-01-14 12:20:34 +08:00
parent 12fc215656
commit d21fc96db3
2 changed files with 9 additions and 2 deletions

View File

@ -118,7 +118,11 @@ func newCmdInit(out io.Writer, initOptions *initOptions) *cobra.Command {
return err
}
data := c.(*initData)
data, ok := c.(*initData)
if !ok {
return errors.New("invalid data struct")
}
fmt.Printf("[init] Using Kubernetes version: %s\n", data.cfg.KubernetesVersion)
return initRunner.Run(args)

View File

@ -175,7 +175,10 @@ func newCmdJoin(out io.Writer, joinOptions *joinOptions) *cobra.Command {
return err
}
data := c.(*joinData)
data, ok := c.(*joinData)
if !ok {
return errors.New("invalid data struct")
}
if err := joinRunner.Run(args); err != nil {
return err