-
-
Save ignlg/a579e7e47041f894a8f18a2ce1817f87 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
set -eo pipefail | |
json=$(y2j <"$1") | |
overrides=$(echo "$json" | jq "{spec}") | |
name=$(echo "$json" | jq -r ".metadata.name") | |
labels=$(echo "$json" | jq -r '.metadata.labels | keys[] as $k | "\($k)=\(.[$k])"' | paste -sd "," -) | |
image=$(echo "$json" | jq -r ".spec.containers[0].image") | |
shift | |
kubectl run "$name" -it --rm --image="$image" --labels="$labels" --restart=Never --overrides="$overrides" "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment