Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add label to RayCluster if owned by AppWrapper #771

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/codeflare_sdk/ray/cluster/build_ray_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def build_ray_cluster(cluster: "codeflare_sdk.ray.cluster.Cluster"):
# Metadata related functions
def get_metadata(cluster: "codeflare_sdk.ray.cluster.Cluster"):
"""
The get_metadata() function builds and returns a V1ObjectMeta Object using cluster configurtation parameters
The get_metadata() function builds and returns a V1ObjectMeta Object using cluster configuration parameters
"""
object_meta = V1ObjectMeta(
name=cluster.config.name,
Expand All @@ -207,6 +207,9 @@ def get_labels(cluster: "codeflare_sdk.ray.cluster.Cluster"):
if cluster.config.labels != {}:
labels.update(cluster.config.labels)

if cluster.config.appwrapper is True:
labels.update({"resource.owner": "appwrapper"})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would we do better with app.kubernetes.io/managed-by: appwrapper?
Seems to be the recommended labeling scheme


if cluster.config.appwrapper is False:
add_queue_label(cluster, labels)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ spec:
controller-tools.k8s.io: '1.0'
key1: value1
key2: value2
resource.owner: appwrapper
name: aw-all-params
namespace: ns
spec:
Expand Down
1 change: 1 addition & 0 deletions tests/test_cluster_yamls/kueue/aw_kueue.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ spec:
metadata:
labels:
controller-tools.k8s.io: '1.0'
resource.owner: appwrapper
name: unit-test-aw-kueue
namespace: ns
spec:
Expand Down
1 change: 1 addition & 0 deletions tests/test_cluster_yamls/kueue/ray_cluster_kueue.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ spec:
metadata:
labels:
controller-tools.k8s.io: '1.0'
resource.owner: appwrapper
name: unit-test-cluster-kueue
namespace: ns
spec:
Expand Down
1 change: 1 addition & 0 deletions tests/test_cluster_yamls/ray/default-appwrapper.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ spec:
metadata:
labels:
controller-tools.k8s.io: '1.0'
resource.owner: appwrapper
name: default-appwrapper
namespace: ns
spec:
Expand Down