We have a scenario in our deployment process where an activity needs to be performed only once before the actual application containers are live and ready. This activity can not be placed as an init container because init container will be executed with every replica of application container but in this case, this activity needs to be done only once.
To achieve this, I have created a kubernetes job which executes that activity and completes.
Is there a way to check in my application container deployment definition that this particular Job has been completed? Are there any pre-defined keys in kubernetes which stores this metadata information and can be used to identify the job status?
This Job is using a configMap and the container used in this Job loads the configuration files (provided by configMap) in Directory Server. Is there a way to trigger the job automatically if configMap changes? I can delete the job and recreate using kubectl but I am looking for an auto trigger. Is there any possible way available in OpenShift or HELM to do this if not in Kubernetes?
When a ConfigMap already being consumed in a volume is updated, projected keys are eventually updated as well. refer Mounted ConfigMap on official kubernetes docs.
And for some kind of auto-trigger you can try using CronJob option say based on a time-based if you know your data changes every tow hours or every midnight.
Helm has post-deploy hooks for this kind of thing, though they can be a little rough to work with. We use a custom operator for this so we can have an explicit state machine on our deployments (init -> migrate -> deploy -> test -> ready). But that's a lot of work to write.