Add pod lifecycle options
What is your feature request? In the Chart we currently don't have an option to add a lifecycle to the pods. These lifecycle hooks can be useful in a number of situations where we need to patch small parts of the pod. An example could be:
lifecycle:
postStart:
exec:
command: ["/bin/sh", "-c", do_something.sh]
To give a concrete example, I am currently facing this issue https://github.com/apache/airflow/issues/8212. To fix this I need to patch a single file in the container. I could of course go ahead and build my custom container - having a lifecycle hook would be very simple though.
Implementation should be really simple and straight forward - just forwarding whatever the user specifies in the values.yaml.
It would be good to have this, as anything else, once globally and additionaly an option to overwrite for the individual components.
@c-thiel Sounds like an interesting idea, what do you think the values could look like?
@thesuperzapper in the values.yaml I would simply add an empty lifecycle: {} option to all components. This can then be filled by the users according to the docs: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/
@c-thiel do you want to create a PR for this feature?
Hi, how's it going, is there a possibility of this functionality being added in the future? My team has come across this issue where we want to copy some file from a shared volume to a path on the container and run some extra commands after using a postStart lifecycle hook. But currently aren't able to do so @thesuperzapper without using the stringOverride which makes it difficult to figure out how to get the pod spec right based on the the setup we currently have now
Went and created the PR here @thesuperzapper 🤝
@iSWATxJOKERi thanks for the PR, I will take a look at it.
@iSWATxJOKERi @c-thiel I have made a large comment in https://github.com/airflow-helm/charts/pull/653#issuecomment-1269573237 that explains my thoughts around how we might implement a value to allow users to run scripts postStart or preStop.