Skip to content

Commit

Permalink
Check Secret Manager API before cleaning secrets
Browse files Browse the repository at this point in the history
  • Loading branch information
dargudear-google committed Dec 5, 2024
1 parent 445d89e commit 43b7dba
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cmd/janitor/gcp_janitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,9 @@ def clean_gke_cluster(project, age, filt):
def clean_secrets(project, age, filt):
"""Clean up secrets from Google secret manager"""
os.environ['CLOUDSDK_API_ENDPOINT_OVERRIDES_SECRETMANAGER'] = 'https://secretmanager.googleapis.com/'
if not api_enabled(project, 'secretmanager.googleapis.com'):
log('Secret Manager API is not enabled, skipping secret clean-up')
return 0
cmd = [
'gcloud', 'secrets', 'list',
'--project=%s' % project,
Expand Down

0 comments on commit 43b7dba

Please sign in to comment.