marcusianlevine opened a new issue #9860:
URL: https://github.com/apache/airflow/issues/9860


   **Apache Airflow version**: 1.10.11
   
   **Kubernetes version (if you are using kubernetes)** (use `kubectl 
version`): 1.16.9
   
   **Environment**: 
   
   - **Cloud provider or hardware configuration**: AWS
   - **OS** (e.g. from /etc/os-release): Ubuntu
   - **Kernel** (e.g. `uname -a`): `5.3.0-1019-aws #21~18.04.1-Ubuntu SMP 
x86_64 GNU/Linux`
   - **Install tools**: Docker image with Airflow `pip` installed via `pipenv`
   
   **What happened**:
   
   After adding a specification for `Volume` and `VolumeMount` objects to the 
`executor_config` for `KubernetesExecutor`, the Airflow UI explodes with the 
following message:
   
   ```
   TypeError: Object of type VolumeMount is not JSON serializable
   ```
   
   **What you expected to happen**:
   
   The KubernetesExecutor dynamically adds my specific volumes to the Pod spec
   
   **How to reproduce it**:
   In an Airflow environment configured to use the KubernetesExecutor, pass a 
spec of the following form to the `executor_config`:
   
   ```
   my_volume = Volume(
       name='my-pvc',
       configs={
           'persistentVolumeClaim': {'claimName': 'my-pvc'}
       }
   )
   my_volume_mount = VolumeMount(
       name='my-pvc', mount_path='/example/mount/path',
       sub_path=None, read_only=False
   )
   
   executor_config = {
       'KubernetesExecutor': {'volumes': [my_volume], 'volume_mounts': 
[my_volume_mount]}
   }
   
   # I didn't bother defining an example DAG, this should cause an issue with 
any operator
   my_task = BashOperator(task_id='example-task', 
executor_config=executor_config, dag=dag)
   ```
   
   
   **Anything else we need to know**:
   
   Obviously the volume mounts specified via `airflow.cfg` should work, but 
we'd like to be able to dynamically add volumes to tasks that need them without 
having all of our jobs mount volumes unnecessarily


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to