Skip to content

Commit 5f7c566

Browse files
authored
Unmount aws config from root (#361)
* unmount aws config from root * move mount out of /root * modify main_env in python rather than templates
1 parent cd90549 commit 5f7c566

2 files changed

Lines changed: 16 additions & 9 deletions

File tree

charts/model-engine/templates/service_template_config_map.yaml

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,8 @@ data:
243243
env:
244244
- name: AWS_PROFILE
245245
value: "${AWS_ROLE}"
246+
- name: AWS_CONFIG_FILE
247+
value: "/opt/.aws/config"
246248
ports:
247249
- containerPort: 8000
248250
name: http
@@ -271,7 +273,7 @@ data:
271273
${TRITON_STORAGE_DICT}
272274
volumeMounts:
273275
- name: config-volume
274-
mountPath: /root/.aws/config
276+
mountPath: /opt/.aws/config
275277
subPath: config
276278
- mountPath: /dev/shm
277279
name: dshm
@@ -309,18 +311,14 @@ data:
309311
${STORAGE_DICT}
310312
volumeMounts:
311313
- name: config-volume
312-
mountPath: /root/.aws/config
314+
mountPath: /opt/.aws/config
313315
subPath: config
314316
- mountPath: /dev/shm
315317
name: dshm
316318
{{- if $mount_infra_config }}
317319
- name: infra-service-config-volume
318320
mountPath: ${INFRA_SERVICE_CONFIG_VOLUME_MOUNT_PATH}
319321
{{- end }}
320-
# LIRA: For compatibility with runnable image converted from artifactlike bundle
321-
- name: config-volume
322-
mountPath: /home/modelengine/.aws/config
323-
subPath: config
324322
- name: user-config
325323
mountPath: /app/user_config
326324
subPath: raw_data
@@ -565,6 +563,8 @@ data:
565563
env:
566564
- name: DD_SERVICE
567565
value: ${RESOURCE_NAME}
566+
- name: AWS_CONFIG_FILE
567+
value: "/opt/.aws/config"
568568
{{- $env_vars := $service_env | fromYaml }}
569569
{{- range $env_var := index $env_vars "env" }}
570570
{{- $env_var_name := index $env_var "name" }}
@@ -601,7 +601,7 @@ data:
601601
memory: 32Gi
602602
volumeMounts:
603603
- name: config-volume
604-
mountPath: /root/.aws/config
604+
mountPath: /opt/.aws/config
605605
subPath: config
606606
{{- range $device := tuple "cpu" "gpu" }}
607607
docker-image-batch-job-{{- $device }}.yaml: |-
@@ -657,6 +657,8 @@ data:
657657
env:
658658
- name: DD_SERVICE
659659
value: ${RESOURCE_NAME}
660+
- name: AWS_CONFIG_FILE
661+
value: "/opt/.aws/config"
660662
{{- $env_vars := $service_env | fromYaml }}
661663
{{- range $env_var := index $env_vars "env" }}
662664
{{- $env_var_name := index $env_var "name" }}
@@ -684,7 +686,7 @@ data:
684686
${STORAGE_DICT}
685687
volumeMounts:
686688
- name: config-volume
687-
mountPath: /root/.aws/config
689+
mountPath: /opt/.aws/config
688690
subPath: config
689691
- name: workdir
690692
mountPath: ${MOUNT_PATH}
@@ -693,6 +695,9 @@ data:
693695
initContainers:
694696
- name: input-downloader
695697
image: {{ $gateway_repository }}:${GIT_TAG}
698+
env:
699+
- name: AWS_CONFIG_FILE
700+
value: "/opt/.aws/config"
696701
command:
697702
- python
698703
- -m
@@ -713,7 +718,7 @@ data:
713718
memory: 1Gi
714719
volumeMounts:
715720
- name: config-volume
716-
mountPath: /root/.aws/config
721+
mountPath: /opt/.aws/config
717722
subPath: config
718723
- name: workdir
719724
mountPath: ${MOUNT_PATH}

model-engine/model_engine_server/infra/gateways/resources/k8s_resource_types.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,8 @@ def get_endpoint_resource_arguments_from_request(
518518
if isinstance(flavor, RunnableImageLike) and flavor.env:
519519
main_env = [{"name": key, "value": value} for key, value in flavor.env.items()]
520520
main_env.append({"name": "AWS_PROFILE", "value": build_endpoint_request.aws_role})
521+
# NOTE: /opt/.aws/config is where service_template_config_map.yaml mounts the AWS config file, point to the mount for boto clients
522+
main_env.append({"name": "AWS_CONFIG_FILE", "value": "/opt/.aws/config"})
521523

522524
infra_service_config_volume_mount_path = "/infra-config"
523525
forwarder_config_file_name = "service--forwarder.yaml"

0 commit comments

Comments
 (0)