#!/bin/bash

kubectl get deploy -A -l app.kubernetes.io/name=nextcloud --no-headers -o custom-columns=NAMESPACE:metadata.namespace,NAME:metadata.name | while read line; do
ns=$(echo $line | cut -f 1 -d ' ')
name=$(echo $line | cut -f 2 -d ' ')
echo "Executing for $ns/$name"
kubectl -n $ns exec deploy/$name -c app -- $1
done
