Where the owners are determined recursively. Limitation: only parents of replicasets are recursively evaluated.
$ oc get -o json pod | jq -r '.items[] | . as $i |
"\(.metadata.name):\(.metadata.annotations["openshift.io/scc"]):"
+ ([.metadata.ownerReferences[] | "\(.kind | ascii_downcase)/\(.name)"] |
join(","))' | while IFS= read -r l; do
while [[ "$l" =~ replicaset/[^,]+ ]]; do
rs="${BASH_REMATCH[0]}"
owners="$(oc get -o json "$rs" | jq -r '[.metadata.ownerReferences[] |
"\(.kind | ascii_downcase)/\(.name)"] | join(",")')"
[[ -z "${owners:-}" ]] && continue
l="$(printf '%s\n' "$l" | sed "s:$rs:$owners:")"
done
printf '%s\n' "${l:-}"
done | column -t -s :