diff --git a/IM/connectors/Kubernetes.py b/IM/connectors/Kubernetes.py index 0ee1089d..eed219e9 100644 --- a/IM/connectors/Kubernetes.py +++ b/IM/connectors/Kubernetes.py @@ -441,24 +441,22 @@ def _generate_pod_data(self, namespace, name, outports, system, volumes, configm if volumes: containers[0]['volumeMounts'] = [] + pod_data['spec']['volumes'] = [] + for (v_name, _, v_mount_path) in volumes: containers[0]['volumeMounts'].append( {'name': v_name, 'mountPath': v_mount_path}) - - pod_data['spec']['volumes'] = [] - for (v_name, _, _) in volumes: pod_data['spec']['volumes'].append( {'name': v_name, 'persistentVolumeClaim': {'claimName': v_name}}) if configmaps: containers[0]['volumeMounts'] = containers[0].get('volumeMounts', []) + pod_data['spec']['volumes'] = pod_data['spec'].get('volumes', []) + for (cm_name, cm_mount_path) in configmaps: containers[0]['volumeMounts'].append( {'name': cm_name, 'mountPath': cm_mount_path, "readOnly": True, 'subPath': os.path.basename(cm_mount_path)}) - - pod_data['spec']['volumes'] = pod_data['spec'].get('volumes', []) - for (cm_name, _) in configmaps: pod_data['spec']['volumes'].append( {'name': cm_name, 'configMap': {'name': cm_name}})