WAI
Status Update
Comments
gs...@google.com <gs...@google.com> #2
[Deleted User] <[Deleted User]> #3
Hi, this error only affects Cloud SDK version 186. It was previously reported in Issue 72407295 and a fix for it should be released in Cloud SDK version 187.
In the mean time, you can downgrade to Cloud SDK version 185 as a workaround by running the following command:
gcloud components update --version 185.0.0
In the mean time, you can downgrade to Cloud SDK version 185 as a workaround by running the following command:
gcloud components update --version 185.0.0
yi...@google.com <yi...@google.com> #4
Hello,
The filter docs [1], suggest that "key : simple-pattern" will "matches any word in key". If unquoted, the words are terminated by space, thus you have 4 separate words that you are trying to match ANY with. The solution is as George mentioned, use quoted literal. Put "" around your matched strings. So in your case, it would be:
$ gcloud iam service-accounts list --format 'value(email)' --filter 'displayName: "Generated for redis pods"'
Please try it and see if it works (if not, show us what the new results are), thanks.
[1]https://cloud.google.com/sdk/gcloud/reference/topic/filters
The filter docs [1], suggest that "key : simple-pattern" will "matches any word in key". If unquoted, the words are terminated by space, thus you have 4 separate words that you are trying to match ANY with. The solution is as George mentioned, use quoted literal. Put "" around your matched strings. So in your case, it would be:
$ gcloud iam service-accounts list --format 'value(email)' --filter 'displayName: "Generated for redis pods"'
Please try it and see if it works (if not, show us what the new results are), thanks.
[1]
[Deleted User] <[Deleted User]> #5
Oh I see, so I need to do double quoting for the filter string in order to do an exact match. Gotcha. It worked. Thanks.
[Deleted User] <[Deleted User]> #6
I am considering this ticket closed.
However, thehttps://cloud.google.com/sdk/gcloud/reference/topic/filters doc didn't give a specific example or mention exact matching with quoted literal syntax so it's confusing for me. I wish the doc could be updated to add what you explained to me in.
However, the
Description
to translate legacy node pool access scopes into using IAM service accounts with role bindings. The NODE_SA_EMAIL variable won't always work because the way --filter works. it finds all relevant items that contains certain words instead of doing an exact match.
Problem you have encountered:
"gcloud iam service-accounts list" command's filter option is doing substring/contains matching rather than exact matching.
What you expected to happen:
"gcloud iam service-accounts list" command's filter should have an option to do exact matching.
Steps to reproduce:
Have to 2 IAM service accounts:
1. 'admin-support-node-pool@maven-clinic-ye-dev.iam.gserviceaccount.com'
2. 'support-node-pool@maven-clinic-ye-dev.iam.gserviceaccount.com'
Do a search:
gcloud iam service-accounts list --format 'value(email)' --filter 'displayName:Generated for support node pool'
will yield a result with both above service accounts instead of just #2
Other information (workarounds you have tried, documentation consulted, etc):
A work around is to pipe the result from `gcloud iam service-accounts list ` to external tools like jq to do json filtering.