Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for custom cronjobs #34399

Closed
2 tasks done
kimminw00 opened this issue Sep 15, 2023 · 1 comment · Fixed by #36331
Closed
2 tasks done

Support for custom cronjobs #34399

kimminw00 opened this issue Sep 15, 2023 · 1 comment · Fixed by #36331
Labels
area:helm-chart Airflow Helm Chart kind:feature Feature Requests

Comments

@kimminw00
Copy link
Contributor

kimminw00 commented Sep 15, 2023

Description

airflow/chart/values.yaml

Lines 2167 to 2180 in 3854264

# This runs as a CronJob to cleanup old pods.
cleanup:
enabled: false
# Run every 15 minutes (templated).
schedule: "*/15 * * * *"
# To select a random-ish, deterministic starting minute between 3 and 12 inclusive for each release:
# '{{- add 3 (regexFind ".$" (adler32sum .Release.Name)) -}}-59/15 * * * *'
# To select the last digit of unix epoch time as the starting minute on each deploy:
# '{{- now | unixEpoch | trunc -1 -}}-59/* * * * *'
# Command to use when running the cleanup cronjob (templated).
command: ~
# Args to use when running the cleanup cronjob (templated).
args: ["bash", "-c", "exec airflow kubernetes cleanup-pods --namespace={{ .Release.Namespace }}"]

Since airflow helm chart only supports cleanup cronjob, users have to modify templates to add additional maintenance cronjobs

Use case/motivation

For example, we can create multiple custom cronjobs using values.yaml ​​below

cronJobs:
  cleanPods:
    image: apache/airflow
    schedule: "*/15 * * * *"
    command: ~
    args: ["bash", "-c", "exec airflow kubernetes cleanup-pods --namespace={{ .Release.Namespace }}"]
    ...
  cleanDB:
    image: apache/airflow
    schedule: "30 3 1 * *"
    command: ~
    args: ["bash", "-c", "exec airflow db clean"]
    ...
  backupDB:
    image: CUSTOM_IMAGE
    schedule: "0 1 1 * *"
    command: ~
    args: ["bash", "-c", "pg_dump -h HOST -U USER_NAME -Fc DATABASE_NAME | aws s3 cp - s3://<bucket_name>/<database_name>.dump"]
    ...

By providing custom cronjobs, we can flexibly respond to additional maintenance tasks as needed.

Related issues

No response

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!

Code of Conduct

@kimminw00 kimminw00 added kind:feature Feature Requests needs-triage label for new issues that we didn't triage yet labels Sep 15, 2023
@kimminw00 kimminw00 changed the title Support for custom cronjobs for airflow helm chart Support for custom cronjobs Sep 15, 2023
@hussein-awala hussein-awala added area:helm-chart Airflow Helm Chart and removed needs-triage label for new issues that we didn't triage yet labels Sep 15, 2023
@hussein-awala
Copy link
Member

Feel free to raise a PR to add this feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:helm-chart Airflow Helm Chart kind:feature Feature Requests
Projects
None yet
2 participants