io.fabric8.kubernetes.api.model.Service.getStatus()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(8.1k)|赞(0)|评价(0)|浏览(153)

本文整理了Java中io.fabric8.kubernetes.api.model.Service.getStatus()方法的一些代码示例,展示了Service.getStatus()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Service.getStatus()方法的具体详情如下:
包路径:io.fabric8.kubernetes.api.model.Service
类名称:Service
方法名:getStatus

Service.getStatus介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

Map<String, Service> servicesById; 

Service httpService = servicesById.get("http");
System.out.println("The status of service http is " + httpService.getStatus());

代码示例来源:origin: strimzi/strimzi-kafka-operator

/**
 * Checks if the Service already has assigned ingress address.
 *
 * @param namespace The namespace.
 * @param name The route name.
 */
public boolean isIngressAddressReady(String namespace, String name) {
  ServiceResource<Service, DoneableService> resourceOp = operation().inNamespace(namespace).withName(name);
  Service resource = resourceOp.get();
  if (resource != null && resource.getStatus() != null && resource.getStatus().getLoadBalancer() != null && resource.getStatus().getLoadBalancer().getIngress() != null && resource.getStatus().getLoadBalancer().getIngress().size() > 0) {
    if (resource.getStatus().getLoadBalancer().getIngress().get(0).getHostname() != null || resource.getStatus().getLoadBalancer().getIngress().get(0).getIp() != null) {
      return true;
    }
  }
  return false;
}

代码示例来源:origin: org.wso2.carbon.apimgt/org.wso2.carbon.apimgt.core

/**
 * Adds the LoadBalancer Endpoint to the endpointList
 *
 * @param serviceName  name of the service the endpoint belongs to
 * @param service      service object instance
 * @param port         port number
 * @param protocol     whether http or https
 * @param namespace    namespace of the service
 * @param labels       labels of the service
 * @param endpointList endpointList which the endpoint has to be added to
 * @throws MalformedURLException if protocol unknown, therefore will not get thrown
 */
private void addLoadBalancerEndpoint(String serviceName, Service service, int port, String protocol,
                   String namespace, String labels, List<Endpoint> endpointList)
    throws MalformedURLException {
  List<LoadBalancerIngress> loadBalancerIngresses = service.getStatus().getLoadBalancer().getIngress();
  if (!loadBalancerIngresses.isEmpty()) {
    for (LoadBalancerIngress loadBalancerIngress : loadBalancerIngresses) {
      String hostname = loadBalancerIngress.getHostname();
      String host = (hostname == null || "".equals(hostname)) ? loadBalancerIngress.getIp() : hostname;
      URL url = new URL(protocol, host, port, "");
      endpointList.add(constructEndpoint(serviceName, namespace, protocol, LOAD_BALANCER, url, labels));
    }
  } else {
    log.debug("Service:{}  Namespace:{}  Port:{}/{} has no loadBalancer ingresses available.",
        serviceName, namespace, port, protocol);
  }
}

代码示例来源:origin: wso2/carbon-apimgt

/**
 * Adds the LoadBalancer Endpoint to the endpointList
 *
 * @param serviceName  name of the service the endpoint belongs to
 * @param service      service object instance
 * @param port         port number
 * @param protocol     whether http or https
 * @param namespace    namespace of the service
 * @param labels       labels of the service
 * @param endpointList endpointList which the endpoint has to be added to
 * @throws MalformedURLException if protocol unknown, therefore will not get thrown
 */
private void addLoadBalancerEndpoint(String serviceName, Service service, int port, String protocol,
                   String namespace, String labels, List<Endpoint> endpointList)
    throws MalformedURLException {
  List<LoadBalancerIngress> loadBalancerIngresses = service.getStatus().getLoadBalancer().getIngress();
  if (!loadBalancerIngresses.isEmpty()) {
    for (LoadBalancerIngress loadBalancerIngress : loadBalancerIngresses) {
      String hostname = loadBalancerIngress.getHostname();
      String host = (hostname == null || "".equals(hostname)) ? loadBalancerIngress.getIp() : hostname;
      URL url = new URL(protocol, host, port, "");
      endpointList.add(constructEndpoint(serviceName, namespace, protocol, LOAD_BALANCER, url, labels));
    }
  } else {
    log.debug("Service:{}  Namespace:{}  Port:{}/{} has no loadBalancer ingresses available.",
        serviceName, namespace, port, protocol);
  }
}

代码示例来源:origin: spring-cloud/spring-cloud-deployer-kubernetes

int maxWait = properties.getMinutesToWaitForLoadBalancer() * 6; // we check 6 times per minute
while (tries++ < maxWait) {
  if (svc.getStatus() != null && svc.getStatus().getLoadBalancer() != null
    && svc.getStatus().getLoadBalancer().getIngress() != null && svc.getStatus()
    .getLoadBalancer().getIngress().isEmpty()) {
    if (tries % 6 == 0) {
  svc.getStatus().getLoadBalancer().getIngress().toString()));

代码示例来源:origin: spring-cloud/spring-cloud-deployer-kubernetes

result.put("service.name", service.getMetadata().getName());
if ("LoadBalancer".equals(service.getSpec().getType())) {
  if (service.getStatus() != null && service.getStatus().getLoadBalancer() != null
    && service.getStatus().getLoadBalancer().getIngress() != null && !service.getStatus()
    .getLoadBalancer().getIngress().isEmpty()) {
    String externalIp = service.getStatus().getLoadBalancer().getIngress().get(0).getIp();
    result.put("service.external.ip", externalIp);
    List<ServicePort> ports = service.getSpec().getPorts();

代码示例来源:origin: org.apache.brooklyn/brooklyn-locations-container

@Override
public Boolean call() {
  Service svc = client.services().inNamespace(namespace).withName(serviceName).get();
  if (svc == null || svc.getStatus() == null) {
    return false;
  }
  Endpoints endpoints = client.endpoints().inNamespace(namespace).withName(serviceName).get();
  if (endpoints == null || endpoints.getSubsets().isEmpty()) {
    return false;
  }
  for (EndpointSubset subset : endpoints.getSubsets()) {
    if (subset.getNotReadyAddresses().size() > 0) {
      return false;
    }
  }
  return true;
}

代码示例来源:origin: org.apache.stratos/kubernetes-model

public ServiceBuilder( ServiceFluent<?> fluent , Service instance ){
  this.fluent = fluent; fluent.withApiVersion(instance.getApiVersion()); fluent.withKind(instance.getKind()); fluent.withMetadata(instance.getMetadata()); fluent.withSpec(instance.getSpec()); fluent.withStatus(instance.getStatus()); 
}
public ServiceBuilder( Service instance ){

代码示例来源:origin: org.domeos/kubernetes-model

public ServiceBuilder(Service instance,Boolean validationEnabled){
    this.fluent = this; 
    this.withApiVersion(instance.getApiVersion()); 
    this.withKind(instance.getKind()); 
    this.withMetadata(instance.getMetadata()); 
    this.withSpec(instance.getSpec()); 
    this.withStatus(instance.getStatus()); 
    this.validationEnabled = validationEnabled; 
}

代码示例来源:origin: org.domeos/kubernetes-model

public ServiceBuilder(ServiceFluent<?> fluent,Service instance,Boolean validationEnabled){
    this.fluent = fluent; 
    fluent.withApiVersion(instance.getApiVersion()); 
    fluent.withKind(instance.getKind()); 
    fluent.withMetadata(instance.getMetadata()); 
    fluent.withSpec(instance.getSpec()); 
    fluent.withStatus(instance.getStatus()); 
    this.validationEnabled = validationEnabled; 
}
public ServiceBuilder(Service instance){

代码示例来源:origin: org.domeos/kubernetes-model

public ServiceFluentImpl(Service instance){
    this.withApiVersion(instance.getApiVersion()); 
    this.withKind(instance.getKind()); 
    this.withMetadata(instance.getMetadata()); 
    this.withSpec(instance.getSpec()); 
    this.withStatus(instance.getStatus()); 
}

代码示例来源:origin: io.fabric8.schemagenerator/kubernetes-model

public ServiceBuilder( ServiceFluent<?> fluent , Service instance ){
  this.fluent = fluent; fluent.withApiVersion(instance.getApiVersion()); fluent.withKind(instance.getKind()); fluent.withMetadata(instance.getMetadata()); fluent.withSpec(instance.getSpec()); fluent.withStatus(instance.getStatus()); 
}
public ServiceBuilder( Service instance ){

代码示例来源:origin: org.apache.stratos/kubernetes-model

public ServiceBuilder( Service instance ){
  this.fluent = this; this.withApiVersion(instance.getApiVersion()); this.withKind(instance.getKind()); this.withMetadata(instance.getMetadata()); this.withSpec(instance.getSpec()); this.withStatus(instance.getStatus()); 
}

代码示例来源:origin: io.fabric8.schemagenerator/kubernetes-model

public ServiceBuilder( Service instance ){
  this.fluent = this; this.withApiVersion(instance.getApiVersion()); this.withKind(instance.getKind()); this.withMetadata(instance.getMetadata()); this.withSpec(instance.getSpec()); this.withStatus(instance.getStatus()); 
}

代码示例来源:origin: fabric8io/fabric8-maven-plugin

ServiceStatus status = srv.getStatus();
if (status != null) {
  LoadBalancerStatus loadBalancerStatus = status.getLoadBalancer();

代码示例来源:origin: salaboy/drools-workshop

Service service = serviceResource.get();
if (service != null) {
  ServiceStatus status = service.getStatus();
} else {
  kube.services().inNamespace(namespace).createNew()

相关文章