csp33 commented on issue #36326:
URL: https://github.com/apache/airflow/issues/36326#issuecomment-1865889922
To make hostname match the pod name, I'm currently using this workaround:
1. Create the following file. Name it `airflow_hostname.py`
```python
import os
# This workaround is necessary until
https://github.com/apache/airflow/issues/36326 is solved
def get_hostname() -> str:
return os.environ["POD_NAME"]
```
2. In your Dockerfile, add the following instructions. Replace `python3.11`
by the Python version you're using.
```dockerfile
# Workaround until https://github.com/apache/airflow/issues/36326 is solved
COPY airflow_hostname.py
/home/airflow/.local/lib/python3.11/site-packages/airflow-hostname/airflow_hostname.py
```
3. Add the following code to `values.yaml`
```yaml
extraEnv: |
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
config:
core:
hostname_callable: airflow-hostname.airflow_hostname.get_hostname #
Workaround until https://github.com/apache/airflow/issues/36326 is solved
```
By applying these changes, we're bypassing the hostname size limit by
injecting the `POD_NAME` into an environment variable.
--
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]