How to use --wait with post-install hook in helm?

妖精的绣舞 提交于 2020-03-04 23:29:09

问题


I use an install script in a post-install hook. When I run helm install with --wait option, helm waits that all pods are ready, but helm does not launch post-install hooks script. Then, the pods are not yet ready (pods are waiting for install script to finish).

I tried with pre-install hook instead, but the install script needs other services to be running...

PS: it works fine if I don't use "--wait", but CI from gitlab won't fail if there is an error during pod startups.

Is there a way to run the post-install hooks during the helm install --wait period?


回答1:


I don't think you can solve your problem with Helm post-install hook, but you may with vanilla Kubernetes jobs or perhaps hooks, i.e. running job/hook along with your deployment that will depend only on Kubernetes.

One of the first things to try is to remove helm.sh/hook annotations from your existing job.

  annotations:
    # This is what defines this resource as a hook. Without this line, the
    # job is considered part of the release.
    "helm.sh/hook": post-install
    "helm.sh/hook-weight": "-5"
    "helm.sh/hook-delete-policy": hook-succeeded

Helm can then wait for them to finish as they will be executed by Kubernetes.



来源:https://stackoverflow.com/questions/60262802/how-to-use-wait-with-post-install-hook-in-helm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!