-
Notifications
You must be signed in to change notification settings - Fork 593
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(deploy) use Job to run migrations for Kong
Using InitContainer can result in two Kong nodes running migrations concurrently. Job is the right way to run migrations. From #161
- Loading branch information
Showing
4 changed files
with
64 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: kong-migrations | ||
namespace: kong | ||
spec: | ||
template: | ||
metadata: | ||
name: kong-migrations | ||
spec: | ||
initContainers: | ||
- name: wait-for-postgres | ||
image: busybox | ||
env: | ||
- name: KONG_PG_HOST | ||
value: postgres | ||
- name: KONG_PG_PORT | ||
value: "5432" | ||
command: [ "/bin/sh", "-c", "until nc -zv $KONG_PG_HOST $KONG_PG_PORT -w1; do echo 'waiting for db'; sleep 1; done" ] | ||
containers: | ||
- name: kong-migrations | ||
image: kong:0.14.1-centos | ||
env: | ||
- name: KONG_PG_PASSWORD | ||
value: kong | ||
- name: KONG_PG_HOST | ||
value: postgres | ||
- name: KONG_PG_PORT | ||
value: "5432" | ||
command: [ "/bin/sh", "-c", "kong migrations up" ] | ||
restartPolicy: OnFailure |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters