Skip to content

Commit 03737c8

Browse files
Addressing comments
1 parent e91f6aa commit 03737c8

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

Diff for: 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

Diff for: src/codeflare_sdk/utils/generate_yaml.py

+13-6
Original file line numberDiff line numberDiff line change
@@ -230,11 +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]
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+
)
238245

239246

240247
def update_labels(yaml, instascale, instance_types):
@@ -443,7 +450,7 @@ def enable_local_interactive(resources, cluster_name, namespace, ingress_domain)
443450
# update_tls_env
444451
item["generictemplate"]["spec"]["headGroupSpec"]["template"]["spec"]["containers"][
445452
0
446-
]["env"][2]["value"] = "1"
453+
]["env"][1]["value"] = "1"
447454
item["generictemplate"]["spec"]["workerGroupSpecs"][0]["template"]["spec"][
448455
"containers"
449456
][0]["env"][1]["value"] = "1"

Diff for: 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)