Forked from tommeramber/discover-deployments-with-special-scc.sh
Created
September 20, 2024 23:10
-
-
Save nanox/81fdbdd1eb7d1022ccef25171607a6df 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