Skip to content

Commit

Permalink
cronjob needs to specify labels for spawned job as well
Browse files Browse the repository at this point in the history
add 'job-id' label instead of 'name', which is automatically set, use that if available
  • Loading branch information
ikreymer committed Dec 20, 2024
1 parent eb1ffef commit 1a8fd74
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion backend/btrixcloud/operator/bgjobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ async def finalize_background_job(self, data: MCDecoratorSyncData) -> dict:
labels: dict[str, str] = metadata.get("labels", {})
oid: str = labels.get("btrix.org") or ""
job_type: str = labels.get("job_type") or ""
job_id: str = metadata.get("name")
job_id: str = labels.get("job_id") or metadata.get("name")

status = data.object["status"]
success = status.get("succeeded") == 1
Expand Down
7 changes: 7 additions & 0 deletions chart/app-templates/replica_deletion_cron_job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ spec:
schedule: "{{ schedule }}"

jobTemplate:
metadata:
labels:
role: "background-job"
job_type: {{ job_type }}
job_id: {{ id }}
btrix.org: {{ oid }}

spec:
template:
spec:
Expand Down

0 comments on commit 1a8fd74

Please sign in to comment.