Last active
March 5, 2020 12:09
-
-
Save welshstew/4f9532fd8737de1a43277c9154caa95e to your computer and use it in GitHub Desktop.
Use oc run and mount volumes using overrides
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: PersistentVolumeClaim | |
metadata: | |
name: bash-claim | |
spec: | |
accessModes: | |
- ReadWriteOnce | |
resources: | |
requests: | |
storage: 512Mi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
oc run some-pod --overrides=' | |
{ | |
"spec": { | |
"containers": [ | |
{ | |
"command": [ | |
"/bin/bash", | |
"-c", | |
"for i in {1..5}; do echo hi stuff; sleep 5; done" | |
], | |
"image": "registry.access.redhat.com/rhel7/rhel:latest", | |
"name": "some-pod", | |
"volumeMounts": [{ | |
"mountPath": "/opt/scripts", | |
"name": "some-data" | |
}] | |
} | |
], | |
"volumes": [ | |
{ | |
"name": "some-data", | |
"persistentVolumeClaim": { | |
"claimName": "bash-claim" | |
} | |
} | |
] | |
} | |
} | |
' --image=dummy --restart=Never |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
And working now. I went back through my notes but couldn't find what I had been doing wrong. I extended your example based on info found elsewhere to support using YAML as the override instead of JSON:
Thank you