/** * Patches the resource with the given namespace and name to match the given desired resource * and completes the given future accordingly. * * ServiceOperator needs its own version of this method to patch the NodePorts for NodePort and LoadBalancer type Services. * Patching the service with service definition without the NodePort would cause regenerating the node port * which triggers rolling update. * * @param namespace Namespace of the service * @param name Name of the service * @param current Current servicve * @param desired Desired Service * * @return Future with reconciliation result */ @Override protected Future<ReconcileResult<Service>> internalPatch(String namespace, String name, Service current, Service desired) { try { if (current.getSpec() != null && desired.getSpec() != null && (("NodePort".equals(current.getSpec().getType()) && "NodePort".equals(desired.getSpec().getType())) || ("LoadBalancer".equals(current.getSpec().getType()) && "LoadBalancer".equals(desired.getSpec().getType())))) { patchNodePorts(current, desired); } return super.internalPatch(namespace, name, current, desired); } catch (Exception e) { log.error("Caught exception while patching {} {} in namespace {}", resourceKind, name, namespace, e); return Future.failedFuture(e); } }
/** * Should we try to create an external URL for the given service? * <p/> * By default lets ignore the kubernetes services and any service which does not expose ports 80 and 443 * * @return true if we should create an OpenShift Route for this service. */ private boolean shouldCreateExternalURLForService(Service service, String id) { if ("kubernetes".equals(id) || "kubernetes-ro".equals(id)) { return false; } Set<Integer> ports = getPorts(service); log.debug("Service " + id + " has ports: " + ports); if (ports.size() == 1) { String type = null; ServiceSpec spec = service.getSpec(); if (spec != null) { type = spec.getType(); if (Objects.equals(type, "LoadBalancer")) { return true; } } log.info("Not generating route for service " + id + " type is not LoadBalancer: " + type); return false; } else { log.info("Not generating route for service " + id + " as only single port services are supported. Has ports: " + ports); return false; } }
String labels = (labelsMap != null) ? labelsMap.toString() : ""; ServiceSpec serviceSpec = service.getSpec(); String serviceType = serviceSpec.getType();
String labels = (labelsMap != null) ? labelsMap.toString() : ""; ServiceSpec serviceSpec = service.getSpec(); String serviceType = serviceSpec.getType();
if (svc != null && "LoadBalancer".equals(svc.getSpec().getType())) { int tries = 0; int maxWait = properties.getMinutesToWaitForLoadBalancer() * 6; // we check 6 times per minute
if ("LoadBalancer".equals(service.getSpec().getType())) { if (service.getStatus() != null && service.getStatus().getLoadBalancer() != null && service.getStatus().getLoadBalancer().getIngress() != null && !service.getStatus()
public ServiceSpecBuilder( ServiceSpecFluent<?> fluent , ServiceSpec instance ){ this.fluent = fluent; fluent.withDeprecatedPublicIPs(instance.getDeprecatedPublicIPs()); fluent.withPortalIP(instance.getPortalIP()); fluent.withPorts(instance.getPorts()); fluent.withSelector(instance.getSelector()); fluent.withSessionAffinity(instance.getSessionAffinity()); fluent.withType(instance.getType()); } public ServiceSpecBuilder( ServiceSpec instance ){
public ServiceSpecBuilder( ServiceSpec instance ){ this.fluent = this; this.withDeprecatedPublicIPs(instance.getDeprecatedPublicIPs()); this.withPortalIP(instance.getPortalIP()); this.withPorts(instance.getPorts()); this.withSelector(instance.getSelector()); this.withSessionAffinity(instance.getSessionAffinity()); this.withType(instance.getType()); }
public ServiceSpecBuilder( ServiceSpec instance ){ this.fluent = this; this.withCreateExternalLoadBalancer(instance.getCreateExternalLoadBalancer()); this.withPortalIP(instance.getPortalIP()); this.withPorts(instance.getPorts()); this.withPublicIPs(instance.getPublicIPs()); this.withSelector(instance.getSelector()); this.withSessionAffinity(instance.getSessionAffinity()); this.withType(instance.getType()); }
public ServiceSpecBuilder( ServiceSpecFluent<?> fluent , ServiceSpec instance ){ this.fluent = fluent; fluent.withCreateExternalLoadBalancer(instance.getCreateExternalLoadBalancer()); fluent.withPortalIP(instance.getPortalIP()); fluent.withPorts(instance.getPorts()); fluent.withPublicIPs(instance.getPublicIPs()); fluent.withSelector(instance.getSelector()); fluent.withSessionAffinity(instance.getSessionAffinity()); fluent.withType(instance.getType()); } public ServiceSpecBuilder( ServiceSpec instance ){
public ServiceSpecFluentImpl(ServiceSpec instance){ this.withClusterIP(instance.getClusterIP()); this.withDeprecatedPublicIPs(instance.getDeprecatedPublicIPs()); this.withExternalIPs(instance.getExternalIPs()); this.withLoadBalancerIP(instance.getLoadBalancerIP()); this.withLoadBalancerSourceRanges(instance.getLoadBalancerSourceRanges()); this.withPortalIP(instance.getPortalIP()); this.withPorts(instance.getPorts()); this.withSelector(instance.getSelector()); this.withSessionAffinity(instance.getSessionAffinity()); this.withType(instance.getType()); }
public ServiceSpecBuilder(ServiceSpec instance,Boolean validationEnabled){ this.fluent = this; this.withClusterIP(instance.getClusterIP()); this.withDeprecatedPublicIPs(instance.getDeprecatedPublicIPs()); this.withExternalIPs(instance.getExternalIPs()); this.withLoadBalancerIP(instance.getLoadBalancerIP()); this.withLoadBalancerSourceRanges(instance.getLoadBalancerSourceRanges()); this.withPortalIP(instance.getPortalIP()); this.withPorts(instance.getPorts()); this.withSelector(instance.getSelector()); this.withSessionAffinity(instance.getSessionAffinity()); this.withType(instance.getType()); this.validationEnabled = validationEnabled; }
public ServiceSpecBuilder(ServiceSpecFluent<?> fluent,ServiceSpec instance,Boolean validationEnabled){ this.fluent = fluent; fluent.withClusterIP(instance.getClusterIP()); fluent.withDeprecatedPublicIPs(instance.getDeprecatedPublicIPs()); fluent.withExternalIPs(instance.getExternalIPs()); fluent.withLoadBalancerIP(instance.getLoadBalancerIP()); fluent.withLoadBalancerSourceRanges(instance.getLoadBalancerSourceRanges()); fluent.withPortalIP(instance.getPortalIP()); fluent.withPorts(instance.getPorts()); fluent.withSelector(instance.getSelector()); fluent.withSessionAffinity(instance.getSessionAffinity()); fluent.withType(instance.getType()); this.validationEnabled = validationEnabled; } public ServiceSpecBuilder(ServiceSpec instance){