-
Notifications
You must be signed in to change notification settings - Fork 476
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
feat: add airflow.kubernetesPodTemplate.lifecycle
value
#653
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Lawrence Menyah <[email protected]>
@iSWATxJOKERi Thanks for the PR, however, I am still not sold that there is a legitimate use case that needs us to expose the lifecycle configs to the user. For example, in your ca-certificates use case, a much safer (and already available option) is to use Furthermore, using lifecycle hooks might result in unexpected behavior, specifically:
While I can sort-of imagine (very niche) use cases for If we were to implement a feature like this, here are my initial thoughts on your PR
I also want to note that we currently use the We can create these values for all of our deployments, but also make one called For situations when we have our own commands that we want to run (like in the An example of what a workers:
preStopScript: |
#!/usr/bin/env bash
echo "Hello world!" |
Hi @thesuperzapper , thanks for the quick response and thorough feedback! Learning alot from the things you mentioned that I didn't even think about!
Should've been more detailed in the reason for the MR, but yeah we tried using an
Good point, I agree
Another good point, didn't know lifecycle was used somewhere in the chart...So yeah I think like you said, the two additional scripts would be the best at solving this problem without having to worry about race conditions and gotchas and the sort.
Do you have an idea where we would add the |
@iSWATxJOKERi I think the values would be like this: airflow:
# these are like the other "global" configs like `airflow.extraVolumeMounts`
# the question is should the more specific values like `scheduler.postStartScript` override OR run in addition to
postStartScript: ""
preStopScript: ""
kubernetesPodTemplate:
postStartScript: ""
preStopScript: ""
dbMigrations:
postStartScript: ""
preStopScript: ""
sync:
postStartScript: ""
preStopScript: ""
scheduler:
postStartScript: ""
preStopScript: ""
web:
postStartScript: ""
preStopScript: ""
workers:
postStartScript: ""
preStopScript: ""
triggerer:
postStartScript: ""
preStopScript: ""
flower:
postStartScript: ""
preStopScript: "" We should probably mount these scripts as files from a secret (using projected volume), this could get messy if not done with some kind of template (like how we do pod tolerations), as there are so many different possible scripts. If you need more guidance on making that template, I can point you in the right direction. |
This issue has been automatically marked as stale because it has not had activity in 60 days. Thank you for your contributions. Issues never become stale if any of the following is true:
|
airflow.kubernetesPodTemplate.lifecycle
value
What issues does your PR fix?
Sometimes it is necessary to perform a certain action/do something when a container has started. Other's have also had this problem: #463
In my team's case for example, after we've read secrets from Vault and mounted them in a directory, let's say,
usr/local/share/ca-certificates
, we want to add these certificates files to the trust store inetc/ssl/certs/ca-certificates.crt
by runningupdate-ca-certificates
.The PR allows you to define the container lifecycle hook in the kubernetesPodTemplate, something that was previously only possible by adding in the whole of the pod template via the airflow.kubernetesPodTemplate.stringOverride variable which can be very difficult to do (didn't successfully do it) because it's hard to tell exactly what needs to go into the full pod template of the
stringOverride
key in order to replicate what you get when you look at the output of a pod spec as-is with-o yaml
.What does your PR do?
Adds the airflow.kubernetesPodTemplate.lifecycle value to set container lifecycle hooks on the KubernetesExecutor pod_template. Other's have also had this problem
Checklist
For all Pull Requests
For releasing ONLY