Skip to content

Commit

Permalink
Add a flag to disable the UMB JOB processing
Browse files Browse the repository at this point in the history
  • Loading branch information
astrozzc committed Oct 2, 2024
1 parent 3a336c3 commit 42f974d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
5 changes: 5 additions & 0 deletions deploy/rbac-clowdapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,8 @@ objects:
optional: true
- name: PRINCIPAL_CLEANUP_DELETION_ENABLED_UMB
value: ${PRINCIPAL_CLEANUP_DELETION_ENABLED_UMB}
- name: UMB_JOB_ENABLED
value: ${UMB_JOB_ENABLED}

- name: service
minReplicas: ${{MIN_REPLICAS}}
Expand Down Expand Up @@ -895,6 +897,9 @@ parameters:
- name: PRINCIPAL_CLEANUP_DELETION_ENABLED_UMB
description: Allow cleanup job to delete principals via messages from UMB
value: 'False'
- name: UMB_JOB_ENABLE
description: Temp env to enable the UMB job
value: 'True'
- name: UMB_HOST
description: Host of the UMB service
value: 'localhost'
Expand Down
11 changes: 6 additions & 5 deletions rbac/rbac/celery.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,12 @@
}

if settings.PRINCIPAL_CLEANUP_DELETION_ENABLED_UMB:
app.conf.beat_schedule["principal-cleanup-every-minute"] = {
"task": "management.tasks.principal_cleanup_via_umb",
"schedule": 60, # Every 60 second
"args": [],
}
if settings.UMB_JOB_ENABLED: # TODO: This is temp flag, remove it after populating user_id
app.conf.beat_schedule["principal-cleanup-every-minute"] = {
"task": "management.tasks.principal_cleanup_via_umb",
"schedule": 60, # Every 60 second
"args": [],
}
else:
app.conf.beat_schedule["principal-cleanup-every-sevenish-days"] = {
"task": "management.tasks.principal_cleanup",
Expand Down
1 change: 1 addition & 0 deletions rbac/rbac/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,7 @@

# Settings for enabling/disabling deletion in principal cleanup job via UMB
PRINCIPAL_CLEANUP_DELETION_ENABLED_UMB = ENVIRONMENT.bool("PRINCIPAL_CLEANUP_DELETION_ENABLED_UMB", default=False)
UMB_JOB_ENABLED = ENVIRONMENT.bool("UMB_JOB_ENABLED", default=True)
UMB_HOST = ENVIRONMENT.get_value("UMB_HOST", default="localhost")
UMB_PORT = ENVIRONMENT.get_value("UMB_PORT", default="61612")
# Service account name
Expand Down

0 comments on commit 42f974d

Please sign in to comment.