I have a set of pods and they have volumes. I want to annotate each pod with
backup.velero.io/backup-volumes=<volume1 of that pod>,<volume2 of that pod>
I have tried to run a command like this
kubectl get pods -n dev -o name | \
xargs -I{} kubectl -n dev annotate {} backup.velero.io/backup-volumes=$(bash -c 'kubectl get {} -n dev -o json | jq -r ".spec.volumes[0].name | paste -sd, -"') --overwrite
But, in this case the inner {}
does seem to get the correct value.
Is there an easier way to annotate the pods with the volumes that they have?