Skip to content

Commit

Permalink
test(gcp): fix cleanup_blueprints.py one more attempt (kubeflow#801)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bobgy authored Nov 9, 2020
1 parent ce9a0f6 commit e2ec489
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
8 changes: 7 additions & 1 deletion py/kubeflow/testing/cleanup_blueprints.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
"""Cleanup auto deployed blueprints.
Running this script locally for production env:
```
python -m kubeflow.testing.cleanup_blueprints auto-blueprints \
--project=kubeflow-ci-deployment --context=kf-ci-management
```
Note: This is in a separate file from cleanup_ci because we wanted to start
using Fire and python3.
Expand Down Expand Up @@ -125,7 +131,7 @@ def _delete_blueprints(namespace, to_keep_names, context=None, dryrun=True):
logging.info("Dryrun: %s %s would be deleted", kind, name)
else:
logging.info("Deleting: %s %s", kind, name)
client.delete_namespaced(namespace, name, {})
client.delete_namespaced(namespace, name, dryrun=dryrun)

for kind in kinds:
logging.info("Deleted %s:\n%s", kind, "\n".join(to_delete[kind]))
Expand Down
6 changes: 4 additions & 2 deletions py/kubeflow/testing/cnrm_clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ def list_namespaced(self, namespace, **kwargs):
return self.list_namespaced_custom_object(
self.group, self.version, namespace, self.plural, **kwargs)

def delete_namespaced(self, namespace, name, body, **kwargs):
def delete_namespaced(self, namespace, name, dryrun=False, **kwargs):
dry_run = dryrun and 'All' or None
return self.delete_namespaced_custom_object(self.group, self.version,
namespace, self.plural, name,
body, **kwargs)
dry_run=dry_run,
**kwargs)

# TODO(jlewi): Add other methods as needed.
13 changes: 13 additions & 0 deletions py/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# You should use python 3.8 and install this requirements.txt

# The following are required by cleanup_blueprints.py
fire
kubernetes
google-cloud-storage
google-api-python-client

# The following are required by cleanup_ci.py
# oauth2client
# python-dateutil
# retrying
# pyyaml

0 comments on commit e2ec489

Please sign in to comment.