Esempio n. 1
0
 def __init__(self):
     self.host_agents = {
         'docker': DockerHost("docker"),
         'swarm': DockerHost("swarm"),
         'kubernetes': KubernetesHost(),
         'vsphere': VsphereHost()
     }
Esempio n. 2
0
 def __init__(self):
     self.col = db["host"]
     self.host_agents = {
         'docker': DockerHost(),
         'swarm': DockerHost(),
         'kubernetes': KubernetesHost()
     }
Esempio n. 3
0
    def get_services_urls(self, cid):
        try:
            cluster = ClusterModel.objects.get(id=cid)

            cluster_name = cluster.name
            kube_config = KubernetesHost().get_kubernets_config(
                cluster.host.k8s_param)

            operation = K8sClusterOperation(kube_config)
            services_urls = operation.get_services_urls(cluster_name)
        except Exception as e:
            logger.error(
                "Failed to get Kubernetes services's urls: {}".format(e))
            return None
        return services_urls
Esempio n. 4
0
    def _get_cluster_info(self, cid, config):
        cluster = ClusterModel.objects.get(id=cid)

        cluster_name = cluster.name
        kube_config = KubernetesHost().get_kubernets_config(
            cluster.host.k8s_param)

        clusters_exists = ClusterModel.objects(host=cluster.host)
        ports_index = [
            service.port
            for service in ServicePort.objects(cluster__in=clusters_exists)
        ]

        nfsServer_ip = cluster.host.k8s_param.get('nfsServer')
        consensus = config['consensus_plugin']

        return cluster, cluster_name, kube_config, ports_index, \
            nfsServer_ip, consensus