calebwoofenden opened a new issue, #27561:
URL: https://github.com/apache/airflow/issues/27561

   ### Apache Airflow version
   
   2.4.2
   
   ### What happened
   
   Running `helm upgrade` with helm hooks disabled in a namespace that already 
has the chart installed will fail because it's trying to patch a `Job` 
resource, which is immutable:
   
   ```
   cannot patch "<release_name>-run-airflow-migrations" with kind Job: 
Job.batch "<release_name>-run-airflow-migrations" is invalid: spec.template: 
Invalid value: core.PodTemplateSpec {<...entire json spec of Job resource...>}: 
field is immutable
   ```
   
   This happens when helm hooks are disabled on the db migrations job:
   ```
     migrateDatabaseJob:
       useHelmHooks: false
   ```
   
   For more detail on why a user would want to do this, see 
https://github.com/apache/airflow/issues/11979
   
   Copying this from my comment on that issue:
   
   > 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.
   
   ### What you think should happen instead
   
   _No response_
   
   ### How to reproduce
   
   _No response_
   
   ### Operating System
   
   MacOS/Linux
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Deployment
   
   Official Apache Airflow Helm Chart
   
   ### Deployment details
   
   _No response_
   
   ### Anything else
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
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]

Reply via email to