diff --git a/apiserver/pkg/manager/resource_manager.go b/apiserver/pkg/manager/resource_manager.go index 44bf401082..7810c046cd 100644 --- a/apiserver/pkg/manager/resource_manager.go +++ b/apiserver/pkg/manager/resource_manager.go @@ -109,6 +109,10 @@ func (r *ResourceManager) GetCluster(ctx context.Context, clusterName string, na return nil, util.NewInvalidInputError("clusterName is empty, failed to get the cluster.") } + if len(namespace) == 0 { + namespace = DefaultNamespace + } + client := r.getRayClusterClient(namespace) return getClusterByName(ctx, client, clusterName) } @@ -133,6 +137,10 @@ func (r *ResourceManager) DeleteCluster(ctx context.Context, clusterName string, return util.NewInvalidInputError("clusterName is empty, failed to delete the cluster.") } + if len(namespace) == 0 { + namespace = DefaultNamespace + } + client := r.getRayClusterClient(namespace) cluster, err := getClusterByName(ctx, client, clusterName) if err != nil { diff --git a/apiserver/pkg/server/cluster_server.go b/apiserver/pkg/server/cluster_server.go index 88ce62bd56..682d582e20 100644 --- a/apiserver/pkg/server/cluster_server.go +++ b/apiserver/pkg/server/cluster_server.go @@ -80,10 +80,6 @@ func ValidateCreateClusterRequest(request *api.CreateClusterRequest) error { return util.NewInvalidInputError("User who create the cluster is empty. Please specify a valid value.") } - if request.Cluster.Namespace == "" { - return util.NewInvalidInputError("Namespace is empty. Please specify a valid value.") - } - if len(request.Cluster.ClusterSpec.HeadGroupSpec.ComputeTemplate) == 0 { return util.NewInvalidInputError("HeadGroupSpec compute template is empty. Please specify a valid value.") }