Fix: vela status --endpoint show no IP when only one master node

Add fallback if no worker node

check app exist

Signed-off-by: Qiaozp <qiaozhongpei.qzp@alibaba-inc.com>
This commit is contained in:
Qiaozp
2022-11-29 18:30:51 +08:00
parent 191dbcc58d
commit 7af0a67dee
4 changed files with 151 additions and 39 deletions
+10 -4
View File
@@ -143,8 +143,18 @@ func NewAppStatusCommand(c common.Args, order string, ioStreams cmdutil.IOStream
}
return printAppPods(appName, namespace, f, c)
}
newClient, err := c.GetClient()
if err != nil {
return err
}
showEndpoints, err := cmd.Flags().GetBool("endpoint")
if showEndpoints && err == nil {
_, err := loadRemoteApplication(newClient, namespace, appName)
if err != nil {
return err
}
component, _ := cmd.Flags().GetString("component")
cluster, _ := cmd.Flags().GetString("cluster")
f := Filter{
@@ -153,10 +163,6 @@ func NewAppStatusCommand(c common.Args, order string, ioStreams cmdutil.IOStream
}
return printAppEndpoints(ctx, appName, namespace, f, c, false)
}
newClient, err := c.GetClient()
if err != nil {
return err
}
if outputFormat != "" {
return printRawApplication(context.Background(), c, outputFormat, cmd.OutOrStdout(), namespace, appName)
}