I am installing Astronomer Airflow using the Helm chart and have a question regarding start up. When I run the installation and watch the pods I can see the scheduler start but eventually crash. When I examine the logs of wait-for-airflow-migrations I can see that it times out:
[2021-04-26 20:19:06,234] {command_line.py:39} INFO - Waiting for migrations... 60 second(s)
Traceback (most recent call last):
File "/usr/local/bin/airflow-migration-spinner", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.7/site-packages/astronomer/migration_spinner/command_line.py", line 47, in main
spinner(args.timeout)
File "/usr/local/lib/python3.7/site-packages/astronomer/migration_spinner/command_line.py", line 35, in spinner
"There are still unapplied migrations after {} seconds".format(timeout)
TimeoutError: There are still unapplied migrations after 60 seconds
When I watch the pods I never see run-airflow-migrations launch. When I look at the annotations for that job I can see that the helm.sh/hook is post-install,post-upgrade which indicates that its supposed to run after everything else is installed. So is wait-for-airflow-migrations actually waiting for run-airflow-migrations, but if so how does that reconcile with migration hooks?
One other thing, the database I am using was formerly used tied to a pre-2.0 Airflow installation. Could this be my issue?
You can ignore this. I rebuilt my chart and the problem went away. I must have introduced an error when I was tweaking the chart to conform with our Kubernetes cluster.
@paola Actually I discovered its a Terraform issue (the helm CLI works but the Terraform helm_release resource does not). I will file a bug report with them.
@cmukai if you donât mind linking the bug report here, thatâd be helpful! Iâm also encountering the same error, trying to get Airflow 2 on my Kubernetes cluster via Terraformâs helm_release (Iâm on the Helm provider >2.0), so Iâm trying to figure out if the errors Iâm seeing were the ones you were seeing.
@johntam I just did the switch this morning in my Terraform (use null_resource/local_exec instead of helm_release) and it works. But this is definitely sub-optimal since null_resource is not idempotent without me doing some scripting to check if the release exists or not.
Just tried this myself, @cmukai â youâre right, Terraformâs helm_release doesnât succeed, and I did this via Helm CLI, and it deployed properly. So strange. I might try your null_resource/local_exec strategy.
If you link your Terraform bug report, happy to +1 or give some more data points for the Hashicorp team, might even dig into the bug myself since this might become a blocker for me.
This helm hooks runs the airflow db init command which creates the databased schema for airflow. This bug of helm-relese effects all of the airflow helm charts (official, astronomer, airflow-helm)