We are running many kubernetes clusters. The developers nightly generate a json file with all of the clusters and hosts associated with each cluster which we can pull via curl and parse. The developers want to be able to target clusters with salt commands. Up until now, I have had them doing that with:
salt -L $(cluster-info.sh -c <cluster name> | cut -d. -f1 | tr '\n' ',') <whatever salt command>
They want something simpler. I was trying to define a function:
function sltc () {
case ${#} in
1)
echo "You need at least two parameters to this function"
;;
2)
salt -L
$(cluster-info.sh -c ${1}
| cut -d. -f1 | tr '\n' ',')${2}
salt -L
$(cluster-info.sh -c ${1}
| cut -d. -f1 | tr '\n' ',')${2} "${3}"
;;
esac
}
Running
sltc CLS1 test.ping
shows a jid, but nothing else. When I run
salt-run jobs.lookup_jid <jid>
It just displays some warnings, and that is it. Does anyone have a better idea?