def RetrieveNodePortIp(argDescriptor):
    jsonSelector = argDescriptor['podLabel']
    if not jsonSelector:
        raise errors.Config.InvalidValue('For NodePortIp arguments, you must'
                                         ' provide a "selector"')
    ip = kubernetes_helper.GetWithWaitForContents('pods', '', jsonSelector,
                                                  '.items[0].status.podIP')
    if len(ip) == 0:
        raise "Could not retrieve NodePort IP address"
    logging.info("Using NodePort IP Address: " + ip)
    return ip
Ejemplo n.º 2
0
def RetrieveLoadBalancerIp(argDescriptor):
  serviceName = argDescriptor['serviceName']
  if not serviceName:
    raise errors.Config.InvalidValue('For LoadBalancerIp arguments, you must'
                                     'provide a "serviceName"')
  ip = kubernetes_helper.GetWithWaitForContents(
      'svc', serviceName, '', '.status.loadBalancer.ingress[0].ip')
  if len(ip) == 0:
    raise "Could not retrieve LoadBalancer IP address"
  logging.info("Using LoadBalancer IP Address: " + ip)
  return ip