Skip to content

Commit

Permalink
Add notebook prefix annotation to RayCluster
Browse files Browse the repository at this point in the history
  • Loading branch information
Ygnas authored and openshift-merge-bot[bot] committed Jun 11, 2024
1 parent eb643ca commit 4cef42e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/codeflare_sdk/utils/generate_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,17 @@ def augment_labels(item: dict, labels: dict):
item["template"]["metadata"]["labels"].update(labels)


def notebook_annotations(item: dict):
nb_prefix = os.environ.get("NB_PREFIX")
if nb_prefix:
if "template" in item:
if not "annotations" in item["template"]["metadata"]:
item["template"]["metadata"]["annotations"] = {}
item["template"]["metadata"]["annotations"].update(
{"app.kubernetes.io/managed-by": nb_prefix}
)


def write_components(
user_yaml: dict,
output_file_name: str,
Expand Down Expand Up @@ -341,6 +352,7 @@ def generate_appwrapper(
)

augment_labels(item, labels)
notebook_annotations(item)

if appwrapper:
add_queue_label(user_yaml, namespace, local_queue)
Expand Down

0 comments on commit 4cef42e

Please sign in to comment.