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 getURLFromTLSHost(IngressRule rule, String pathPostFix) { String host = rule.getHost(); if (!host.isEmpty()) { pathPostFix = fixPathPostFixIfEmpty(pathPostFix); return "https://" + URLUtils.pathJoin(host, pathPostFix); } return null; }
public IngressRuleBuilder(Boolean validationEnabled){ this(new IngressRule(), validationEnabled); } public IngressRuleBuilder(IngressRuleFluent<?> fluent){
public IngressRuleBuilder(IngressRuleFluent<?> fluent,Boolean validationEnabled){ this(fluent, new IngressRule(), validationEnabled); } public IngressRuleBuilder(IngressRuleFluent<?> fluent,IngressRule instance){
HTTPIngressRuleValue http = rule.getHttp(); if (http == null) { break;
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 IngressRule build(){ IngressRule buildable = new IngressRule(fluent.getHost(),fluent.getHttp()); validate(buildable); return buildable; }