Bug 1782583 - GCP destroy is leaking Project IAM bindings.
Summary: GCP destroy is leaking Project IAM bindings.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Installer
Version: 4.2.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: 4.4.0
Assignee: Abhinav Dahiya
QA Contact: Yang Yang
URL:
Whiteboard:
Depends On:
Blocks: 1782584 1782588
TreeView+ depends on / blocked
 
Reported: 2019-12-11 21:37 UTC by Abhinav Dahiya
Modified: 2020-05-13 21:54 UTC (History)
0 users

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1782584 (view as bug list)
Environment:
Last Closed: 2020-05-13 21:54:53 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Github openshift installer pull 2790 None closed Bug 1782583: destroy/gcp/policybinding.go: identity deleted service accounts belonging to the cluster 2020-04-10 03:28:08 UTC
Red Hat Product Errata RHBA-2020:0581 None None None 2020-05-13 21:54:56 UTC

Description Abhinav Dahiya 2019-12-11 21:37:23 UTC
Description of problem:
Based on https://cloud.google.com/resource-manager/reference/rest/Shared.Types/Binding

The members values can be:
```
deleted:serviceAccount:{emailid}?uid={uniqueid}: An email address (plus unique identifier) representing a service account that has been recently deleted. For example, my-other-app@appspot.gserviceaccount.com?uid=123456789012345678901. If the service account is undeleted, this value reverts to serviceAccount:{emailid} and the undeleted service account retains the role in the binding.
```

this looks like a new addition to the API since the archive from Oct 26, 2019 doesn't have these value type. see https://web.archive.org/web/20181026092140/https://cloud.google.com/resource-manager/reference/rest/Shared.Types/Binding

Also it doesn't look like the API is being consistent with the result as two consecutive requests are returning different responses :P
```
[7:08:11] ➜  installer git:(add_platform_owners) ✗ gcloud projects get-iam-policy openshift-gce-devel-ci --format json | grep "ci-op-4wlm9"

        "serviceAccount:ci-op-4wlm9-m@openshift-gce-devel-ci.iam.gserviceaccount.com",

        "serviceAccount:ci-op-4wlm9-openshift-m-w75nq@openshift-gce-devel-ci.iam.gserviceaccount.com",

        "serviceAccount:ci-op-4wlm9-m@openshift-gce-devel-ci.iam.gserviceaccount.com",

        "serviceAccount:ci-op-4wlm9-m@openshift-gce-devel-ci.iam.gserviceaccount.com",

        "serviceAccount:ci-op-4wlm9-w@openshift-gce-devel-ci.iam.gserviceaccount.com",

        "serviceAccount:ci-op-4wlm9-openshift-i-nnvgl@openshift-gce-devel-ci.iam.gserviceaccount.com",

        "serviceAccount:ci-op-4wlm9-m@openshift-gce-devel-ci.iam.gserviceaccount.com",

        "serviceAccount:ci-op-4wlm9-openshift-i-zh522@openshift-gce-devel-ci.iam.gserviceaccount.com",

        "serviceAccount:ci-op-4wlm9-openshift-m-w75nq@openshift-gce-devel-ci.iam.gserviceaccount.com",

        "serviceAccount:ci-op-4wlm9-m@openshift-gce-devel-ci.iam.gserviceaccount.com",

        "serviceAccount:ci-op-4wlm9-openshift-i-zh522@openshift-gce-devel-ci.iam.gserviceaccount.com",

        "serviceAccount:ci-op-4wlm9-w@openshift-gce-devel-ci.iam.gserviceaccount.com",

[7:08:23] ➜  installer git:(add_platform_owners) ✗ gcloud projects get-iam-policy openshift-gce-devel-ci --format json | grep "ci-op-4wlm9"

        "deleted:serviceAccount:ci-op-4wlm9-m@openshift-gce-devel-ci.iam.gserviceaccount.com?uid=111636284758116941377",

        "deleted:serviceAccount:ci-op-4wlm9-openshift-m-w75nq@openshift-gce-devel-ci.iam.gserviceaccount.com?uid=115542993089051207368",

        "deleted:serviceAccount:ci-op-4wlm9-m@openshift-gce-devel-ci.iam.gserviceaccount.com?uid=111636284758116941377",

        "deleted:serviceAccount:ci-op-4wlm9-m@openshift-gce-devel-ci.iam.gserviceaccount.com?uid=111636284758116941377",

        "deleted:serviceAccount:ci-op-4wlm9-w@openshift-gce-devel-ci.iam.gserviceaccount.com?uid=106651455962694555805",

        "deleted:serviceAccount:ci-op-4wlm9-openshift-i-nnvgl@openshift-gce-devel-ci.iam.gserviceaccount.com?uid=113695655870612204124",

        "deleted:serviceAccount:ci-op-4wlm9-m@openshift-gce-devel-ci.iam.gserviceaccount.com?uid=111636284758116941377",

        "deleted:serviceAccount:ci-op-4wlm9-openshift-i-zh522@openshift-gce-devel-ci.iam.gserviceaccount.com?uid=103715387178859573892",

        "deleted:serviceAccount:ci-op-4wlm9-openshift-m-w75nq@openshift-gce-devel-ci.iam.gserviceaccount.com?uid=115542993089051207368",

        "deleted:serviceAccount:ci-op-4wlm9-m@openshift-gce-devel-ci.iam.gserviceaccount.com?uid=111636284758116941377",

        "deleted:serviceAccount:ci-op-4wlm9-openshift-i-zh522@openshift-gce-devel-ci.iam.gserviceaccount.com?uid=103715387178859573892",

        "deleted:serviceAccount:ci-op-4wlm9-w@openshift-gce-devel-ci.iam.gserviceaccount.com?uid=106651455962694555805",
```


The installer destroy skips over these `deleted:` prefixed bindings.

Comment 2 Yang Yang 2019-12-25 07:55:36 UTC
Verified with payload 4.4.0-0.nightly-2019-12-20-210709

Steps of verification as below:

1. Get the service accounts after the cluster setup
# gcloud projects get-iam-policy openshift-qe --format json | grep "yy44ip"
        "serviceAccount:yy44ip-dkcbh-m@openshift-qe.iam.gserviceaccount.com",
        "serviceAccount:yy44ip-dkcbh-openshift-m-vsn6d@openshift-qe.iam.gserviceaccount.com",
        "serviceAccount:yy44ip-dkcbh-m@openshift-qe.iam.gserviceaccount.com",
        "serviceAccount:yy44ip-dkcbh-m@openshift-qe.iam.gserviceaccount.com",
        "serviceAccount:yy44ip-dkcbh-w@openshift-qe.iam.gserviceaccount.com",
        "serviceAccount:yy44ip-dkcbh-openshift-i-xwv4t@openshift-qe.iam.gserviceaccount.com",
        "serviceAccount:yy44ip-dkcbh-m@openshift-qe.iam.gserviceaccount.com",
        "serviceAccount:yy44ip-dkcbh-openshift-i-2g9md@openshift-qe.iam.gserviceaccount.com",
        "serviceAccount:yy44ip-dkcbh-openshift-m-vsn6d@openshift-qe.iam.gserviceaccount.com",
        "serviceAccount:yy44ip-dkcbh-m@openshift-qe.iam.gserviceaccount.com",
        "serviceAccount:yy44ip-dkcbh-openshift-i-2g9md@openshift-qe.iam.gserviceaccount.com",
        "serviceAccount:yy44ip-dkcbh-w@openshift-qe.iam.gserviceaccount.com",


2. Get the service accounts after the cluster is destroyed

# gcloud projects get-iam-policy openshift-qe --format json | grep "yy44ip"
No output

Comment 4 errata-xmlrpc 2020-05-13 21:54:53 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:0581


Note You need to log in before you can comment on or make changes to this bug.