Created
February 6, 2019 18:34
-
-
Save woodrow/4dfea1d67a6339849c16de613d7583bd to your computer and use it in GitHub Desktop.
k8s role expander
This file contains 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
kubectl get clusterroles admin --output=json | jq '.rules | map(. as $rule | .apiGroups | map(. as $apiGroup | $rule.resources | map(. as $resource | $rule.verbs | map(. as $verb | $apiGroup + ":" + $resource + ":" + $verb)))) | flatten | sort' > /tmp/admin.json | |
kubectl get clusterroles edit --output=json | jq '.rules | map(. as $rule | .apiGroups | map(. as $apiGroup | $rule.resources | map(. as $resource | $rule.verbs | map(. as $verb | $apiGroup + ":" + $resource + ":" + $verb)))) | flatten | sort' > /tmp/edit.json | |
kubectl get clusterroles view --output=json | jq '.rules | map(. as $rule | .apiGroups | map(. as $apiGroup | $rule.resources | map(. as $resource | $rule.verbs | map(. as $verb | $apiGroup + ":" + $resource + ":" + $verb)))) | flatten | sort' > /tmp/view.json | |
vimdiff /tmp/edit.json /tmp/admin.json | |
vimdiff /tmp/view.json /tmp/edit.json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment