Skip to content

Commit 46822a2

Browse files
odh configmap configuration to default template
I also changed the removal of raycluster tls objects so it is done by name rather than all at once Signed-off-by: Kevin <kpostlet@redhat.com>
1 parent ca5b198 commit 46822a2

File tree

2 files changed

+73
-21
lines changed

2 files changed

+73
-21
lines changed

src/codeflare_sdk/templates/base-template.yaml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,18 @@ spec:
157157
- name: server-cert
158158
mountPath: "/home/ray/workspace/tls"
159159
readOnly: true
160+
- mountPath: /etc/pki/tls/certs
161+
name: odh-trusted-ca-cert
162+
subPath: odh-trusted-ca-bundle.crt
163+
- mountPath: /etc/ssl/certs
164+
name: odh-trusted-ca-cert
165+
subPath: odh-trusted-ca-bundle.crt
166+
- mountPath: /etc/pki/tls/certs
167+
name: odh-ca-cert
168+
subPath: odh-ca-bundle.crt
169+
- mountPath: /etc/ssl/certs
170+
name: odh-ca-cert
171+
subPath: odh-ca-bundle.crt
160172
initContainers:
161173
- command:
162174
- sh
@@ -181,6 +193,20 @@ spec:
181193
optional: false
182194
- name: server-cert
183195
emptyDir: {}
196+
- name: odh-trusted-ca-cert
197+
configMap:
198+
name: odh-trusted-ca-bundle
199+
items:
200+
- key: ca-bundle.crt
201+
path: odh-custom-ca-bundle.crt
202+
optional: true
203+
- name: odh-ca-cert
204+
configMap:
205+
name: odh-trusted-ca-bundle
206+
items:
207+
- key: odh-ca-bundle.crt
208+
path: odh-ca-bundle.crt
209+
optional: true
184210
workerGroupSpecs:
185211
# the pod replicas in this group typed worker
186212
- replicas: 3
@@ -277,13 +303,39 @@ spec:
277303
- name: server-cert
278304
mountPath: "/home/ray/workspace/tls"
279305
readOnly: true
306+
- mountPath: /etc/pki/tls/certs
307+
name: odh-trusted-ca-cert
308+
subPath: odh-trusted-ca-bundle.crt
309+
- mountPath: /etc/ssl/certs
310+
name: odh-trusted-ca-cert
311+
subPath: odh-trusted-ca-bundle.crt
312+
- mountPath: /etc/pki/tls/certs
313+
name: odh-ca-cert
314+
subPath: odh-ca-bundle.crt
315+
- mountPath: /etc/ssl/certs
316+
name: odh-ca-cert
317+
subPath: odh-ca-bundle.crt
280318
volumes:
281319
- name: ca-vol
282320
secret:
283321
secretName: ca-secret-deployment-name
284322
optional: false
285323
- name: server-cert
286324
emptyDir: {}
325+
- name: odh-trusted-ca-cert
326+
configMap:
327+
name: odh-trusted-ca-bundle
328+
items:
329+
- key: ca-bundle.crt
330+
path: odh-custom-ca-bundle.crt
331+
optional: true
332+
- name: odh-ca-cert
333+
configMap:
334+
name: odh-trusted-ca-bundle
335+
items:
336+
- key: odh-ca-bundle.crt
337+
path: odh-ca-bundle.crt
338+
optional: true
287339
- replicas: 1
288340
generictemplate:
289341
apiVersion: networking.k8s.io/v1

src/codeflare_sdk/utils/generate_yaml.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
(in the cluster sub-module) for AppWrapper generation.
1818
"""
1919

20+
import typing
2021
import yaml
2122
import sys
2223
import os
@@ -466,35 +467,34 @@ def enable_local_interactive(resources, cluster_name, namespace, ingress_domain)
466467
][0].get("command")[2] = command
467468

468469

470+
def del_from_list_by_name(l: list, target: typing.List[str]):
471+
for item in l:
472+
if item["name"] in ["ca-vol", "server-cert"]:
473+
l.remove(item)
474+
475+
469476
def disable_raycluster_tls(resources):
470477
generic_template_spec = resources["GenericItems"][0]["generictemplate"]["spec"]
471478

472-
if "volumes" in generic_template_spec["headGroupSpec"]["template"]["spec"]:
473-
del generic_template_spec["headGroupSpec"]["template"]["spec"]["volumes"]
479+
del_from_list_by_name(
480+
generic_template_spec["headGroupSpec"]["template"]["spec"].get("volumes", []),
481+
["ca-vol", "server-cert"],
482+
)
474483

475-
if (
476-
"volumeMounts"
477-
in generic_template_spec["headGroupSpec"]["template"]["spec"]["containers"][0]
478-
):
479-
del generic_template_spec["headGroupSpec"]["template"]["spec"]["containers"][0][
480-
"volumeMounts"
481-
]
484+
c: dict
485+
for c in generic_template_spec["headGroupSpec"]["template"]["spec"]["containers"]:
486+
del_from_list_by_name(c.get("volumeMounts", []), ["ca-vol", "server-cert"])
482487

483488
if "initContainers" in generic_template_spec["headGroupSpec"]["template"]["spec"]:
484489
del generic_template_spec["headGroupSpec"]["template"]["spec"]["initContainers"]
485490

486-
if "volumes" in generic_template_spec["workerGroupSpecs"][0]["template"]["spec"]:
487-
del generic_template_spec["workerGroupSpecs"][0]["template"]["spec"]["volumes"]
488-
489-
if (
490-
"volumeMounts"
491-
in generic_template_spec["workerGroupSpecs"][0]["template"]["spec"][
492-
"containers"
493-
][0]
494-
):
495-
del generic_template_spec["workerGroupSpecs"][0]["template"]["spec"][
496-
"containers"
497-
][0]["volumeMounts"]
491+
for workerGroup in generic_template_spec.get("workerGroupSpecs"):
492+
del_from_list_by_name(
493+
workerGroup["template"]["spec"].get("volumes", []),
494+
["ca-vol", "server-cert"],
495+
)
496+
for c in workerGroup["template"]["spec"].get("containers", []):
497+
del_from_list_by_name(c.get("volumeMounts", []), ["ca-vol", "server-cert"])
498498

499499
del generic_template_spec["workerGroupSpecs"][0]["template"]["spec"][
500500
"initContainers"

0 commit comments

Comments
 (0)