0

I need to run pods and jobs in a specific order

I have this chart structure

my-chart/
  Chart.yaml 
  Values.yaml 
  templates/
    module1 /
        deployment1.yaml 
        service1.yaml    
        job1.yaml
    module2 /
        deployment2.yaml 
        service2.yaml    
        job2.yaml

I want job1 start running once all pod replicas related to module1 are ready and the job2 start running once all pod replicas related to module2 are ready

I try post-install and post-upgrade hooks but this will start jobs after all pods of module1 and module2 are all ready

I found one solution that is not recommended is to use "kubectl" in "initContainers" to verify all the pods related to module1 are ready or not.

Are there any additional recommendations or suggestions please ?

Malak123
  • 1
  • 1
  • 1
    Have you looked at [Chart Hooks](https://helm.sh/docs/topics/charts_hooks/)? – HiroCereal Apr 17 '23 at 13:26
  • 1
    yes but hooks does not resolve the above order expected – Malak123 Apr 17 '23 at 14:04
  • 1
    Have a look to this comment: https://stackoverflow.com/a/51962615/21404450 – glv Apr 17 '23 at 16:00
  • Additionally, from the same link provided by @HiroCereal: `It is possible to define a weight for a hook which will help build a deterministic executing order. Weights are defined using the following annotation: "helm.sh/hook-weight": "5"` – Blender Fox Apr 18 '23 at 06:07

0 Answers0