Skip to content

Commit

Permalink
Add default namespace for get and delete ops
Browse files Browse the repository at this point in the history
  • Loading branch information
daikeshi committed Apr 20, 2022
1 parent 987d62b commit 880ad72
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 8 additions & 0 deletions apiserver/pkg/manager/resource_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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 {
Expand Down
4 changes: 0 additions & 4 deletions apiserver/pkg/server/cluster_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
}
Expand Down

0 comments on commit 880ad72

Please sign in to comment.