File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -92,10 +92,11 @@ def get_container_with_volume_mounts(container):
9292 """
9393 volumes_spec = container ["volume_mounts" ]
9494 mount_volumes = []
95+ keys_to_omit = {"host_path" }
9596 for volume in volumes_spec :
96- mount_path = volume [ "mountPath" ]
97- name = volume [ "name" ]
98- mount_volumes .append (V1VolumeMount (mount_path = mount_path , name = name ))
97+ # we need things like read_only, sub_path, etc:
98+ volume_std_spec = { k : v for k , v in volume . items () if k not in keys_to_omit }
99+ mount_volumes .append (V1VolumeMount (** volume_std_spec ))
99100 container ["volume_mounts" ] = mount_volumes
100101 return container
101102
Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ def test_pod_spec_from_dict():
5656 "imagePullPolicy" : "Always" ,
5757 "env" : [{"name" : "my_env" , "value" : "env" }],
5858 "volume_mounts" : [
59- {"name" : "Vname" , "mountPath " : "VmountPath" , "host_path" : "VhostPath" }
59+ {"name" : "Vname" , "mount_path " : "VmountPath" , "host_path" : "VhostPath" }
6060 ],
6161 }
6262 ],
@@ -105,7 +105,7 @@ def test_pod_spec_with_volume_from_dict():
105105 "imagePullPolicy" : "Always" ,
106106 "env" : [{"name" : "my_env" , "value" : "env" }],
107107 "volume_mounts" : [
108- {"name" : "Vname" , "mountPath " : "VmountPath" , "host_path" : "VhostPath" }
108+ {"name" : "Vname" , "mount_path " : "VmountPath" , "host_path" : "VhostPath" }
109109 ],
110110}
111111
You can’t perform that action at this time.
0 commit comments