How to mount a volume to a KubernetesJob infrastr...
# prefect-community
r
Is it possible to add a volumeMount via json patches in prefect 2? I keep running into path error, when i look at the kubernetes job source code the shortcut for env looks like:
"path": "/spec/template/spec/containers/0/env/-"
Which means the path for the volume mount should be:
"path": "/spec/template/spec/containers/0/volumeMounts/-"
When i use that path it doesn't work, any ideas?
👀 1
@Emil Christensen I am still having issues with this. I tried a few combinations and it still doesn't work.
👀 1
@Anna Geller would you have any examples of volumeMount, i didn't see any on discourse
a
how would you do that in a KubernetesJob template? those customizations are essentially a patch to modify/add things to a Kubernetes YAML manifest
c
A volumeMount looks like:
Copy code
spec:
  containers:
  - image: <http://registry.k8s.io/test-webserver|registry.k8s.io/test-webserver>
    name: test-container
    volumeMounts:
    - mountPath: /test-ebs
      name: test-volume
so I think a patch might look like:
Copy code
'{"spec":{"containers":{"volumeMounts":{"mountPath":"/test","name":"test-volume"}}}}'
gratitude thank you 2
Copy code
p='[{"op": "replace", "path": "/spec/template/spec/containers/0/volumeMounts", "value": [{"mountPath": "/test-ebs", "name": "test-volume"}]}]'
r
@Christopher Boyd thanks for the help there! I had make a minor change for EKS Fargate (used add instead of replace), but other than that it did the trick.
🙌 1