new-integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/CommonTestUtils.java
public static List<String> installVoyagerIngressAndVerify(String domainUid,
                                                            String domainNamespace,
                                                            String ingressName,
                                                            Map<String, Integer> clusterNameMSPortMap) {
    LoggingFacade logger = getLogger();
    final String voyagerIngressName = VOYAGER_CHART_NAME + "-" + ingressName;
    final String channelName = "tcp-80";
    final String ingressType = "NodePort";
    final String ingressAffinity = "cookie";
    final String ingressClass = "voyager";

    // set the annotations for Voyager
    HashMap<String, String> annotations = new HashMap<>();
    annotations.put("ingress.appscode.com/type", ingressType);
    annotations.put("ingress.appscode.com/affinity", ingressAffinity);
    annotations.put("kubernetes.io/ingress.class", ingressClass);

    // create an ingress in domain namespace
    List<String> ingressHostList =
        createIngress(ingressName, domainNamespace, domainUid, clusterNameMSPortMap, annotations, true);

    // wait until the Voyager ingress pod is ready.
    withStandardRetryPolicy
        .conditionEvaluationListener(
            condition -> logger.info(
                "Waiting for Voyager ingress to be ready in namespace {0} (elapsed time {1}ms, remaining time {2}ms)",
                domainUid,
                condition.getElapsedTimeInMS(),
                condition.getRemainingTimeInMS()))
        .until(assertDoesNotThrow(() -> isVoyagerReady(domainNamespace, voyagerIngressName),
            "isVoyagerReady failed with ApiException"));

    assertNotNull(ingressHostList,
        String.format("Ingress creation failed for domain %s in namespace %s", domainUid, domainNamespace));

    // check the ingress was found in the domain namespace
    assertThat(assertDoesNotThrow(() -> listIngresses(domainNamespace)))
        .as("Test ingress {0} was found in namespace {1}", ingressName, domainNamespace)
        .withFailMessage("Ingress {0} was not found in namespace {1}", ingressName, domainNamespace)
        .contains(ingressName);

    // get ingress service Nodeport
    int ingressServiceNodePort = assertDoesNotThrow(
        () -> getServiceNodePort(domainNamespace, voyagerIngressName, channelName),
        "Getting admin server node port failed");
    logger.info("Node port for {0} is: {1} :", voyagerIngressName, ingressServiceNodePort);

    // check the ingress is ready to route the app to the server pod
    if (ingressServiceNodePort != 0) {
      for (String ingressHost : ingressHostList) {
        String curlCmd = "curl --silent --show-error --noproxy '*' -H 'host: " + ingressHost
            + "' http://" + K8S_NODEPORT_HOST + ":" + ingressServiceNodePort
            + "/weblogic/ready --write-out %{http_code} -o /dev/null";

        logger.info("Executing curl command {0}", curlCmd);
        assertTrue(callWebAppAndWaitTillReady(curlCmd, 60));
      }
    }

    logger.info("ingress {0} for domain {1} was created in namespace {2}",
        ingressName, domainUid, domainNamespace);

    return ingressHostList;
  }
/**
   * Create an ingress for the domain with domainUid in a given namespace and verify.
   *
   * @param domainUid WebLogic domainUid which is backend to the ingress to be created
   * @param domainNamespace WebLogic domain namespace in which the domain exists
   * @param ingressName name of ingress to be created in a given domain
   * @param clusterNameMSPortMap the map with key as cluster name and the value as managed server port of the cluster
   * @return list of ingress hosts
   */
Create an ingress for the domain with domainUid in a given namespace and verify.
Create an ingress for the domain with domainUid in a given namespace and verify .
public static List<String> installVoyagerIngressAndVerify(String domainUid,
                                                            String domainNamespace,
                                                            String ingressName,
                                                            Map<String, Integer> clusterNameMSPortMap) {
    LoggingFacade logger = getLogger();
    final String voyagerIngressName = VOYAGER_CHART_NAME + "-" + ingressName;
    final String channelName = "tcp-80";
    final String ingressType = "NodePort";
    final String ingressAffinity = "cookie";
    final String ingressClass = "voyager";
    HashMap<String, String> annotations = new HashMap<>();
    annotations.put("ingress.appscode.com/type", ingressType);
    annotations.put("ingress.appscode.com/affinity", ingressAffinity);
    annotations.put("kubernetes.io/ingress.class", ingressClass);
    List<String> ingressHostList =
        createIngress(ingressName, domainNamespace, domainUid, clusterNameMSPortMap, annotations, true);
    withStandardRetryPolicy
        .conditionEvaluationListener(
            condition -> logger.info(
                "Waiting for Voyager ingress to be ready in namespace {0} (elapsed time {1}ms, remaining time {2}ms)",
                domainUid,
                condition.getElapsedTimeInMS(),
                condition.getRemainingTimeInMS()))
        .until(assertDoesNotThrow(() -> isVoyagerReady(domainNamespace, voyagerIngressName),
            "isVoyagerReady failed with ApiException"));
    assertNotNull(ingressHostList,
        String.format("Ingress creation failed for domain %s in namespace %s", domainUid, domainNamespace));
    assertThat(assertDoesNotThrow(() -> listIngresses(domainNamespace)))
        .as("Test ingress {0} was found in namespace {1}", ingressName, domainNamespace)
        .withFailMessage("Ingress {0} was not found in namespace {1}", ingressName, domainNamespace)
        .contains(ingressName);
    int ingressServiceNodePort = assertDoesNotThrow(
        () -> getServiceNodePort(domainNamespace, voyagerIngressName, channelName),
        "Getting admin server node port failed");
    logger.info("Node port for {0} is: {1} :", voyagerIngressName, ingressServiceNodePort);
    if (ingressServiceNodePort != 0) {
      for (String ingressHost : ingressHostList) {
        String curlCmd = "curl --silent --show-error --noproxy '*' -H 'host: " + ingressHost
            + "' http://" + K8S_NODEPORT_HOST + ":" + ingressServiceNodePort
            + "/weblogic/ready --write-out %{http_code} -o /dev/null";
        logger.info("Executing curl command {0}", curlCmd);
        assertTrue(callWebAppAndWaitTillReady(curlCmd, 60));
      }
    }
    logger.info("ingress {0} for domain {1} was created in namespace {2}",
        ingressName, domainUid, domainNamespace);
    return ingressHostList;
  }
public static List < String > installVoyagerIngressAndVerify ( String domainUid , String domainNamespace , String ingressName , Map < String , Integer > clusterNameMSPortMap ) { LoggingFacade logger = getLogger ( ) ; final String voyagerIngressName = VOYAGER_CHART_NAME + "-" + ingressName ; final String channelName = "tcp-80" ; final String ingressType = "NodePort" ; final String ingressAffinity = "cookie" ; final String ingressClass = "voyager" ; HashMap < String , String > annotations = new HashMap < > ( ) ; annotations . put ( "ingress.appscode.com/type" , ingressType ) ; annotations . put ( "ingress.appscode.com/affinity" , ingressAffinity ) ; annotations . put ( "kubernetes.io/ingress.class" , ingressClass ) ; List < String > ingressHostList = createIngress ( ingressName , domainNamespace , domainUid , clusterNameMSPortMap , annotations , true ) ; withStandardRetryPolicy . conditionEvaluationListener ( condition -> logger . info ( "Waiting for Voyager ingress to be ready in namespace {0} (elapsed time {1}ms, remaining time {2}ms)" , domainUid , condition . getElapsedTimeInMS ( ) , condition . getRemainingTimeInMS ( ) ) ) . until ( assertDoesNotThrow ( ( ) -> isVoyagerReady ( domainNamespace , voyagerIngressName ) , "isVoyagerReady failed with ApiException" ) ) ; assertNotNull ( ingressHostList , String . format ( "Ingress creation failed for domain %s in namespace %s" , domainUid , domainNamespace ) ) ; assertThat ( assertDoesNotThrow ( ( ) -> listIngresses ( domainNamespace ) ) ) . as ( "Test ingress {0} was found in namespace {1}" , ingressName , domainNamespace ) . withFailMessage ( "Ingress {0} was not found in namespace {1}" , ingressName , domainNamespace ) . contains ( ingressName ) ; int ingressServiceNodePort = assertDoesNotThrow ( ( ) -> getServiceNodePort ( domainNamespace , voyagerIngressName , channelName ) , "Getting admin server node port failed" ) ; logger . info ( "Node port for {0} is: {1} :" , voyagerIngressName , ingressServiceNodePort ) ; if ( ingressServiceNodePort != 0 ) { for ( String ingressHost : ingressHostList ) { String curlCmd = "curl --silent --show-error --noproxy '*' -H 'host: " + ingressHost + "' http://" + K8S_NODEPORT_HOST + ":" + ingressServiceNodePort + "/weblogic/ready --write-out %{http_code} -o /dev/null" ; logger . info ( "Executing curl command {0}" , curlCmd ) ; assertTrue ( callWebAppAndWaitTillReady ( curlCmd , 60 ) ) ; } } logger . info ( "ingress {0} for domain {1} was created in namespace {2}" , ingressName , domainUid , domainNamespace ) ; return ingressHostList ; }
Create an ingress for the domain with domainUid in a given namespace and verify.
Create an ingress for the domain with domainUid in a given namespace and verify .
// set the annotations for Voyager // create an ingress in domain namespace // wait until the Voyager ingress pod is ready. // check the ingress was found in the domain namespace // get ingress service Nodeport // check the ingress is ready to route the app to the server pod