-
Notifications
You must be signed in to change notification settings - Fork 13.9k
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
Airflow DAGs not refreshed with pullPolicy set to Always with the same container tag #23895
Comments
Thanks for opening your first issue here! Be sure to follow the issue template! |
This is not how Kubernetes/Helm chart works, from the point of view of the definition of the pods have not changed, so it will not update them - hence they will notbe restarted. Your expectations for "Always" is far beyond its meaning. "Always" for container/pod means "always when container is started" not "always when helm is updated". If you want to keep same image name for your dag updates, you will have to include manual restart whenever you updated your dags. However, this is absolutely terrible in terms of your traceabiliity of what is going on, because (like in this case) you can never be sure if your image used actually contains newer or older version of your dags. This is very wrong - because there will be more reasons why the image is not updated (for example if your registry is not reachable K8S will not pull the newer image). It's not good for poduction setup. Also if you update the image and one of your pods gets restarted, it will pull the newer image on its own - without you touching the helm and then you will end up with different DAGs in different pods. That's pretty terrible to debug and manage. The proper solution is to build-in tagging/versioning your images in your image build pipeline - rather than using same tag, you need to update the tag every time when you update DAGs in it (for example by adding date/time or increasing version number) and update it in the tag used in Helm (via values file or env var or flag - depending how you deploy it). That completely solves the problem, makes sure that all your components use the same image and make sure all components get restarted when you deploy a new version |
Thanks for your answer. I agree with you, pullPolicy is not working like that in Kubernetes. But in that case, it seems it is a documentation issue. The documentation says
helm upgrade --install airflow apache-airflow/airflow \
--set images.airflow.repository=my-company/airflow \
--set images.airflow.tag=8a0da78 \
--set images.airflow.pullPolicy=Always Documentation seems to say that by adding |
Feel free to make PR fixing the docs then! Airflow is a free software that has more than 2000 contributors like you and most of the docs there were submitted by people like you who wanted to improve others experience. There is no "someone" who will do it - if you want to improve docs - just do it. Bottom right of the documentaiton page yuou will find a "suggest improvement on that page" button. Click it and you will open a PR where you will be able to improve the docs using Github UI - as easily as writing this issue. Can I count on your help there @jerome-aosis ? The community counts on people like you to be able to help with that. Will you help ? |
Obviously, I will. I was not counting on "someone". 😄 PR: #24576 |
Official Helm Chart version
1.6.0 (latest released)
Apache Airflow version
2.3.0 (latest released)
Kubernetes Version
1.20.11
Helm Chart configuration
Docker Image customisations
My DAGs image is just an hello world DAGs:
The Dockerfile just copy the python file in the default
/opt/airflow/dags
directory in the worker container.What happened
First time I launch the installation, the DAG is correctly updated in the worker container and the Airflow dashboard show up the DAF ==> OK
If I update the DAG by changing its name or description and push it to the tag (v1.8.0 in this case)
In the Kubernetes event, I can see that the image is pulled as intended
From here, the only way to refresh my updated DAG is to
What you think should happen instead
DAG should be refreshed only using helm upgrade --install without the need to kill worker/scheduler pods
How to reproduce
helm install
with the container and using pullPolicy toAlways
helm upgrade
command using pullPolicy toAlways
Anything else
This issue occurs everytime
Are you willing to submit PR?
Code of Conduct
The text was updated successfully, but these errors were encountered: