Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Get a list of pod names with the container "pant-potatis"
- pod_names=($(oc get pods --field-selector=status.phase=Running -o jsonpath='{.items[?(@.spec.containers[*].name=="pant-potatis")].metadata.name}'))
- # Check if there are any pods with the specified container
- if [ ${#pod_names[@]} -eq 0 ]; then
- echo "No pods with container 'pant-potatis' found."
- exit 1
- fi
- # Get a random pod name
- random_pod="${pod_names[RANDOM % ${#pod_names[@]}]}"
- echo "Random Pod Name with 'pant-potatis' container: $random_pod"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement