-
Notifications
You must be signed in to change notification settings - Fork 42k
Description
What would you like to be added?
A common pattern is to include the release phase (e.g. database migrations) inside a Job.
Then you need to wait until the migration is completed before starting the new pods: you can use an InitContainer for that.
For example if you use Rails you can:
- Create a Job (e.g.
migration-job) withrails db:migratecommand - Inside the Deployment (e.g. web app), add an InitContainer that waits for the condition
rake db:abort_if_pending_migrations(this command returns success only when the migrations are complete)
The problem is that not all commands (in step 1) have a corresponding "check" command (in step 2). It can be extremely hard for some commands to find a separate command in step 2 that verifies their completion.
It would be much easier if we could simply wait for a Job to become Complete before starting the pods (in step 2).
Why is this needed?
InitContainers are a great way to wait for a general condition to be met, but it is difficult to check a condition for a Kubernetes component (like a Job).
One of the most common conditions is a Job completion, but currently there's no way to express that in Kubernetes (e.g. waitFor: migration-job). This could be something similar to what kubectl wait does on the client side, but inside the spec.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status