def pods_namespaced_specs(corev1api, namespace, labels=""):
podslist = []
pods = corev1api.list_namespaced_pod(namespace=namespace, watch=False, label_selector=labels)
+ logging.debug('[CUSTOM] Get items of pods: {}'.format(pods.items))
for pod in pods.items:
podslist.append(pod)
# logging.debug("pods_namespaced_specs:{}".format(podslist))
"""
# here we collect node_names for proper backup pod deployment
pods = pods_namespaced_specs(corev1api, namespace=namespace)
+ logging.debug('[CUSTOM] Get pods:{}'.format(pods))
for pod in pods:
+ logging.debug('[CUSTOM] Pod: {}'.format(pod))
+ logging.debug('[CUSTOM] Pod Specs: {}'.format(pod.spec))
+ if pod.spec is not None:
+ logging.debug('[CUSTOM] POD SPEC is None')
for vol in pod.spec.volumes:
if vol.persistent_volume_claim is not None:
pvcname = vol.persistent_volume_claim.claim_name
dict: pvc data dict
"""
pvc = persistentvolumeclaims_read_namespaced(corev1api, namespace, pvcname)
+ logging.debug('[CUSTOM] Read PVC: ')
+ logging.debug(pvc)
+
pvcspec = pvc.spec
storageclassname = pvcspec.storage_class_name
+ logging.debug('[CUSTOM] Get size:' + str(pvcspec.resources))
pvcsize = pvcspec.resources.requests.get('storage', '-1')
pvcdata = {
'name': pvcname,
size=pvcsize),
}
pvcdatalist = pvcdata_list_update_node_names(corev1api, namespace, {pvcname: pvcdata})
+ logging.debug('[CUSTOM] Read persistent volume claim completed')
+
return pvcdatalist.get(pvcname)
def check_pvc_compatiblity_with_vsnapshot(self, namespace, pvc_name):
pvc = self.get_pvcdata_namespaced(namespace, pvc_name)
+ logging.debug('[CUSTOM] Check Compatibilidy with Snapshots. Name: {}'.format(pvc_name, pvc))
+ logging.debug('[CUSTOM] PVC: {}'.format(pvc))
return self.check_storage_compatibility_with_vsnapshot(pvc.get('storage_class_name'))
def _check_config_map(self, file_info):