calebwoofenden commented on issue #11979:
URL: https://github.com/apache/airflow/issues/11979#issuecomment-1301248754
I am running into the same issue. My solution was to set this value in the
helm chart:
```
migrateDatabaseJob:
useHelmHooks: false
```
This solves the problem raised in this issue since it no longer uses the
pre-install hook for the migrate db job.
However, I now see an issue sometimes when running `helm upgrade --install`
to patch an existing helm install where it's trying to patch the `Job`
resource, which cannot be done since `Job`s are immutable. This causes the helm
install to fail. What should be happening is either the `Job` gets a unique ID
with each helm installation so that it's not trying to edit an existing `Job`,
or the `Job` should be destroyed after it completes. One of the helm hooks that
gets added to the job is
```
"helm.sh/hook-delete-policy" "before-hook-creation,hook-succeeded"
```
which I think will handle deleting the `Job` upon completion, but we can't
use the helm hooks for the above reasons. Kube does offer a parameter called
`.spec.ttlSecondsAfterFinished` that, when specified, will delete the `Job`
after the specified number of seconds after completion (see
https://kubernetes.io/docs/concepts/workloads/controllers/ttlafterfinished/).
This is a pretty good solution, though installs done in a period of time
shorter than this value might still run into the same problem.
The solution I propose here is to set a helm pre-install hook on the
database deployment as well as the db migrations, and set the hook weight on
the database lower than that of the migrations, so the database will be created
first, then the migrations will run, then the webserver and etc. pods will come
up. Then I think we could safely remove the `wait-for-db-migrations`
initContainer on the deployments.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]