krkn_lib.k8s.pod_monitor.pod_monitor module

krkn_lib.k8s.pod_monitor.pod_monitor.select_and_monitor_by_label(label_selector: str, max_timeout: int, v1_client: CoreV1Api) Future

Monitors all the pods identified by a label selector and collects infos about the pods recovery after a kill scenario while the scenario is running.

Parameters:
  • label_selector – the label selector used to filter the pods to monitor (must be the same used in select_pods_by_label)

  • max_timeout – the expected time the pods should take to recover. If the killed pods are replaced in this time frame, but they didn’t reach the Ready State, they will be marked as unrecovered. If during the time frame the pods are not replaced at all the error field of the PodsStatus structure will be valorized with an exception.

  • v1_client – kubernetes V1Api client

Returns:

a future which result (PodsSnapshot) must be gathered to obtain the pod infos.

krkn_lib.k8s.pod_monitor.pod_monitor.select_and_monitor_by_name_pattern_and_namespace_pattern(pod_name_pattern: str, namespace_pattern: str, max_timeout: int, v1_client: CoreV1Api)

Monitors all the pods identified by a pod name regex pattern and a namespace regex pattern, that collects infos about the pods recovery after a kill scenario while the scenario is running. Raises an exception if the regex format is not correct.

Parameters:
  • pod_name_pattern – a regex representing the pod name pattern used to filter the pods to be monitored (must be the same used in select_pods_by_name_pattern_and_namespace_pattern)

  • namespace_pattern – a regex representing the namespace pattern used to filter the pods to be monitored (must be the same used in select_pods_by_name_pattern_and_namespace_pattern)

  • max_timeout – the expected time the pods should take to recover. If the killed pods are replaced in this time frame, but they didn’t reach the Ready State, they will be marked as unrecovered. If during the time frame the pods are not replaced at all the error field of the PodsStatus structure will be valorized with an exception.

  • v1_client – kubernetes V1Api client

Returns:

a future which result (PodsSnapshot) must be gathered to obtain the pod infos.

krkn_lib.k8s.pod_monitor.pod_monitor.select_and_monitor_by_namespace_pattern_and_label(namespace_pattern: str, label_selector: str, v1_client: CoreV1Api, max_timeout=30)

Monitors all the pods identified by a namespace regex pattern and a pod label selector, that collects infos about the pods recovery after a kill scenario while the scenario is running. Raises an exception if the regex format is not correct.

Parameters:
  • label_selector – the label selector used to filter the pods to monitor (must be the same used in select_pods_by_label)

  • v1_client – kubernetes V1Api client

  • namespace_pattern – a regex representing the namespace pattern used to filter the pods to be monitored (must be the same used in select_pods_by_name_pattern_and_namespace_pattern)

  • max_timeout – the expected time the pods should take to recover. If the killed pods are replaced in this time frame, but they didn’t reach the Ready State, they will be marked as unrecovered. If during the time frame the pods are not replaced at all the error field of the PodsStatus structure will be valorized with an exception.

Returns:

a future which result (PodsSnapshot) must be gathered to obtain the pod infos.