def get_pods(self): """Get the pods for the Deployment. Returns: list[Pod]: A list of pods that belong to the deployment. """ log.info('getting pods for deployment "%s"', self.name) pods = client.CoreV1Api().list_namespaced_pod( namespace=self.namespace, label_selector=selector_string(self.obj.metadata.labels), ) pods = [Pod(p) for p in pods.items] log.debug('pods: %s', pods) return pods
def get_pods(self): """Get the pods for the DaemonSet. Returns: list[Pod]: A list of pods that belong to the daemonset. """ log.info('getting pods for daemonset "%s"', self.name) pods = client.CoreV1Api().list_namespaced_pod( namespace=self.namespace, label_selector=selector_string({self.klabel_key: self.klabel_uid})) pods = [Pod(p) for p in pods.items] log.debug('pods: %s', pods) return pods
def get_pods(self) -> List[Pod]: """Get the pods for the Deployment. Returns: A list of pods that belong to the deployment. """ log.info(f'getting pods for deployment "{self.name}"') pods = client.CoreV1Api().list_namespaced_pod( namespace=self.namespace, label_selector=selector_string({self.klabel_key: self.klabel_uid})) pods = [Pod(p) for p in pods.items] log.debug(f'pods: {pods}') return pods
def test_selector_string(labels, expected): """Test creating a string for a dictionary of selectors.""" actual = utils.selector_string(labels) assert actual == expected