Skip to content

Commit c08cac1

Browse files
Addressing comments
1 parent e91f6aa commit c08cac1

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

src/codeflare_sdk/templates/base-template.yaml

-5
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,6 @@ spec:
121121
valueFrom:
122122
fieldRef:
123123
fieldPath: status.podIP
124-
- name: COOKIE_SECRET
125-
valueFrom:
126-
secretKeyRef:
127-
key: cookie_secret
128-
name: jobtest-oauth-config
129124
- name: RAY_USE_TLS
130125
value: "0"
131126
- name: RAY_TLS_SERVER_CERT

src/codeflare_sdk/utils/generate_yaml.py

+13-7
Original file line numberDiff line numberDiff line change
@@ -230,12 +230,18 @@ def update_names(yaml, item, appwrapper_name, cluster_name, namespace, openshift
230230
lower_meta["namespace"] = namespace
231231
lower_spec = item.get("generictemplate", {}).get("spec")
232232
if openshift_oauth:
233-
lower_spec["headGroupSpec"]["template"]["spec"]["containers"][0]["env"][1][
234-
"valueFrom"
235-
]["secretKeyRef"]["name"] = f"{cluster_name}-oauth-config"
236-
if not openshift_oauth:
237-
del lower_spec["headGroupSpec"]["template"]["spec"]["containers"][0]["env"][1]
238-
233+
cookie_secret_env_var = {
234+
"name": "COOKIE_SECRET",
235+
"valueFrom": {
236+
"secretKeyRef": {
237+
"key": "cookie_secret",
238+
"name": f"{cluster_name}-oauth-config",
239+
}
240+
}
241+
}
242+
lower_spec["headGroupSpec"]["template"]["spec"]["containers"][0]["env"].append(
243+
cookie_secret_env_var
244+
)
239245

240246
def update_labels(yaml, instascale, instance_types):
241247
metadata = yaml.get("metadata")
@@ -443,7 +449,7 @@ def enable_local_interactive(resources, cluster_name, namespace, ingress_domain)
443449
# update_tls_env
444450
item["generictemplate"]["spec"]["headGroupSpec"]["template"]["spec"]["containers"][
445451
0
446-
]["env"][2]["value"] = "1"
452+
]["env"][1]["value"] = "1"
447453
item["generictemplate"]["spec"]["workerGroupSpecs"][0]["template"]["spec"][
448454
"containers"
449455
][0]["env"][1]["value"] = "1"

tests/unit_test.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -2793,11 +2793,11 @@ def test_enable_local_interactive(mocker):
27932793
# 3. Required Envs to enable TLS encryption between head and workers
27942794
for i in range(len(tls_env)):
27952795
assert (
2796-
head_group_spec["template"]["spec"]["containers"][0]["env"][i + 2]["name"]
2796+
head_group_spec["template"]["spec"]["containers"][0]["env"][i + 1]["name"]
27972797
== tls_env[i]["name"]
27982798
)
27992799
assert (
2800-
head_group_spec["template"]["spec"]["containers"][0]["env"][i + 2]["value"]
2800+
head_group_spec["template"]["spec"]["containers"][0]["env"][i + 1]["value"]
28012801
== tls_env[i]["value"]
28022802
)
28032803
assert (

0 commit comments

Comments
 (0)