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

   ### Apache Airflow Helm Chart version
   
   1.16.0
   
   ### Apache Airflow version
   
   2.10.5
   
   ### Kubernetes Version
   
   1.28+
   
   ### Helm Chart configuration (Helm values)
   
   ```yaml
   workers:
     persistence:
       enabled: true
     volumeClaimTemplates:
       - metadata:
           name: data
         spec:
           storageClassName: longhorn
           accessModes: ["ReadWriteOnce"]
           resources:
             requests:
               storage: 10Gi
     extraVolumeMounts:
       - name: data
         mountPath: /data
   ```
   
   ### Docker Image customizations
   
   _No response_
   
   ### What happened
   
   It is impossible to add custom `volumeClaimTemplates` to workers (e.g., for 
a `/data` volume) due to the template logic.
   
   The worker resource type and volumeClaimTemplates behavior depends on 
`workers.persistence.enabled`:
   
   | `persistence.enabled` | Resource Type | Custom volumeClaimTemplates |
   |----------------------|---------------|----------------------------|
   | `true` (default) | StatefulSet | Only renders default `logs` PVC, custom 
templates ignored |
   | `false` | Deployment | Deployments do not support volumeClaimTemplates |
   
   **Result:** There is no configuration that allows adding custom persistent 
volumes to workers.
   
   ### What you think should happen instead
   
   Users should be able to add custom `volumeClaimTemplates` (e.g., for 
`/data`) alongside the default `logs` volume when using a StatefulSet.
   
   When `persistence.enabled: true`, the StatefulSet should append custom 
`volumeClaimTemplates`:
   
   ```yaml
   volumeClaimTemplates:
     - apiVersion: v1
       kind: PersistentVolumeClaim
       metadata:
         name: logs
       spec:
         ...
     {{- with .Values.workers.volumeClaimTemplates }}
       {{- toYaml . | nindent 4 }}
     {{- end }}
   ```
   
   ### How to reproduce
   
   1. Deploy the chart with the configuration above
   2. Pod fails with error: `volumeMounts[0].name: Not found: "data"`
   3. Setting `persistence.enabled: false` creates a Deployment instead, which 
does not support volumeClaimTemplates at all
   
   ### Root Cause
   
   In `templates/workers/worker-deployment.yaml`, the volumeClaimTemplates 
block with custom templates is only rendered in the `{{- else if not 
$persistence }}` branch, but that branch creates a Deployment, not a 
StatefulSet.
   
   ### 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