Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/events/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: events
description: Data Analysis event triggering
type: application

version: 0.2.2
version: 0.2.3

dependencies:
- name: argo-events
Expand Down
14 changes: 7 additions & 7 deletions charts/events/hooks/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ def sync(self, parent: dict, related: dict) -> SyncResponse:
dependencies = []
sourceTriggers: dict[str, dict] = related.get("Trigger.workflows.diamond.ac.uk/v1alpha1", {})
eventSourceName: str | None = parent.get("metadata", {}).get("name")
beamline: str | None = parent.get("metadata", {}).get("labels", {}).get("workflows.diamond.ac.uk/beamline")
labels: dict = parent.get("metadata", {}).get("labels", {})
beamline: str | None = labels.get("workflows.diamond.ac.uk/beamline")
uid: str | None = labels.get("workflows.diamond.ac.uk/machine-uid")

for dlsTrigger in sourceTriggers.values():
spec: dict = dlsTrigger.get("spec", {})
Expand Down Expand Up @@ -94,6 +96,9 @@ def sync(self, parent: dict, related: dict) -> SyncResponse:
"kind": "Workflow",
"metadata": {
"generateName": f"{template}-event-",
"labels": {
"workflows.diamond.ac.uk/machine-uid": uid,
}
},
"spec": {
"serviceAccountName": "argo-workflow",
Expand All @@ -104,11 +109,6 @@ def sync(self, parent: dict, related: dict) -> SyncResponse:
"arguments": {
"parameters": templateArgs
},
# "workflowMetadata": {
# "labels": {
# "workflows.diamond.ac.uk/creator-posix-uid": "36055"
# }
# }
},
}
}
Expand All @@ -120,7 +120,7 @@ def sync(self, parent: dict, related: dict) -> SyncResponse:
"apiVersion": "argoproj.io/v1alpha1",
"kind": "Sensor",
"metadata": {
"name": f"{beamline}-{eventSourceName}-sensor"
"name": f"{beamline}-{eventSourceName}"
},
"spec": {
"template":
Expand Down
2 changes: 2 additions & 0 deletions charts/events/templates/event-sources.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ metadata:
name: {{ $eventSource.name }}
labels:
workflows.diamond.ac.uk/beamline: {{ $eventSource.beamline }}
workflows.diamond.ac.uk/machine-uid: "36055"
spec:
service:
ports:
Expand All @@ -24,6 +25,7 @@ metadata:
name: waffle-generic
labels:
workflows.diamond.ac.uk/beamline: i15-1
workflows.diamond.ac.uk/machine-uid: "36242"
spec:
generic:
waffle-example:
Expand Down
2 changes: 1 addition & 1 deletion charts/workflows/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: workflows
description: Data Analysis workflow orchestration
type: application
version: 0.13.48
version: 0.13.49
dependencies:
- name: argo-workflows
repository: https://argoproj.github.io/argo-helm
Expand Down
6 changes: 5 additions & 1 deletion charts/workflows/templates/workflow-label-clusterpolicy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,16 @@ spec:
- argoproj.io/*/Workflow
operations:
- CREATE
context:
- name: machineuid
variable:
jmesPath: request.object.metadata.labels."workflows.diamond.ac.uk/machine-uid" || ""
mutate:
patchStrategicMerge:
metadata:
labels:
{{- with .Values.uid }}
workflows.diamond.ac.uk/creator-posix-uid: '{{ . }}'
{{- else }}
workflows.diamond.ac.uk/creator-posix-uid: '{{ `{{ request.userInfo.extra | "workflows.diamond.ac.uk/posixuid" | [0] }}` }}'
workflows.diamond.ac.uk/creator-posix-uid: '{{ `{{ request.userInfo.extra."workflows.diamond.ac.uk/posixuid"[0] || machineuid }}` }}'
Comment thread
JamesDoingStuff marked this conversation as resolved.
{{- end }}
Loading