jiajie-chen opened a new issue, #35201:
URL: https://github.com/apache/airflow/issues/35201

   ### Official Helm Chart version
   
   1.11.0 (latest released)
   
   ### Apache Airflow version
   
   v2.7.1
   
   ### Kubernetes Version
   
   v1.27.4 (minikube v1.31.2)
   
   ### Helm Chart configuration
   
   Enable the new standard naming option:
   ```yaml
   useStandardNaming: true
   ```
   
   Using `my-dag-test` as the Helm release name.
   
   ### Docker Image customizations
   
   No docker customization, using default image from Helm.
   
   ### What happened
   
   When deploying the Helm chart, the Airflow worker crashes and restarts as it 
cannot find the Redis broker URL.
   
   The Celery worker logs show the following:
   ```
   ... : ERROR/MainProcess] consumer: Cannot connect to 
redis://:**@my-dag-test-redis:6379/0: Error -2 connecting to 
my-dag-test-redis:6379. Name or service not known.
   ...
   ```
   
   The Redis service name shows: `my-dag-test-airflow-redis`
   
   The broker URL secret shows: `redis://:***@my-dag-test-redis:6379/0`
   
   ### What you think should happen instead
   
   The chart should template the correct Redis service name (and port) for the 
broker URL secret.
   
   ### How to reproduce
   
   Install a new Airflow release using Helm, with the following value overrides 
and release name:
   ```bash
   helm upgrade \
     --install my-dag-test apache-airflow/airflow \
     --namespace airflow --create-namespace \
     --set 'useStandardNaming=true'
   ```
   
   Compare the broker URL secret with the Redis service:
   ```bash
   kubectl get secret --namespace airflow my-dag-test-broker-url -o 
jsonpath='{.data.connection}' | base64 --decode
   
   kubectl get service --namespace airflow my-dag-test-airflow-redis -o 
jsonpath='{.metadata.name}'
   ```
   
   Wait for the Airflow worker to start, and read the container logs:
   ```bash
   kubectl logs --namespace airflow statefulset/my-dag-test-airflow-worker 
--container worker
   ```
   
   ### Anything else
   
   The Redis service name is defined here as `{{ include "airflow.fullname" . 
}}-redis`:
   - 
https://github.com/apache/airflow/blob/142e67c45485b25e988aced3cc37dd9cb2a8ab71/chart/templates/redis/redis-service.yaml#L27
   
   The default broker URL is defined here as `(printf "%s-redis:6379" 
.Release.Name )`:
   - 
https://github.com/apache/airflow/blob/142e67c45485b25e988aced3cc37dd9cb2a8ab71/chart/templates/secrets/redis-secrets.yaml#L79
   
   If the Helm release name doesn't contain the chart name (`airflow`) then 
these won't match anymore.
   
   Changing the `printf` to something like this should fix the issue:
   ```
   (printf "%s-redis:%s" (include "airflow.fullname" .) .Values.ports.redisDB )
   ```
   
   Note that the broker URL should also template the correct `ports.redisDB` 
value.
   
   ### 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: commits-unsubscr...@airflow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to