예제 #1
0
파일: v1.cs 프로젝트: zmyer/service-fabric
        public IActionResult GetClusters(string service_cluster, string service_node)
        {
            List <EnvoyCluster> ret = new List <EnvoyCluster>();

            if (SF_Services.partitions_ == null)
            {
                return(Ok(new { clusters = ret }));
            }
            if (EnvoyDefaults.gateway_map != null)
            {
                foreach (var service in SF_Services.services_)
                {
                    if (!EnvoyDefaults.gateway_clusternames.Contains(service.Key))
                    {
                        continue;
                    }
                    EnvoyCluster info = new EnvoyCluster(service.Key);
                    ret.Add(info);
                }
            }
            else
            {
                foreach (var pID in SF_Services.partitions_)
                {
                    var info = SF_Services.EnvoyInformationForPartition(pID.Key);
                    foreach (var service in info)
                    {
                        ret.Add(service.cluster);
                    }
                }
                foreach (var service in SF_Services.services_)
                {
                    if (!service.Value.StatefulService)
                    {
                        continue;
                    }
                    EnvoyCluster info = new EnvoyCluster(service.Key);
                    ret.Add(info);
                }
            }

            return(Ok(
                       new { clusters = ret }
                       ));
        }
예제 #2
0
 public EnvoyClustersInformation(string name, List <EnvoyRoute> routes, List <EnvoyHost> hosts, bool isHttps = false)
 {
     cluster     = new EnvoyCluster(name, EnvoyDefaults.connect_timeout_ms, isHttps, EnvoyDefaults.cluster_ssl_context);
     this.routes = routes;
     this.hosts  = hosts;
 }