charts icon indicating copy to clipboard operation
charts copied to clipboard

Add pod lifecycle options

Open c-thiel opened this issue 4 years ago • 7 comments

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 avatar Nov 11 '21 09:11 c-thiel

@c-thiel Sounds like an interesting idea, what do you think the values could look like?

thesuperzapper avatar Nov 11 '21 23:11 thesuperzapper

@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 avatar Nov 15 '21 08:11 c-thiel

@c-thiel do you want to create a PR for this feature?

thesuperzapper avatar Dec 14 '21 04:12 thesuperzapper

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

iSWATxJOKERi avatar Oct 04 '22 12:10 iSWATxJOKERi

Went and created the PR here @thesuperzapper 🤝

iSWATxJOKERi avatar Oct 05 '22 13:10 iSWATxJOKERi

@iSWATxJOKERi thanks for the PR, I will take a look at it.

thesuperzapper avatar Oct 06 '22 04:10 thesuperzapper

@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.

thesuperzapper avatar Oct 06 '22 08:10 thesuperzapper