コード例 #1
0
ファイル: k8s_scale_manager.py プロジェクト: stackhpc/magnum
    def _get_hosts_with_container(self, context, cluster):
        k8s_api = k8s.KubernetesAPI(context, cluster)
        hosts = set()
        for pod in k8s_api.list_namespaced_pod(namespace='default')['items']:
            hosts.add(pod['spec']['node_name'])

        return hosts
コード例 #2
0
    def poll_health_status(self):
        if self._is_magnum_auto_healer_running():
            return

        k8s_api = k8s.KubernetesAPI(self.context, self.cluster)
        if self._is_cluster_accessible():
            status, reason = self._poll_health_status(k8s_api)
        else:
            status = m_fields.ClusterHealthStatus.UNKNOWN
            reason = {
                "api": "The cluster %s is not accessible." % self.cluster.name
            }

        self.data['health_status'] = status
        self.data['health_status_reason'] = reason
コード例 #3
0
 def pull_data(self):
     k8s_api = k8s.KubernetesAPI(self.context, self.cluster)
     nodes = k8s_api.list_node()
     self.data['nodes'] = self._parse_node_info(nodes)
     pods = k8s_api.list_namespaced_pod('default')
     self.data['pods'] = self._parse_pod_info(pods)