Skip to content

Commit bbee582

Browse files
committed
chore(controller): add manager url
1 parent 5dd0675 commit bbee582

8 files changed

Lines changed: 23 additions & 9 deletions

File tree

charts/controller/templates/_helpers.tpl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,14 @@ env:
8383
- name: DRYCC_DATABASE_REPLICA_URL
8484
value: "postgres://$(DRYCC_DATABASE_USER):$(DRYCC_DATABASE_PASSWORD)@drycc-database-replica.{{.Release.Namespace}}.svc.{{.Values.global.clusterDomain}}:5432/controller"
8585
{{- end }}
86+
{{- if (.Values.workflowManagerUrl) }}
87+
- name: WORKFLOW_MANAGER_URL
88+
value: "{{ .Values.workflowManagerUrl }}"
89+
- name: WORKFLOW_MANAGER_ACCESS_KEY
90+
value: "{{ .Values.workflowManagerAccessKey }}"
91+
- name: WORKFLOW_MANAGER_SECRET_KEY
92+
value: "{{ .Values.workflowManagerSecretKey }}"
93+
{{- end }}
8694
- name: WORKFLOW_NAMESPACE
8795
valueFrom:
8896
fieldRef:

charts/controller/values.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ concurrencyPolicy: "Replace"
3636
# databaseUrl and databaseReplicaUrl are will no longer use the built-in database component
3737
databaseUrl: ""
3838
databaseReplicaUrl: ""
39+
40+
# Workflow-manager Configuration Options
41+
workflowManagerUrl: ""
42+
workflowManagerAccessKey: ""
43+
workflowManagerSecretKey: ""
44+
3945
# Configuring this will no longer use the built-in rabbitmq component
4046
rabbitmqUrl: ""
4147
# Service

rootfs/api/management/commands/measure_apps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Command(BaseCommand):
1414
"""Management command for push data to manager"""
1515

1616
def handle(self, *args, **options):
17-
if settings.WORKFLOW_MANAGER_URL is not None:
17+
if settings.WORKFLOW_MANAGER_URL:
1818
timestamp = time.time()
1919
task_id = uuid.uuid4().hex
2020
logger.info(f"pushing {task_id} resources to workflow_manager when {timezone.now()}")

rootfs/api/management/commands/measure_networks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def _measure_networks(self, config_map, timestamp):
3333
send_measurements.delay(networks)
3434

3535
def handle(self, *args, **options):
36-
if settings.WORKFLOW_MANAGER_URL is not None:
36+
if settings.WORKFLOW_MANAGER_URL:
3737
timestamp = int(time.time())
3838
task_id = uuid.uuid4().hex
3939
logger.info(f"pushing {task_id} limits to workflow_manager when {timezone.now()}")

rootfs/api/management/commands/measure_resources.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Command(BaseCommand):
1414
"""Management command for push data to manager"""
1515

1616
def handle(self, *args, **options):
17-
if settings.WORKFLOW_MANAGER_URL is not None:
17+
if settings.WORKFLOW_MANAGER_URL:
1818
timestamp = time.time()
1919
task_id = uuid.uuid4().hex
2020
logger.info(f"pushing {task_id} resources to workflow_manager when {timezone.now()}")

rootfs/api/management/commands/measure_volumes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Command(BaseCommand):
1414
"""Management command for push data to manager"""
1515

1616
def handle(self, *args, **options):
17-
if settings.WORKFLOW_MANAGER_URL is not None:
17+
if settings.WORKFLOW_MANAGER_URL:
1818
timestamp = time.time()
1919
task_id = uuid.uuid4().hex
2020
logger.info(f"pushing {task_id} volumes to workflow_manager when {timezone.now()}")

rootfs/api/permissions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def get_app_status(app):
1010
blocklist = Blocklist.get_blocklist(app)
1111
if blocklist:
1212
return False, blocklist.remark
13-
if settings.WORKFLOW_MANAGER_URL is not None:
13+
if settings.WORKFLOW_MANAGER_URL:
1414
status = manager.User().get_status(app.owner.pk)
1515
if not status["is_active"]:
1616
return False, status["message"]

rootfs/api/signals.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def create_auth_token_handle(sender, instance=None, created=False, **kwargs):
139139
@receiver(post_save, sender=App)
140140
def app_changed_handle(sender, instance=None, created=False, update_fields=None, **kwargs):
141141
# measure limits to workflow manager
142-
if settings.WORKFLOW_MANAGER_URL is not None and (
142+
if settings.WORKFLOW_MANAGER_URL and (
143143
created or (
144144
update_fields is not None and "structure" in update_fields)):
145145
timestamp = time.time()
@@ -152,7 +152,7 @@ def app_changed_handle(sender, instance=None, created=False, update_fields=None,
152152
@receiver(post_save, sender=Config)
153153
def config_changed_handle(sender, instance=None, created=False, update_fields=None, **kwargs):
154154
# measure limits to workflow manager
155-
if settings.WORKFLOW_MANAGER_URL is not None and (
155+
if settings.WORKFLOW_MANAGER_URL and (
156156
created or (
157157
update_fields is not None and (
158158
"cpu" in update_fields or "memory" in update_fields))):
@@ -166,7 +166,7 @@ def config_changed_handle(sender, instance=None, created=False, update_fields=No
166166
@receiver(post_save, sender=Volume)
167167
def volume_changed_handle(sender, instance=None, created=False, update_fields=None, **kwargs):
168168
# measure volumes to workflow manager
169-
if settings.WORKFLOW_MANAGER_URL is not None and created:
169+
if settings.WORKFLOW_MANAGER_URL and created:
170170
timestamp = time.time()
171171
send_measurements.apply_async(
172172
args=[instance.to_measurements(timestamp), ],
@@ -184,7 +184,7 @@ def resource_changed_handle(sender, instance=None, created=False, update_fields=
184184
eta=now() + timedelta(seconds=30)
185185
)
186186
# measure resources to workflow manager
187-
if settings.WORKFLOW_MANAGER_URL is not None and (
187+
if settings.WORKFLOW_MANAGER_URL and (
188188
created or (
189189
update_fields is not None and (
190190
"plan" in update_fields

0 commit comments

Comments
 (0)