private boolean serviceHasIngressRule(List<Ingress> ingresses,Service service){
  String serviceName=KubernetesHelper.getName(service);
  for (  Ingress ingress : ingresses) {
    IngressSpec spec=ingress.getSpec();
    if (spec == null) {
      break;
    }
    List<IngressRule> rules=spec.getRules();
    if (rules == null) {
      break;
    }
    for (    IngressRule rule : rules) {
      HTTPIngressRuleValue http=rule.getHttp();
      if (http == null) {
        break;
      }
      List<HTTPIngressPath> paths=http.getPaths();
      if (paths == null) {
        break;
      }
      for (      HTTPIngressPath path : paths) {
        IngressBackend backend=path.getBackend();
        if (backend == null) {
          break;
        }
        if (Objects.equals(serviceName,backend.getServiceName())) {
          return true;
        }
      }
    }
  }
  return false;
}

private boolean serviceHasIngressRule ( List < Ingress > ingresses , Service service ) { String serviceName = KubernetesHelper . getName ( service ) ; for ( Ingress ingress : ingresses ) { IngressSpec spec = ingress . getSpec ( ) ; if ( spec == null ) { break ; } List < IngressRule > rules = spec . getRules ( ) ; if ( rules == null ) { break ; } for ( IngressRule rule : rules ) { HTTPIngressRuleValue http = rule . getHttp ( ) ; if ( http == null ) { break ; } List < HTTPIngressPath > paths = http . getPaths ( ) ; if ( paths == null ) { break ; } for ( HTTPIngressPath path : paths ) { IngressBackend backend = path . getBackend ( ) ; if ( backend == null ) { break ; } if ( Objects . equals ( serviceName , backend . getServiceName ( ) ) ) { return true ; } } } } return false ; }
returns true if there is an existing ingress rule for the given service
