new-integration-tests/src/test/java/oracle/weblogic/kubernetes/ItScaleMiiDomainNginx.java
private static void createMiiDomainWithMultiClusters() {

    // admin/managed server name here should match with model yaml in WDT_MODEL_FILE
    String adminServerPodName = domainUid + "-" + ADMIN_SERVER_NAME_BASE;

    // create image with model files
    logger.info("Creating image with model file and verify");
    List<String> appSrcDirList = new ArrayList<>();
    appSrcDirList.add(MII_BASIC_APP_NAME);
    appSrcDirList.add(WLDF_OPENSESSION_APP);
    String miiImage =
        createMiiImageAndVerify(MII_IMAGE_NAME, Collections.singletonList(MODEL_DIR + "/" + WDT_MODEL_FILE),
            appSrcDirList, WLS_BASE_IMAGE_NAME, WLS_BASE_IMAGE_TAG, WLS_DOMAIN_TYPE, false);

    // docker login and push image to docker registry if necessary
    dockerLoginAndPushImageToRegistry(miiImage);

    // create docker registry secret to pull the image from registry
    logger.info("Creating docker registry secret in namespace {0}", domainNamespace);
    createDockerRegistrySecret(domainNamespace);

    // create secret for admin credentials
    logger.info("Creating secret for admin credentials");
    String adminSecretName = "weblogic-credentials";
    createSecretWithUsernamePassword(adminSecretName, domainNamespace, "weblogic", "welcome1");

    // create encryption secret
    logger.info("Creating encryption secret");
    String encryptionSecretName = "encryptionsecret";
    createSecretWithUsernamePassword(encryptionSecretName, domainNamespace, "weblogicenc", "weblogicenc");

    // construct the cluster list used for domain custom resource
    List<Cluster> clusterList = new ArrayList<>();
    for (int i = NUMBER_OF_CLUSTERS; i >= 1; i--) {
      clusterList.add(new Cluster()
          .clusterName(CLUSTER_NAME_PREFIX + i)
          .replicas(replicaCount)
          .serverStartState("RUNNING"));
    }

    // create the domain CR
    Domain domain = new Domain()
        .apiVersion(DOMAIN_API_VERSION)
        .kind("Domain")
        .metadata(new V1ObjectMeta()
            .name(domainUid)
            .namespace(domainNamespace))
        .spec(new DomainSpec()
            .domainUid(domainUid)
            .domainHomeSourceType("FromModel")
            .image(miiImage)
            .addImagePullSecretsItem(new V1LocalObjectReference()
                .name(REPO_SECRET_NAME))
            .webLogicCredentialsSecret(new V1SecretReference()
                .name(adminSecretName)
                .namespace(domainNamespace))
            .includeServerOutInPodLog(true)
            .serverStartPolicy("IF_NEEDED")
            .serverPod(new ServerPod()
                .addEnvItem(new V1EnvVar()
                    .name("JAVA_OPTIONS")
                    .value("-Dweblogic.StdoutDebugEnabled=false"))
                .addEnvItem(new V1EnvVar()
                    .name("USER_MEM_ARGS")
                    .value("-Djava.security.egd=file:/dev/./urandom ")))
            .adminServer(new AdminServer()
                .serverStartState("RUNNING")
                .adminService(new AdminService()
                    .addChannelsItem(new Channel()
                        .channelName("default")
                        .nodePort(0))))
            .clusters(clusterList)
            .configuration(new Configuration()
                .model(new Model()
                    .domainType(WLS_DOMAIN_TYPE)
                    .runtimeEncryptionSecret(encryptionSecretName))));

    // create model in image domain
    logger.info("Creating model in image domain {0} in namespace {1} using docker image {2}",
        domainUid, domainNamespace, miiImage);
    createDomainAndVerify(domain, domainNamespace);

    // check admin server pod exists in domain namespace
    logger.info("Checking that admin server pod {0} exists in namespace {1}",
        adminServerPodName, domainNamespace);
    checkPodExists(adminServerPodName, domainUid, domainNamespace);

    // check admin server pod is ready
    logger.info("Checking that admin server pod {0} is ready in namespace {1}",
        adminServerPodName, domainNamespace);
    checkPodReady(adminServerPodName, domainUid, domainNamespace);

    // check admin service exists in the domain namespace
    logger.info("Checking that admin service {0} exists in namespace {1}",
        adminServerPodName, domainNamespace);
    checkServiceExists(adminServerPodName, domainNamespace);

    // check the readiness for the managed servers in each cluster
    for (int i = 1; i <= NUMBER_OF_CLUSTERS; i++) {
      for (int j = 1; j <= replicaCount; j++) {
        String managedServerPodName =
            domainUid + "-" + CLUSTER_NAME_PREFIX + i + "-" + MANAGED_SERVER_NAME_BASE + j;

        // check managed server pod exists in the namespace
        logger.info("Checking that managed server pod {0} exists in namespace {1}",
            managedServerPodName, domainNamespace);
        checkPodExists(managedServerPodName, domainUid, domainNamespace);

        // check managed server pod is ready
        logger.info("Checking that managed server pod {0} is ready in namespace {1}",
            managedServerPodName, domainNamespace);
        checkPodReady(managedServerPodName, domainUid, domainNamespace);

        // check managed server service exists in the domain namespace
        logger.info("Checking that managed server service {0} exists in namespace {1}",
            managedServerPodName, domainNamespace);
        checkServiceExists(managedServerPodName, domainNamespace);
      }
    }
  }
/**
   * Create model in image domain with multiple clusters.
   */
Create model in image domain with multiple clusters.
Create model in image domain with multiple clusters .
private static void createMiiDomainWithMultiClusters() {
    String adminServerPodName = domainUid + "-" + ADMIN_SERVER_NAME_BASE;
    logger.info("Creating image with model file and verify");
    List<String> appSrcDirList = new ArrayList<>();
    appSrcDirList.add(MII_BASIC_APP_NAME);
    appSrcDirList.add(WLDF_OPENSESSION_APP);
    String miiImage =
        createMiiImageAndVerify(MII_IMAGE_NAME, Collections.singletonList(MODEL_DIR + "/" + WDT_MODEL_FILE),
            appSrcDirList, WLS_BASE_IMAGE_NAME, WLS_BASE_IMAGE_TAG, WLS_DOMAIN_TYPE, false);
    dockerLoginAndPushImageToRegistry(miiImage);
    logger.info("Creating docker registry secret in namespace {0}", domainNamespace);
    createDockerRegistrySecret(domainNamespace);
    logger.info("Creating secret for admin credentials");
    String adminSecretName = "weblogic-credentials";
    createSecretWithUsernamePassword(adminSecretName, domainNamespace, "weblogic", "welcome1");
    logger.info("Creating encryption secret");
    String encryptionSecretName = "encryptionsecret";
    createSecretWithUsernamePassword(encryptionSecretName, domainNamespace, "weblogicenc", "weblogicenc");
    List<Cluster> clusterList = new ArrayList<>();
    for (int i = NUMBER_OF_CLUSTERS; i >= 1; i--) {
      clusterList.add(new Cluster()
          .clusterName(CLUSTER_NAME_PREFIX + i)
          .replicas(replicaCount)
          .serverStartState("RUNNING"));
    }
    Domain domain = new Domain()
        .apiVersion(DOMAIN_API_VERSION)
        .kind("Domain")
        .metadata(new V1ObjectMeta()
            .name(domainUid)
            .namespace(domainNamespace))
        .spec(new DomainSpec()
            .domainUid(domainUid)
            .domainHomeSourceType("FromModel")
            .image(miiImage)
            .addImagePullSecretsItem(new V1LocalObjectReference()
                .name(REPO_SECRET_NAME))
            .webLogicCredentialsSecret(new V1SecretReference()
                .name(adminSecretName)
                .namespace(domainNamespace))
            .includeServerOutInPodLog(true)
            .serverStartPolicy("IF_NEEDED")
            .serverPod(new ServerPod()
                .addEnvItem(new V1EnvVar()
                    .name("JAVA_OPTIONS")
                    .value("-Dweblogic.StdoutDebugEnabled=false"))
                .addEnvItem(new V1EnvVar()
                    .name("USER_MEM_ARGS")
                    .value("-Djava.security.egd=file:/dev/./urandom ")))
            .adminServer(new AdminServer()
                .serverStartState("RUNNING")
                .adminService(new AdminService()
                    .addChannelsItem(new Channel()
                        .channelName("default")
                        .nodePort(0))))
            .clusters(clusterList)
            .configuration(new Configuration()
                .model(new Model()
                    .domainType(WLS_DOMAIN_TYPE)
                    .runtimeEncryptionSecret(encryptionSecretName))));
    logger.info("Creating model in image domain {0} in namespace {1} using docker image {2}",
        domainUid, domainNamespace, miiImage);
    createDomainAndVerify(domain, domainNamespace);
    logger.info("Checking that admin server pod {0} exists in namespace {1}",
        adminServerPodName, domainNamespace);
    checkPodExists(adminServerPodName, domainUid, domainNamespace);
    logger.info("Checking that admin server pod {0} is ready in namespace {1}",
        adminServerPodName, domainNamespace);
    checkPodReady(adminServerPodName, domainUid, domainNamespace);
    logger.info("Checking that admin service {0} exists in namespace {1}",
        adminServerPodName, domainNamespace);
    checkServiceExists(adminServerPodName, domainNamespace);
    for (int i = 1; i <= NUMBER_OF_CLUSTERS; i++) {
      for (int j = 1; j <= replicaCount; j++) {
        String managedServerPodName =
            domainUid + "-" + CLUSTER_NAME_PREFIX + i + "-" + MANAGED_SERVER_NAME_BASE + j;
        logger.info("Checking that managed server pod {0} exists in namespace {1}",
            managedServerPodName, domainNamespace);
        checkPodExists(managedServerPodName, domainUid, domainNamespace);
        logger.info("Checking that managed server pod {0} is ready in namespace {1}",
            managedServerPodName, domainNamespace);
        checkPodReady(managedServerPodName, domainUid, domainNamespace);
        logger.info("Checking that managed server service {0} exists in namespace {1}",
            managedServerPodName, domainNamespace);
        checkServiceExists(managedServerPodName, domainNamespace);
      }
    }
  }
private static void createMiiDomainWithMultiClusters ( ) { String adminServerPodName = domainUid + "-" + ADMIN_SERVER_NAME_BASE ; logger . info ( "Creating image with model file and verify" ) ; List < String > appSrcDirList = new ArrayList < > ( ) ; appSrcDirList . add ( MII_BASIC_APP_NAME ) ; appSrcDirList . add ( WLDF_OPENSESSION_APP ) ; String miiImage = createMiiImageAndVerify ( MII_IMAGE_NAME , Collections . singletonList ( MODEL_DIR + "/" + WDT_MODEL_FILE ) , appSrcDirList , WLS_BASE_IMAGE_NAME , WLS_BASE_IMAGE_TAG , WLS_DOMAIN_TYPE , false ) ; dockerLoginAndPushImageToRegistry ( miiImage ) ; logger . info ( "Creating docker registry secret in namespace {0}" , domainNamespace ) ; createDockerRegistrySecret ( domainNamespace ) ; logger . info ( "Creating secret for admin credentials" ) ; String adminSecretName = "weblogic-credentials" ; createSecretWithUsernamePassword ( adminSecretName , domainNamespace , "weblogic" , "welcome1" ) ; logger . info ( "Creating encryption secret" ) ; String encryptionSecretName = "encryptionsecret" ; createSecretWithUsernamePassword ( encryptionSecretName , domainNamespace , "weblogicenc" , "weblogicenc" ) ; List < Cluster > clusterList = new ArrayList < > ( ) ; for ( int i = NUMBER_OF_CLUSTERS ; i >= 1 ; i -- ) { clusterList . add ( new Cluster ( ) . clusterName ( CLUSTER_NAME_PREFIX + i ) . replicas ( replicaCount ) . serverStartState ( "RUNNING" ) ) ; } Domain domain = new Domain ( ) . apiVersion ( DOMAIN_API_VERSION ) . kind ( "Domain" ) . metadata ( new V1ObjectMeta ( ) . name ( domainUid ) . namespace ( domainNamespace ) ) . spec ( new DomainSpec ( ) . domainUid ( domainUid ) . domainHomeSourceType ( "FromModel" ) . image ( miiImage ) . addImagePullSecretsItem ( new V1LocalObjectReference ( ) . name ( REPO_SECRET_NAME ) ) . webLogicCredentialsSecret ( new V1SecretReference ( ) . name ( adminSecretName ) . namespace ( domainNamespace ) ) . includeServerOutInPodLog ( true ) . serverStartPolicy ( "IF_NEEDED" ) . serverPod ( new ServerPod ( ) . addEnvItem ( new V1EnvVar ( ) . name ( "JAVA_OPTIONS" ) . value ( "-Dweblogic.StdoutDebugEnabled=false" ) ) . addEnvItem ( new V1EnvVar ( ) . name ( "USER_MEM_ARGS" ) . value ( "-Djava.security.egd=file:/dev/./urandom " ) ) ) . adminServer ( new AdminServer ( ) . serverStartState ( "RUNNING" ) . adminService ( new AdminService ( ) . addChannelsItem ( new Channel ( ) . channelName ( "default" ) . nodePort ( 0 ) ) ) ) . clusters ( clusterList ) . configuration ( new Configuration ( ) . model ( new Model ( ) . domainType ( WLS_DOMAIN_TYPE ) . runtimeEncryptionSecret ( encryptionSecretName ) ) ) ) ; logger . info ( "Creating model in image domain {0} in namespace {1} using docker image {2}" , domainUid , domainNamespace , miiImage ) ; createDomainAndVerify ( domain , domainNamespace ) ; logger . info ( "Checking that admin server pod {0} exists in namespace {1}" , adminServerPodName , domainNamespace ) ; checkPodExists ( adminServerPodName , domainUid , domainNamespace ) ; logger . info ( "Checking that admin server pod {0} is ready in namespace {1}" , adminServerPodName , domainNamespace ) ; checkPodReady ( adminServerPodName , domainUid , domainNamespace ) ; logger . info ( "Checking that admin service {0} exists in namespace {1}" , adminServerPodName , domainNamespace ) ; checkServiceExists ( adminServerPodName , domainNamespace ) ; for ( int i = 1 ; i <= NUMBER_OF_CLUSTERS ; i ++ ) { for ( int j = 1 ; j <= replicaCount ; j ++ ) { String managedServerPodName = domainUid + "-" + CLUSTER_NAME_PREFIX + i + "-" + MANAGED_SERVER_NAME_BASE + j ; logger . info ( "Checking that managed server pod {0} exists in namespace {1}" , managedServerPodName , domainNamespace ) ; checkPodExists ( managedServerPodName , domainUid , domainNamespace ) ; logger . info ( "Checking that managed server pod {0} is ready in namespace {1}" , managedServerPodName , domainNamespace ) ; checkPodReady ( managedServerPodName , domainUid , domainNamespace ) ; logger . info ( "Checking that managed server service {0} exists in namespace {1}" , managedServerPodName , domainNamespace ) ; checkServiceExists ( managedServerPodName , domainNamespace ) ; } } }
Create model in image domain with multiple clusters.
Create model in image domain with multiple clusters .
// admin/managed server name here should match with model yaml in WDT_MODEL_FILE // create image with model files // docker login and push image to docker registry if necessary // create docker registry secret to pull the image from registry // create secret for admin credentials // create encryption secret // construct the cluster list used for domain custom resource // create the domain CR // create model in image domain // check admin server pod exists in domain namespace // check admin server pod is ready // check admin service exists in the domain namespace // check the readiness for the managed servers in each cluster // check managed server pod exists in the namespace // check managed server pod is ready // check managed server service exists in the domain namespace