Skip to content

Commit 472c3e9

Browse files
committed
fix: failed on mount ephemeral file in k8s
Signed-off-by: thxCode <[email protected]>
1 parent c71128f commit 472c3e9

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

gpustack_runtime/deployer/kuberentes.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -384,26 +384,26 @@ def _create_ephemeral_configmaps(
384384
config_map_name_prefix = workload.name_rfc1123_guard
385385

386386
ephemeral_filename_mapping: dict[tuple[int, str], str] = {}
387-
ephemeral_files: list[tuple[str, str, str]] = []
387+
ephemeral_files: list[tuple[str, str]] = []
388388
for ci, c in enumerate(workload.containers):
389389
for fi, f in enumerate(c.files or []):
390390
if f.content is not None:
391391
config_map_name = f"{config_map_name_prefix}-{ci}-{fi}"
392392
ephemeral_filename_mapping[(ci, f.path)] = config_map_name
393-
ephemeral_files.append((config_map_name, f.path, f.content))
393+
ephemeral_files.append((config_map_name, f.content))
394394
if not ephemeral_filename_mapping:
395395
return ephemeral_filename_mapping
396396

397397
core_api = kubernetes.client.CoreV1Api(self._client)
398398
try:
399-
for config_map_name, fp, content in ephemeral_files:
399+
for config_map_name, content in ephemeral_files:
400400
config_map = kubernetes.client.V1ConfigMap(
401401
metadata=kubernetes.client.V1ObjectMeta(
402402
name=config_map_name,
403403
namespace=workload.namespace,
404404
labels=workload.labels,
405405
),
406-
data={fp: content},
406+
data={"content": content},
407407
)
408408

409409
actual_config_map = None
@@ -476,8 +476,8 @@ def _append_pod_volumes(
476476
name=fn,
477477
items=[
478478
kubernetes.client.V1KeyToPath(
479-
key=f.path,
480-
path=f.path.lstrip("/"),
479+
key="content",
480+
path=Path(f.path).name,
481481
mode=f.mode,
482482
),
483483
],
@@ -545,6 +545,7 @@ def _append_container_volume_mounts(
545545
name=f"f-{fn}",
546546
mount_path=f.path,
547547
read_only=(True if f.mode < 0o600 else None),
548+
sub_path=Path(f.path).name,
548549
),
549550
)
550551

0 commit comments

Comments
 (0)