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

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

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

Service.getNamespace介绍

暂无

代码示例

代码示例来源:origin: io.fabric8/arquillian-fabric8

/**
 * Checks if there is an endpoint for the service available.
 * @param s The target service.
 * @return  Returns true if a connection to at least one of the endpoints is possible.
 */
private boolean isEndpointAvailable(Service s) {
  String serviceStatus = null;
  boolean result = false;
  for (String endpoit : kubernetesClient.endpointsForService(s.getId(), s.getNamespace()).getEndpoints()) {
    String addr = endpoit.substring(0, endpoit.indexOf(":"));
    Integer port = Integer.parseInt(endpoit.substring(endpoit.indexOf(":") + 1));
    try (Socket socket = new Socket()) {
      socket.connect(new InetSocketAddress(addr, port), configuration.getServiceConnectionTimeout());
      serviceStatus = "Service: " + s.getId() + " is ready. Provider:"+ addr+".";
      return true;
    } catch (Exception e) {
      serviceStatus = "Service: " + s.getId() + " is not ready! Error: " + e.getMessage();
    } finally {
      session.getLogger().warn(serviceStatus);
    }
  }
  return result;
}

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

public AppServiceSummaryDTO(Service service) {
  this.id = KubernetesHelper.getId(service);
  this.name = KubernetesHelper.getName(service);
  this.namespace = service.getNamespace();
  this.portalIP = KubernetesHelper.getPortalIP(service);
  this.port = KubernetesHelper.getPort(service);
  this.labels = service.getLabels();
}

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

String appPath = getAppPath(getId(service));
if (appPath != null) {
  AppViewDetails dto = snapshot.getOrCreateAppView(appPath, service.getNamespace());
  dto.addService(service);

相关文章