Skip to content

Commit

Permalink
feat: all-in-one manifests migrations job improvement (#4116)
Browse files Browse the repository at this point in the history
kong migrations bootstrap alone works fine when installing a fresh instance of 
KIC with DB-backed Kong. It doesn't work though when we'd like to upgrade and
keep the DB state between the upgrades, because it only bootstraps a fresh
database - when there is one already in existence, it just returns.

This PR aims to solve this issue by adding additional commands to the
migrations job: kong migrations up && kong migrations finish which will make
the job detect new migrations that need to be run after the upgrade and finish
them.
  • Loading branch information
czeslavo committed May 31, 2023
1 parent 92c6b81 commit 8f34e26
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,11 @@ Adding a new version? You'll need three changes:
- Gateway's `AttachedRoutes` fields get updated with the number of routes referencing
and using each listener.
[#4052](https://github.com/Kong/kubernetes-ingress-controller/pull/4052)
- `all-in-one-postgres.yaml` and `all-in-one-postgres-enterprise.yaml` manifests'
migrations job now works properly when running against an already bootstrapped
database, allowing upgrades from one version of Kong Gateway to another without
tearing down the database.
[#4116](https://github.com/Kong/kubernetes-ingress-controller/pull/4116)

### Changed

Expand Down
2 changes: 1 addition & 1 deletion config/variants/postgres/migration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ spec:
value: postgres
- name: KONG_PG_PORT
value: "5432"
command: [ "/bin/bash", "-c", "kong migrations bootstrap" ]
command: [ "/bin/bash", "-c", "kong migrations bootstrap && kong migrations up && kong migrations finish" ]
restartPolicy: OnFailure
2 changes: 1 addition & 1 deletion deploy/single/all-in-one-postgres-enterprise.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1923,7 +1923,7 @@ spec:
- command:
- /bin/bash
- -c
- kong migrations bootstrap
- kong migrations bootstrap && kong migrations up && kong migrations finish
env:
- name: KONG_LICENSE_DATA
valueFrom:
Expand Down
2 changes: 1 addition & 1 deletion deploy/single/all-in-one-postgres.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1860,7 +1860,7 @@ spec:
- command:
- /bin/bash
- -c
- kong migrations bootstrap
- kong migrations bootstrap && kong migrations up && kong migrations finish
env:
- name: KONG_PG_PASSWORD
value: kong
Expand Down

0 comments on commit 8f34e26

Please sign in to comment.