[stable/kong] run migration when Kong is updated via Helm #9047
Conversation
ping @shashiranjan84 |
Whenever Kong is updated using Helm, we need to ensure that migrations are run. For this purpose, a change has been made to run migrations using a pre-upgrade hook. The migration Job is being duplicated to avoid a cyclic dependency that arises with use of pre-install or post-install hooks as detailed below: Background: Kong uses a database to store configuration. The migrations for the database need to be run initially when Kong is installed and then on every upgrade. The pre-upgrade hooks solves the problem of running migrations on every upgrade. However, to run migrations during an installation has some challanges: - `pre-install` hook doesn't work in our case because, postgres deployment is not available in that phase. This means that the migration will never succeed and the deployment will always fail. - `post-install` hook introduces a cyclic dependency on the Kong container to start. `post-install` hook is executed only after all the deployments are in ready state. But the Kong deployment will not be ready till the migrations are run and migrations won't run till Kong deployment is ready. To overcome this, we are going to use two Jobs. One, which is executed when the Kong is initially installed and then the another one, which is used on every upgrade. Signed-off-by: Harry Bagdi <harrybagdi@gmail.com>
a19d149
to
5c2efdb
Compare
/lgtm |
@hbagdi: you cannot LGTM your own PR. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: hbagdi, shashiranjan84 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Whenever Kong is updated using Helm, we need to ensure that migrations are run. For this purpose, a change has been made to run migrations using a pre-upgrade hook. The migration Job is being duplicated to avoid a cyclic dependency that arises with use of pre-install or post-install hooks as detailed below: Background: Kong uses a database to store configuration. The migrations for the database need to be run initially when Kong is installed and then on every upgrade. The pre-upgrade hooks solves the problem of running migrations on every upgrade. However, to run migrations during an installation has some challanges: - `pre-install` hook doesn't work in our case because, postgres deployment is not available in that phase. This means that the migration will never succeed and the deployment will always fail. - `post-install` hook introduces a cyclic dependency on the Kong container to start. `post-install` hook is executed only after all the deployments are in ready state. But the Kong deployment will not be ready till the migrations are run and migrations won't run till Kong deployment is ready. To overcome this, we are going to use two Jobs. One, which is executed when the Kong is initially installed and then the another one, which is used on every upgrade. Signed-off-by: Harry Bagdi <harrybagdi@gmail.com>
Whenever Kong is updated using Helm, we need to ensure that migrations
are run.
For this purpose, a change has been made to run migrations using a
pre-upgrade hook.
The migration Job is being duplicated to avoid a cyclic dependency that
arises with use of pre-install or post-install hooks as detailed below:
Background:
Kong uses a database to store configuration. The migrations for the
database need to be run initially when Kong is installed and then on
every upgrade.
The pre-upgrade hooks solves the problem of running migrations on every
upgrade.
However, to run migrations during an installation has some challanges:
pre-install
hook doesn't work in our case because, postgresdeployment is not available in that phase. This means that the migration
will never succeed and the deployment will always fail.
post-install
hook introduces a cyclic dependency on the Kongcontainer to start.
post-install
hook is executed only after all thedeployments are in ready state. But the Kong deployment will not be
ready till the migrations are run and migrations won't run till Kong
deployment is ready.
To overcome this, we are going to use two Jobs. One, which is executed
when the Kong is initially installed and then the another one, which is
used on every upgrade.
Signed-off-by: Harry Bagdi harrybagdi@gmail.com
What this PR does / why we need it:
Which issue this PR fixes
(optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close that issue when PR gets merged)Special notes for your reviewer:
Checklist
[Place an '[x]' (no spaces) in all applicable fields. Please remove unrelated fields.]