Skip to content

Instantly share code, notes, and snippets.

@bgeesaman
Last active July 30, 2019 13:19
Show Gist options
  • Select an option

  • Save bgeesaman/ed4480d4eaf93e7e5c39ae8e5c4270c3 to your computer and use it in GitHub Desktop.

Select an option

Save bgeesaman/ed4480d4eaf93e7e5c39ae8e5c4270c3 to your computer and use it in GitHub Desktop.

Revisions

  1. bgeesaman renamed this gist Jul 23, 2019. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. bgeesaman created this gist Jul 23, 2019.
    14 changes: 14 additions & 0 deletions fetchgkebasicauthroles.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    #!/usr/bin/env bash


    ALL_ROLES="$(gcloud iam roles list --format=json | jq -r '.[].name')"

    for i in $ALL_ROLES; do
    CURRENT_ROLE="${i}"
    CURRENT_ROLE_PERMS="$(gcloud iam roles describe ${i} --format=json | jq -r '.includedPermissions[]?' | egrep 'container.clusters.get$|container.clusters.list')"
    if [[ ! -z "${CURRENT_ROLE_PERMS}" ]]; then
    echo "${CURRENT_ROLE} has: "
    echo "${CURRENT_ROLE_PERMS}"
    fi
    CURRENT_ROLE_PERMS=""
    done