Last active
June 21, 2025 12:06
-
-
Save tommeramber/87c82525ed31c0605478b4c82b5f048c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for NAMESPACE in $(oc get namespace --no-headers | awk '{print $1}' | grep -v "openshift-*") ; | |
do | |
oc get deployment,deploymentconfig -o name -n $NAMESPACE |\ | |
xargs -n 1 -I OBJECT oc get OBJECT -o json -n $NS 2>/dev/null |\ | |
jq -r 'select(.spec.template.spec.containers[].securityContext!={}) | | |
"Kind: " + .metadata.kind, | |
"NAME: " + .metadata.name, | |
"NAMESPACE: " + .metadata.namespace, | |
"To see the exact SCC, run:", | |
"oc get " + .kind + " " + .metadata.name + " -n " .metadata.namespace + " -o jsonpath={.spec.template.spec.containers[].securityContext} | jq .", | |
"\n"' | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment