How to mount a volume to a KubernetesJob infrastructure block on a Prefect Deployment?

View in #prefect-community on Slack

Rajvir_Jhawar @Rajvir_Jhawar: 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?
@Emil_Christensen I am still having issues with this. I tried multiple combinations and it still doesn’t work. All of them result in errors. The above is the correct path since I already have volumeMount that get added by the eks fargate system.
@Anna_Geller would you have any examples of volumeMount, i didn’t see any on discourse

Anna_Geller @Anna_Geller: how would you do that in a KubernetesJob template? those customizations are essentially a patch to modify/add things to a Kubernetes YAML manifest

Christopher_Boyd @Christopher_Boyd: A volumeMount looks like:

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:

'{"spec":{"containers":{"volumeMounts":{"mountPath":"/test","name":"test-volume"}}}}'
p='[{"op": "replace", "path": "/spec/template/spec/containers/0/volumeMounts", "value": [{"mountPath": "/test-ebs", "name": "test-volume"}]}]'

Related discussions

Linen