namespace.py 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. # Copyright 2022 gRPC authors.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. """Clean up GKE namespaces leaked by the tests."""
  15. from absl import app
  16. from bin.cleanup import cleanup
  17. from framework import xds_flags
  18. from framework import xds_k8s_flags
  19. def main(argv):
  20. if len(argv) > 1:
  21. raise app.UsageError('Too many command-line arguments.')
  22. cleanup.load_keep_config()
  23. project: str = xds_flags.PROJECT.value
  24. network: str = xds_flags.NETWORK.value
  25. gcp_service_account: str = xds_k8s_flags.GCP_SERVICE_ACCOUNT.value
  26. dry_run: bool = cleanup.DRY_RUN.value
  27. cleanup.find_and_remove_leaked_k8s_resources(dry_run, project, network,
  28. gcp_service_account)
  29. if __name__ == '__main__':
  30. app.run(main)