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

   ### Official Helm Chart version
   
   1.18.0 (latest released)
   
   ### Apache Airflow version
   
   3.0.3
   
   ### Kubernetes Version
   
   1.23.15
   
   ### Helm Chart configuration
   
   > chart/files/pod-template-file.kubernetes-helm-yaml
   
   ```yaml
     {{- if and  .Values.dags.gitSync.enabled  
.Values.dags.gitSync.sshKeySecret }}
       {{- include "git_sync_ssh_key_volume" . | nindent 2 }}
     {{- end }}
   ```
   
   > values.yaml
   
   ```yaml
   # Git sync
   dags:
     # Where dags volume will be mounted. Works for both persistence and 
gitSync.
     # If not specified, dags mount path will be set to $AIRFLOW_HOME/dags
     mountPath: ~
     persistence:
       # Annotations for dags PVC
       annotations: {}
       # Enable persistent volume for storing dags
       enabled: false
       # Volume size for dags
       size: 5Gi
       # If using a custom storageClass, pass name here
       storageClassName: rbd-ssd-user
       # access mode of the persistent volume
       accessMode: ReadWriteOnce
       ## the name of an existing PVC to use
       existingClaim:
       ## optional subpath for dag volume mount
       subPath: ~
     gitSync:
       enabled: true
       repo: [email protected]:apache/airflow.git
       branch: deploy/airflow
       rev: HEAD
       ref: deploy/airflow
       depth: 1
       maxFailures: 0
       # If you are using an ssh clone url, you can load
       # the ssh private key to a k8s secret like the one below
       #   ---
       #   apiVersion: v1
       #   kind: Secret
       #   metadata:
       #     name: airflow-ssh-secret
       #   data:
       #     # key needs to be gitSshKey
       #     gitSshKey: <base64_encoded_data>
       # and specify the name of the secret below
       # sshKeySecret: airflow-ssh-secret
       #
       # Or set sshKeySecret with your key
       sshKey: |
         -----BEGIN OPENSSH PRIVATE KEY-----
   ```
   
   ### Docker Image customizations
   
   _No response_
   
   ### What happened
   
   In chart/files/pod-template-file.kubernetes-helm-yaml, the SSH key volume is 
only mounted when both
   
   ```yaml
   .Values.dags.gitSync.enabled
   .Values.dags.gitSync.sshKeySecret
   ```
   are set. If you supply an inline sshKey in your values.yaml (without 
sshKeySecret), the volume isn’t created and the Pod fails to start with an 
error like:
   
   ```
   spec.initContainers[0].volumeMounts[1].name: Not found: "git-sync-ssh-key"
   ```
   
   ### What you think should happen instead
   
   When dags.gitSync.enabled is true and either sshKeySecret or an inline 
sshKey is provided, the chart should mount the git-sync-ssh-key volume. Inline 
sshKey configuration alone must be sufficient to create and mount the SSH‐key 
volume.
   
   
   
   ### How to reproduce
   
   1. In your values.yaml for Airflow 3.0.3, configure Git sync with an inline 
key:
   ```yaml
   dags:
     gitSync:
       enabled: true
       repo: [email protected]:apache/airflow.git
       branch: deploy/airflow
       sshKey: |
         -----BEGIN OPENSSH PRIVATE KEY-----
         …your private key…
         -----END OPENSSH PRIVATE KEY-----
   ```
   
   2. Deploy the Helm chart.
   3. Trigger a task using the KubernetesPodOperator.
   4. Observe the Pod creation failure due to the missing git-sync-ssh-key 
volume mount.
   
   ### 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