Skip to content

Commit 4cef42e

Browse files
Ygnasopenshift-merge-bot[bot]
authored andcommitted
Add notebook prefix annotation to RayCluster
1 parent eb643ca commit 4cef42e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/codeflare_sdk/utils/generate_yaml.py

+12
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,17 @@ def augment_labels(item: dict, labels: dict):
246246
item["template"]["metadata"]["labels"].update(labels)
247247

248248

249+
def notebook_annotations(item: dict):
250+
nb_prefix = os.environ.get("NB_PREFIX")
251+
if nb_prefix:
252+
if "template" in item:
253+
if not "annotations" in item["template"]["metadata"]:
254+
item["template"]["metadata"]["annotations"] = {}
255+
item["template"]["metadata"]["annotations"].update(
256+
{"app.kubernetes.io/managed-by": nb_prefix}
257+
)
258+
259+
249260
def write_components(
250261
user_yaml: dict,
251262
output_file_name: str,
@@ -341,6 +352,7 @@ def generate_appwrapper(
341352
)
342353

343354
augment_labels(item, labels)
355+
notebook_annotations(item)
344356

345357
if appwrapper:
346358
add_queue_label(user_yaml, namespace, local_queue)

0 commit comments

Comments
 (0)