I'm new in Kubernates/Openshift. I was wondering if that was possible to read a job state from another job.
-> job 1 : some work on a database with the help of some deployed pods.
-> job 2 : database dump and exposing it elsewhere, once the job 1 is finished.
For example, I need to deploy the job 1
which launch pods and does some work and modify a database.
As this job is terminated, I want to save the new state of the database.
So my idea is to deploy both job 1
and job 2
at the same time from gitlab CI, and make the job 2
waiting until the job 1
state goes to Completed
.
I read some doc on OpenShift probes, but it does not seem to be the good way to do that as there are only readiness
and liveness
probes.
I see that it is possible to suspend a job until it is reactivated (https://kubernetes.io/docs/concepts/workloads/controllers/job/), but the way to reactivate it is only using the kubectl
or oc
client. So this make me install the cli on my docker image (perhaps ?)
I think I could put a job1_running
file a persistant volume claim shared by both of jobs and try to test this file existance within job 2
script, but I dont't know if this is the best approach ?