Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix cleanup logic for IAM policy bindings #566

Merged
merged 3 commits into from
Jan 21, 2020

Conversation

jlewi
Copy link
Contributor

@jlewi jlewi commented Jan 21, 2020

  • We are not properly GC'ing policy bindings for deleted service accounts.

  • The problem is that we only consider service accounts matching a certain
    regex and that regex isn't matching service accounts for our auto-deployed
    clusters.

  • Using a regex should be unnecessary. If a service account doesn't exist
    that should be a sufficient criterion that the policy bindings should be
    deleted.

Related to: #543


This change is Reviewable

* We are not properly GC'ing policy bindings for deleted service accounts.

* The problem is that we only consider service accounts matching a certain
  regex and that regex isn't matching service accounts for our auto-deployed
  clusters.

* Using a regex should be unnecessary. If a service account doesn't exist
  that should be a sufficient criterion that the policy bindings should be
  deleted.

Related to: kubeflow#543
@jlewi
Copy link
Contributor Author

jlewi commented Jan 21, 2020

/assign @richardsliu

@jlewi
Copy link
Contributor Author

jlewi commented Jan 21, 2020

Here are the logs from a one off run.
oneoff-run.txt

It looks like a bunch of old bindings were GC'd.

Here's the current policy.

kubeflow.ci.deployment.policy.txt

Looks like a bunch of bindings were pruned.

@richardsliu
Copy link
Contributor

/lgtm
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: richardsliu

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot merged commit 4ebe571 into kubeflow:master Jan 21, 2020
jlewi pushed a commit to jlewi/testing that referenced this pull request Jan 21, 2020
This reverts commit 4ebe571.

The list of service accounts only includes service accounts owned by the
project. So we ended up deleting bindings for service accounts owned by
other projects such as the service accounts.

related to: kubeflow#566
jlewi added a commit that referenced this pull request Jan 21, 2020
This reverts commit 4ebe571.

The list of service accounts only includes service accounts owned by the
project. So we ended up deleting bindings for service accounts owned by
other projects such as the service accounts.

related to: #566
jlewi pushed a commit to jlewi/testing that referenced this pull request Jan 22, 2020
jlewi pushed a commit to jlewi/testing that referenced this pull request Jan 22, 2020
* We want to cleanup bindings for service accounts that don't exist
  as a way to GC any bindings that might otherwise accumulate.

* However, we only want to GC bindings for service accounts that are
  owned by that project because only those service accounts will be listed
  as service accounts for that project

  e.g. in the project kubeflow-ci-deployment; we should only delete bindings
  for the service accounts
  ${NAME}@kubeflow-ci-deployment.iam.gserviceaccount.com

  Any other bindings should be preserved.

* related to: kubeflow#566
jlewi pushed a commit to jlewi/testing that referenced this pull request Jan 22, 2020
* We want to cleanup bindings for service accounts that don't exist
  as a way to GC any bindings that might otherwise accumulate.

* However, we only want to GC bindings for service accounts that are
  owned by that project because only those service accounts will be listed
  as service accounts for that project

  e.g. in the project kubeflow-ci-deployment; we should only delete bindings
  for the service accounts
  ${NAME}@kubeflow-ci-deployment.iam.gserviceaccount.com

  Any other bindings should be preserved.

* related to: kubeflow#566
jlewi pushed a commit to jlewi/testing that referenced this pull request Jan 22, 2020
* We want to cleanup bindings for service accounts that don't exist
  as a way to GC any bindings that might otherwise accumulate.

* However, we only want to GC bindings for service accounts that are
  owned by that project because only those service accounts will be listed
  as service accounts for that project

  e.g. in the project kubeflow-ci-deployment; we should only delete bindings
  for the service accounts
  ${NAME}@kubeflow-ci-deployment.iam.gserviceaccount.com

  Any other bindings should be preserved.

* related to: kubeflow#566
k8s-ci-robot pushed a commit that referenced this pull request Jan 24, 2020
* Fix cleanup logic for IAM policy bindings.

* We want to cleanup bindings for service accounts that don't exist
  as a way to GC any bindings that might otherwise accumulate.

* However, we only want to GC bindings for service accounts that are
  owned by that project because only those service accounts will be listed
  as service accounts for that project

  e.g. in the project kubeflow-ci-deployment; we should only delete bindings
  for the service accounts
  ${NAME}@kubeflow-ci-deployment.iam.gserviceaccount.com

  Any other bindings should be preserved.

* related to: #566

* Cleanup.

* Add dryrun logging.

* Update PR.

* Fix lint.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants