<h3 dir="auto">Apache Airflow version</h3>
<p dir="auto">Other Airflow 2 version (please specify below)</p>
<h3 dir="auto">What happened</h3>
<p dir="auto">variables are getting duplicated on upgrading airflow to 2.5.3 from 2.4.1.<br>
after upgrade when the airflow-sync-variables pod runs its not finding the existing variables and then adding it again.</p>
<p dir="auto"><strong>logs from airflow-sync-variables:</strong></p>
<p dir="auto">/home/airflow/.local/lib/python3.8/site-packages/airflow/models/base.py:49 MovedIn20Warning: Deprecated API features detected! These feature(s) are not compatible with SQLAlchemy 2.0. To prevent incompatible upgrades prior to updating applications, ensure requirements files are pinned to "sqlalchemy&lt;2.0". Set environment variable SQLALCHEMY_WARN_20=1 to show all deprecation warnings.  Set environment variable SQLALCHEMY_SILENCE_UBER_WARNING=1 to silence this message. (Background on SQLAlchemy 2.0 at: <a href="https://sqlalche.me/e/b8d9" rel="nofollow">https://sqlalche.me/e/b8d9</a>)<br>
[�[34m2023-07-09 05:59:12,443�[0m] {�[34msync_variables.py:�[0m357} INFO�[0m - BEGIN: airflow variables sync�[0m<br>
[�[34m2023-07-09 05:59:14,521�[0m] {�[34msync_variables.py:�[0m336} INFO�[0m - Variable=<code class="notranslate">TEMP-BUCKET</code> is missing, adding...�[0m<br>
[�[34m2023-07-09 05:59:14,534�[0m] {�[34msync_variables.py:�[0m348} INFO�[0m - Variable=<code class="notranslate">TEMP-BUCKET</code> was successfully added.�[0m<br>
[�[34m2023-07-09 05:59:14,538�[0m] {�[34msync_variables.py:�[0m336} INFO�[0m - Variable=<code class="notranslate">PERSPECTIVE-BUCKET</code> is missing, adding...�[0m<br>
[�[34m2023-07-09 05:59:14,546�[0m] {�[34msync_variables.py:�[0m348} INFO�[0m - Variable=<code class="notranslate">PERSPECTIVE-BUCKET</code> was successfully added.�[0m<br>
[�[34m2023-07-09 05:59:14,550�[0m] {�[34msync_variables.py:�[0m336} INFO�[0m - Variable=<code class="notranslate">TAMR_INPUT_BUCKET_NAME</code> is missing, adding...�[0m<br>
[�[34m2023-07-09 05:59:14,553�[0m] {�[34msync_variables.py:�[0m348} INFO�[0m - Variable=<code class="notranslate">TAMR_INPUT_BUCKET_NAME</code> was successfully added.�[0m<br>
[�[34m2023-07-09 05:59:14,562�[0m] {�[34msync_variables.py:�[0m336} INFO�[0m - Variable=<code class="notranslate">TAMR_OUTPUT_BUCKET_NAME</code> is missing, adding...�[0m<br>
[�[34m2023-07-09 05:59:14,573�[0m] {�[34msync_variables.py:�[0m348} INFO�[0m - Variable=<code class="notranslate">TAMR_OUTPUT_BUCKET_NAME</code> was successfully added.�[0m<br>
[�[34m2023-07-09 05:59:14,577�[0m] {�[34msync_variables.py:�[0m336} INFO�[0m - Variable=<code class="notranslate">RAW-BUCKET</code> is missing, adding...�[0m<br>
[�[34m2023-07-09 05:59:14,580�[0m] {�[34msync_variables.py:�[0m348} INFO�[0m - Variable=<code class="notranslate">RAW-BUCKET</code> was successfully added.�[0m<br>
[�[34m2023-07-09 05:59:14,585�[0m] {�[34msync_variables.py:�[0m336} INFO�[0m - Variable=<code class="notranslate">EXTRACTED-BUCKET</code> is missing, adding...�[0m<br>
[�[34m2023-07-09 05:59:14,589�[0m] {�[34msync_variables.py:�[0m348} INFO�[0m - Variable=<code class="notranslate">EXTRACTED-BUCKET</code> was successfully added.�[0m<br>
[�[34m2023-07-09 05:59:14,592�[0m] {�[34msync_variables.py:�[0m336} INFO�[0m - Variable=<code class="notranslate">CATEGORIZED-BUCKET</code> is missing, adding...�[0m<br>
[�[34m2023-07-09 05:59:14,596�[0m] {�[34msync_variables.py:�[0m348} INFO�[0m - Variable=<code class="notranslate">CATEGORIZED-BUCKET</code> was successfully added.�[0m<br>
[�[34m2023-07-09 05:59:14,600�[0m] {�[34msync_variables.py:�[0m336} INFO�[0m - Variable=<code class="notranslate">STRUCTURED-BUCKET</code> is missing, adding...�[0m<br>
[�[34m2023-07-09 05:59:14,603�[0m] {�[34msync_variables.py:�[0m348} INFO�[0m - Variable=<code class="notranslate">STRUCTURED-BUCKET</code> was successfully added.�[0m<br>
[�[34m2023-07-09 05:59:14,608�[0m] {�[34msync_variables.py:�[0m336} INFO�[0m - Variable=<code class="notranslate">STANDARD-BUCKET</code> is missing, adding...�[0m<br>
[�[34m2023-07-09 05:59:14,612�[0m] {�[34msync_variables.py:�[0m348} INFO�[0m - Variable=<code class="notranslate">STANDARD-BUCKET</code> was successfully added.�[0m<br>
[�[34m2023-07-09 05:59:14,616�[0m] {�[34msync_variables.py:�[0m336} INFO�[0m - Variable=<code class="notranslate">NPD_DATE</code> is missing, adding...�[0m<br>
[�[34m2023-07-09 05:59:14,619�[0m] {�[34msync_variables.py:�[0m348} INFO�[0m - Variable=<code class="notranslate">NPD_DATE</code> was successfully added.�[0m<br>
[�[34m2023-07-09 05:59:14,623�[0m] {�[34msync_variables.py:�[0m336} INFO�[0m - Variable=<code class="notranslate">SPARK-KUBERNETES-ANNOTATION</code> is missing, adding...�[0m<br>
[�[34m2023-07-09 05:59:14,631�[0m] {�[34msync_variables.py:�[0m348} INFO�[0m - Variable=<code class="notranslate">SPARK-KUBERNETES-ANNOTATION</code> was successfully added.�[0m<br>
[�[34m2023-07-09 05:59:14,635�[0m] {�[34msync_variables.py:�[0m336} INFO�[0m - Variable=<code class="notranslate">SPARK-DRIVER-MEMORY</code> is missing, adding...�[0m<br>
[�[34m2023-07-09 05:59:14,638�[0m] {�[34msync_variables.py:�[0m348} INFO�[0m - Variable=<code class="notranslate">SPARK-DRIVER-MEMORY</code> was successfully added.�[0m<br>
[�[34m2023-07-09 05:59:14,641�[0m] {�[34msync_variables.py:�[0m336} INFO�[0m - Variable=<code class="notranslate">SPARK-EXECUTOR-MEMORY</code> is missing, adding...�[0m<br>
[�[34m2023-07-09 05:59:14,645�[0m] {�[34msync_variables.py:�[0m348} INFO�[0m - Variable=<code class="notranslate">SPARK-EXECUTOR-MEMORY</code> was successfully added.�[0m<br>
[�[34m2023-07-09 05:59:14,648�[0m] {�[34msync_variables.py:�[0m336} INFO�[0m - Variable=<code class="notranslate">SPARK-EXECUTOR-CORES</code> is missing, adding...�[0m<br>
[�[34m2023-07-09 05:59:14,653�[0m] {�[34msync_variables.py:�[0m348} INFO�[0m - Variable=<code class="notranslate">SPARK-EXECUTOR-CORES</code> was successfully added.�[0m<br>
[�[34m2023-07-09 05:59:14,656�[0m] {�[34msync_variables.py:�[0m336} INFO�[0m - Variable=<code class="notranslate">SPARK-NUM-EXECUTORS</code> is missing, adding...�[0m<br>
[�[34m2023-07-09 05:59:14,659�[0m] {�[34msync_variables.py:�[0m348} INFO�[0m - Variable=<code class="notranslate">SPARK-NUM-EXECUTORS</code> was successfully added.�[0m<br>
[�[34m2023-07-09 05:59:14,662�[0m] {�[34msync_variables.py:�[0m336} INFO�[0m - Variable=<code class="notranslate">DATACURATION-OUTPUT-BUCKET</code> is missing, adding...�[0m<br>
[�[34m2023-07-09 05:59:14,665�[0m] {�[34msync_variables.py:�[0m348} INFO�[0m - Variable=<code class="notranslate">DATACURATION-OUTPUT-BUCKET</code> was successfully added.�[0m<br>
[�[34m2023-07-09 05:59:14,671�[0m] {�[34msync_variables.py:�[0m336} INFO�[0m - Variable=<code class="notranslate">ENT_NTFN_USER</code> is missing, adding...�[0m<br>
[�[34m2023-07-09 05:59:14,676�[0m] {�[34msync_variables.py:�[0m348} INFO�[0m - Variable=<code class="notranslate">ENT_NTFN_USER</code> was successfully added.�[0m<br>
[�[34m2023-07-09 05:59:14,694�[0m] {�[34msync_variables.py:�[0m336} INFO�[0m - Variable=<code class="notranslate">ENT_NTFN_CONSUMER_COUNT</code> is missing, adding...�[0m<br>
[�[34m2023-07-09 05:59:14,698�[0m] {�[34msync_variables.py:�[0m348} INFO�[0m - Variable=<code class="notranslate">ENT_NTFN_CONSUMER_COUNT</code> was successfully added.�[0m<br>
[�[34m2023-07-09 05:59:14,710�[0m] {�[34msync_variables.py:�[0m336} INFO�[0m - Variable=<code class="notranslate">MYID_BASE_URL</code> is missing, adding...�[0m<br>
[�[34m2023-07-09 05:59:14,714�[0m] {�[34msync_variables.py:�[0m348} INFO�[0m - Variable=<code class="notranslate">MYID_BASE_URL</code> was successfully added.�[0m<br>
[�[34m2023-07-09 05:59:14,727�[0m] {�[34msync_variables.py:�[0m336} INFO�[0m - Variable=<code class="notranslate">DATALAKE_BUCKET</code> is missing, adding...�[0m<br>
[�[34m2023-07-09 05:59:14,731�[0m] {�[34msync_variables.py:�[0m348} INFO�[0m - Variable=<code class="notranslate">DATALAKE_BUCKET</code> was successfully added.�[0m<br>
[�[34m2023-07-09 05:59:14,735�[0m] {�[34msync_variables.py:�[0m336} INFO�[0m - Variable=<code class="notranslate">BITPULSE_WEBBITS_DATALAKE_PATH</code> is missing, adding...�[0m<br>
[�[34m2023-07-09 05:59:14,744�[0m] {�[34msync_variables.py:�[0m348} INFO�[0m - Variable=<code class="notranslate">BITPULSE_WEBBITS_DATALAKE_PATH</code> was successfully added.�[0m<br>
[�[34m2023-07-09 05:59:14,749�[0m] {�[34msync_variables.py:�[0m336} INFO�[0m - Variable=<code class="notranslate">UOM_DOCKER_IMAGE</code> is missing, adding...�[0m<br>
[�[34m2023-07-09 05:59:14,753�[0m] {�[34msync_variables.py:�[0m348} INFO�[0m - Variable=<code class="notranslate">UOM_DOCKER_IMAGE</code> was successfully added.�[0m<br>
[�[34m2023-07-09 05:59:14,757�[0m] {�[34msync_variables.py:�[0m336} INFO�[0m - Variable=<code class="notranslate">UOM_NAMESPACE</code> is missing, adding...�[0m<br>
[�[34m2023-07-09 05:59:14,760�[0m] {�[34msync_variables.py:�[0m348} INFO�[0m - Variable=<code class="notranslate">UOM_NAMESPACE</code> was successfully added.�[0m<br>
[�[34m2023-07-09 05:59:14,765�[0m] {�[34msync_variables.py:�[0m336} INFO�[0m - Variable=<code class="notranslate">UOM_MAPPING_FILE_PATH</code> is missing, adding...�[0m<br>
[�[34m2023-07-09 05:59:14,768�[0m] {�[34msync_variables.py:�[0m348} INFO�[0m - Variable=<code class="notranslate">UOM_MAPPING_FILE_PATH</code> was successfully added.�[0m<br>
[�[34m2023-07-09 05:59:14,774�[0m] {�[34msync_variables.py:�[0m360} INFO�[0m - END: airflow variables sync�[0m<br>
[�[34m2023-07-09 06:00:14,864�[0m] {�[34msync_variables.py:�[0m357} INFO�[0m - BEGIN: airflow variables sync�[0m<br>
[�[34m2023-07-09 06:00:14,917�[0m] {�[34msync_variables.py:�[0m336} INFO�[0m - Variable=<code class="notranslate">STRUCTURED-BUCKET</code> is missing, adding...�[0m<br>
[�[34m2023-07-09 06:00:14,921�[0m] {�[34msync_variables.py:�[0m348} INFO�[0m - Variable=<code class="notranslate">STRUCTURED-BUCKET</code> was successfully added.�[0m<br>
[�[34m2023-07-09 06:00:14,952�[0m] {�[34msync_variables.py:�[0m336} INFO�[0m - Variable=<code class="notranslate">SPARK-EXECUTOR-CORES</code> is missing, adding...�[0m<br>
[�[34m2023-07-09 06:00:14,958�[0m] {�[34msync_variables.py:�[0m348} INFO�[0m - Variable=<code class="notranslate">SPARK-EXECUTOR-CORES</code> was successfully added.�[0m<br>
[�[34m2023-07-09 06:00:14,990�[0m] {�[34msync_variables.py:�[0m336} INFO�[0m - Variable=<code class="notranslate">ENT_NTFN_CONSUMER_COUNT</code> is missing, adding...�[0m<br>
[�[34m2023-07-09 06:00:14,994�[0m] {�[34msync_variables.py:�[0m348} INFO�[0m - Variable=<code class="notranslate">ENT_NTFN_CONSUMER_COUNT</code> was successfully added.�[0m<br>
[�[34m2023-07-09 06:00:15,013�[0m] {�[34msync_variables.py:�[0m336} INFO�[0m - Variable=<code class="notranslate">MYID_REDIRECT_BASE_URL</code> is missing, adding...�[0m<br>
[�[34m2023-07-09 06:00:15,016�[0m] {�[34msync_variables.py:�[0m348} INFO�[0m - Variable=<code class="notranslate">MYID_REDIRECT_BASE_URL</code> was successfully added.�[0m<br>
[�[34m2023-07-09 06:00:15,035�[0m] {�[34msync_variables.py:�[0m336} INFO�[0m - Variable=<code class="notranslate">UOM_DOCKER_IMAGE</code> is missing, adding...�[0m<br>
[�[34m2023-07-09 06:00:15,040�[0m] {�[34msync_variables.py:�[0m348} INFO�[0m - Variable=<code class="notranslate">UOM_DOCKER_IMAGE</code> was successfully added.�[0m<br>
[�[34m2023-07-09 06:00:15,044�[0m] {�[34msync_variables.py:�[0m336} INFO�[0m - Variable=<code class="notranslate">UOM_NAMESPACE</code> is missing, adding...�[0m<br>
[�[34m2023-07-09 06:00:15,048�[0m] {�[34msync_variables.py:�[0m348} INFO�[0m - Variable=<code class="notranslate">UOM_NAMESPACE</code> was successfully added.�[0m<br>
[�[34m2023-07-09 06:00:15,058�[0m] {�[34msync_variables.py:�[0m360} INFO�[0m - END: airflow variables sync�[0m<br>
[�[34m2023-07-09 06:01:15,132�[0m] {�[34msync_variables.py:�[0m357} INFO�[0m - BEGIN: airflow variables sync�[0m<br>
[�[34m2023-07-09 06:01:15,256�[0m] {�[34msync_variables.py:�[0m336} INFO�[0m - Variable=<code class="notranslate">ENT_NTFN_CONSUMER_COUNT</code> is missing, adding...�[0m<br>
[�[34m2023-07-09 06:01:15,260�[0m] {�[34msync_variables.py:�[0m348} INFO�[0m - Variable=<code class="notranslate">ENT_NTFN_CONSUMER_COUNT</code> was successfully added.�[0m<br>
[�[34m2023-07-09 06:01:15,323�[0m] {�[34msync_variables.py:�[0m360} INFO�[0m - END: airflow variables sync�[0m<br>
[�[34m2023-07-09 06:02:15,419�[0m] {�[34msync_variables.py:�[0m357} INFO�[0m - BEGIN: airflow variables sync�[0m</p>
<h3 dir="auto">What you think should happen instead</h3>
<p dir="auto">After upgrade when the airflow-sync-variables pod runs it should finding the existing variables and skip creating it again.</p>
<h3 dir="auto">How to reproduce</h3>
<p dir="auto">downgrade the airflow to 2.4.1 where its working<br>
upgrade it to airflow 2.5.3   once we sync the airflow-sync-variables pod the variables will be duplicated in the UI and in database variable table.</p>
<h3 dir="auto">Operating System</h3>
<p dir="auto">N/A</p>
<h3 dir="auto">Versions of Apache Airflow Providers</h3>
<p dir="auto"><strong>on airflow 2.4.1 before upgrade</strong></p>
<p dir="auto">apache-airflow-providers-amazon	5.1.0<br>
apache-airflow-providers-apache-livy 2.2.3<br>
apache-airflow-providers-celery	3.0.0<br>
apache-airflow-providers-cncf-kubernetes 4.4.0<br>
apache-airflow-providers-common-sql	1.2.0<br>
apache-airflow-providers-docker	3.2.0<br>
apache-airflow-providers-elasticsearch	4.2.1<br>
apache-airflow-providers-ftp	3.1.0<br>
apache-airflow-providers-google	8.3.0<br>
apache-airflow-providers-grpc	3.0.0<br>
apache-airflow-providers-hashicorp	3.1.0<br>
apache-airflow-providers-http	4.0.0<br>
apache-airflow-providers-imap	3.0.0<br>
apache-airflow-providers-microsoft-azure 4.3.0<br>
apache-airflow-providers-mysql	3.2.1<br>
apache-airflow-providers-odbc	3.1.2<br>
apache-airflow-providers-postgres	5.2.2<br>
apache-airflow-providers-redis	3.0.0<br>
apache-airflow-providers-sendgrid	3.0.0<br>
apache-airflow-providers-sftp	4.1.0<br>
apache-airflow-providers-slack	5.1.0<br>
apache-airflow-providers-sqlite	3.2.1<br>
apache-airflow-providers-ssh 3.2.0</p>
<p dir="auto"><strong>on 2.5.3 after upgrade</strong></p>
<p dir="auto">apache-airflow-providers-amazon	5.1.0<br>
apache-airflow-providers-apache-livy 2.2.3<br>
apache-airflow-providers-celery	3.2.0<br>
apache-airflow-providers-cncf-kubernetes 7.0.0<br>
apache-airflow-providers-common-sql	1.5.1<br>
apache-airflow-providers-docker	3.7.0<br>
apache-airflow-providers-elasticsearch 4.5.0<br>
apache-airflow-providers-ftp 3.4.1<br>
apache-airflow-providers-google	10.1.1<br>
apache-airflow-providers-grpc 3.2.0<br>
apache-airflow-providers-hashicorp 3.4.0<br>
apache-airflow-providers-http 4.4.1<br>
apache-airflow-providers-imap 3.2.1<br>
apache-airflow-providers-microsoft-azure 6.1.1<br>
apache-airflow-providers-odbc 3.3.0<br>
apache-airflow-providers-postgres 5.5.0<br>
apache-airflow-providers-redis 3.2.0<br>
apache-airflow-providers-sendgrid 3.2.0<br>
apache-airflow-providers-sftp	4.3.0<br>
apache-airflow-providers-slack	7.3.0<br>
apache-airflow-providers-snowflake	4.1.0<br>
apache-airflow-providers-sqlite	3.4.1<br>
apache-airflow-providers-ssh	3.7.0</p>
<h3 dir="auto">Deployment</h3>
<p dir="auto">Official Apache Airflow Helm Chart</p>
<h3 dir="auto">Deployment details</h3>
<p dir="auto">Airflow version 2.5.3</p>
<p dir="auto">currently working with helm charts from Airflow Helm Chart (User Community)<br>
<a href="https://artifacthub.io/packages/helm/airflow-helm/airflow/8.7.0" rel="nofollow">https://artifacthub.io/packages/helm/airflow-helm/airflow/8.7.0</a></p>
<p dir="auto">using Argocd as GitOps CD tool for Kubernetes.</p>
<h3 dir="auto">Anything else</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Are you willing to submit PR?</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Yes I am willing to submit a PR!</li>
</ul>
<h3 dir="auto">Code of Conduct</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I agree to follow this project's <a href="https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md">Code of Conduct</a></li>
</ul>
<p dir="auto"><strong>Description</strong><br>
Healthcheck endpoint returns 503 (Service Unavailable) when server is unhealthy.</p>

<p dir="auto"><strong>Use case / motivation</strong><br>
Current healthcheck api returns status code "200 (OK)"even if server is "unhealthy".<br>
It couldn't be working healthcheck correctly when some cloud services (like aws) which can periodically sends healthcheck requests to airflow.<br>
Because they are judging success or failure only seeing status code of api response. They don't see response body json at all.</p>

<p dir="auto"><strong>Are you willing to submit a PR?</strong><br>
Yup. But I'm not ready ready PR for this issue.</p>

<p dir="auto"><strong>Related Issues</strong></p>