diff --git a/pkg/multicloud/aliyun/aliyun.go b/pkg/multicloud/aliyun/aliyun.go index dcc8dcbe4e..f826c3ff0b 100644 --- a/pkg/multicloud/aliyun/aliyun.go +++ b/pkg/multicloud/aliyun/aliyun.go @@ -169,6 +169,13 @@ func jsonRequest(client *sdk.Client, domain, apiVersion, apiName string, params resp, err = _jsonRequest(client, domain, apiVersion, apiName, params) retry := false if err != nil { + for _, code := range []string{ + "ErrorClusterNotFound", + } { + if strings.Contains(err.Error(), code) { + return nil, errors.Wrap(cloudprovider.ErrNotFound, err.Error()) + } + } if e, ok := errors.Cause(err).(*alierr.ServerError); ok { code := e.ErrorCode() switch code { diff --git a/pkg/multicloud/aliyun/shell/kube_cluster.go b/pkg/multicloud/aliyun/shell/kube_cluster.go index c70b378827..069bd6ff86 100644 --- a/pkg/multicloud/aliyun/shell/kube_cluster.go +++ b/pkg/multicloud/aliyun/shell/kube_cluster.go @@ -37,6 +37,15 @@ func init() { ID string } + shellutils.R(&KubeClusterIdOptions{}, "kube-cluster-show", "Show kube cluster", func(cli *aliyun.SRegion, args *KubeClusterIdOptions) error { + cluster, err := cli.GetKubeCluster(args.ID) + if err != nil { + return err + } + printObject(cluster) + return nil + }) + shellutils.R(&KubeClusterIdOptions{}, "kube-cluster-delete", "Delete kube cluster", func(cli *aliyun.SRegion, args *KubeClusterIdOptions) error { return cli.DeleteKubeCluster(args.ID, false) })