def list_container_ports(self, request, project_id, version_id): """查看模板集指定版本的端口信息""" ventity = self.get_versioned_entity(project_id, version_id) tag_list = self._get_tag_list(request) pod_res_qsets = get_pod_qsets_by_tag(tag_list, ventity) ports = get_k8s_container_ports(pod_res_qsets) return Response(ports)
def list_pod_res_labels(self, request, project_id, version_id): """查看模板集指定版本的label信息""" ventity = self.get_versioned_entity(project_id, version_id) tag_list = self._get_tag_list(request) pod_res_qsets = get_pod_qsets_by_tag(tag_list, ventity) if not pod_res_qsets: return Response({}) label_map = pod_res_qsets[0].get_labels() for pod_res in pod_res_qsets[1:]: label = pod_res.get_labels() label_map = dict(label_map.items() & label.items()) return Response(label_map)