public static String getURLFromIngressSpec(IngressSpec spec, String serviceName, ServicePort port) { List<IngressRule> ingressRules = spec.getRules(); if(ingressRules != null && !ingressRules.isEmpty()) { for(IngressRule rule : ingressRules) { HTTPIngressRuleValue http = rule.getHttp(); if(http != null && http.getPaths() != null) { return getURLFromIngressRules(http.getPaths(), spec, serviceName, port, rule); } } } return null; }
public static String getURLFromIngressRules(List<HTTPIngressPath> paths, IngressSpec spec, String serviceName, ServicePort port, IngressRule rule) { for(HTTPIngressPath path : paths) { IngressBackend backend = path.getBackend(); if(backend != null) { String backendServiceName = backend.getServiceName(); if(serviceName.equals(backendServiceName) && portsMatch(port, backend.getServicePort())) { String pathPostFix = path.getPath(); if(spec.getTls() != null) { return getURLFromTLSHost(rule, pathPostFix); } String answer = rule.getHost(); if(answer != null && !answer.isEmpty()) { pathPostFix = fixPathPostFixIfEmpty(pathPostFix); return "http://" + URLUtils.pathJoin(answer, pathPostFix); } } } } return null; }
public IngressSpecBuilder(Boolean validationEnabled){ this(new IngressSpec(), validationEnabled); } public IngressSpecBuilder(IngressSpecFluent<?> fluent){
public IngressSpecBuilder(IngressSpecFluent<?> fluent,IngressSpec instance,Boolean validationEnabled){ this.fluent = fluent; fluent.withBackend(instance.getBackend()); fluent.withRules(instance.getRules()); fluent.withTls(instance.getTls()); this.validationEnabled = validationEnabled; } public IngressSpecBuilder(IngressSpec instance){
public IngressSpecBuilder(IngressSpec instance,Boolean validationEnabled){ this.fluent = this; this.withBackend(instance.getBackend()); this.withRules(instance.getRules()); this.withTls(instance.getTls()); this.validationEnabled = validationEnabled; }
public IngressSpecFluentImpl(IngressSpec instance){ this.withBackend(instance.getBackend()); this.withRules(instance.getRules()); this.withTls(instance.getTls()); }
break; List<IngressRule> rules = spec.getRules(); if (rules == null) { break;
public IngressSpecBuilder(IngressSpecFluent<?> fluent,Boolean validationEnabled){ this(fluent, new IngressSpec(), validationEnabled); } public IngressSpecBuilder(IngressSpecFluent<?> fluent,IngressSpec instance){
public IngressSpec build(){ IngressSpec buildable = new IngressSpec(fluent.getBackend(),fluent.getRules(),fluent.getTls()); validate(buildable); return buildable; }