I am running below command to restart pods , but i could able to patch one deployment at a time, requirement is to patch all the deployments in namespace at a time.
oc patch deploy buy-api -p "{\"spec\":{\"template\":{\"metadata\":{\"annotations\":{\"date\":\"`date +'%s'`\"}}}}}"
Could somebody help me to find command to apply patch for all the deployments in one shot.
Thanks in Advance
Using awk and xargs you can do that:
oc get deploy | awk '{print $1 }' | xargs oc patch deploy $0 -p "{\"spec\":{\"template\":{\"metadata\":{\"annotations\":{\"date\":\"`date +'%s'`\"}}}}}"