From 5dcaa7c3c55120309a57f2c3739ceedf0009f56c Mon Sep 17 00:00:00 2001 From: xiancao Date: Fri, 6 Aug 2021 23:51:21 +0000 Subject: [PATCH 1/3] add mii domain for managed Coherence test with Istio --- .../kubernetes/ItIstioManagedCoherence.java | 288 +++++++++++++++--- .../coherence-managed-wdt-config-mii.yaml | 71 +++++ 2 files changed, 310 insertions(+), 49 deletions(-) create mode 100644 integration-tests/src/test/resources/wdt-models/coherence-managed-wdt-config-mii.yaml diff --git a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItIstioManagedCoherence.java b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItIstioManagedCoherence.java index 3540616fcf9..ab1ab2c5b26 100644 --- a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItIstioManagedCoherence.java +++ b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItIstioManagedCoherence.java @@ -6,13 +6,16 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; +import io.kubernetes.client.custom.Quantity; import io.kubernetes.client.openapi.models.V1EnvVar; import io.kubernetes.client.openapi.models.V1LocalObjectReference; import io.kubernetes.client.openapi.models.V1ObjectMeta; +import io.kubernetes.client.openapi.models.V1ResourceRequirements; import io.kubernetes.client.openapi.models.V1SecretReference; import oracle.weblogic.domain.AdminServer; import oracle.weblogic.domain.Cluster; @@ -22,31 +25,36 @@ import oracle.weblogic.domain.Istio; import oracle.weblogic.domain.Model; import oracle.weblogic.domain.ServerPod; -import oracle.weblogic.kubernetes.actions.impl.primitive.HelmParams; import oracle.weblogic.kubernetes.annotations.IntegrationTest; import oracle.weblogic.kubernetes.annotations.Namespaces; import oracle.weblogic.kubernetes.logging.LoggingFacade; import oracle.weblogic.kubernetes.utils.BuildApplication; import oracle.weblogic.kubernetes.utils.ExecCommand; import oracle.weblogic.kubernetes.utils.ExecResult; -import org.awaitility.core.ConditionFactory; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; -import static java.util.concurrent.TimeUnit.MINUTES; -import static java.util.concurrent.TimeUnit.SECONDS; +import static oracle.weblogic.kubernetes.TestConstants.ADMIN_PASSWORD_DEFAULT; +import static oracle.weblogic.kubernetes.TestConstants.ADMIN_SERVER_NAME_BASE; +import static oracle.weblogic.kubernetes.TestConstants.ADMIN_USERNAME_DEFAULT; import static oracle.weblogic.kubernetes.TestConstants.DOMAIN_API_VERSION; import static oracle.weblogic.kubernetes.TestConstants.K8S_NODEPORT_HOST; import static oracle.weblogic.kubernetes.TestConstants.MANAGED_SERVER_NAME_BASE; import static oracle.weblogic.kubernetes.TestConstants.OCIR_SECRET_NAME; +import static oracle.weblogic.kubernetes.TestConstants.WEBLOGIC_IMAGE_NAME; +import static oracle.weblogic.kubernetes.TestConstants.WEBLOGIC_IMAGE_TAG; +import static oracle.weblogic.kubernetes.TestConstants.WLS_DOMAIN_TYPE; import static oracle.weblogic.kubernetes.actions.ActionConstants.APP_DIR; +import static oracle.weblogic.kubernetes.actions.ActionConstants.MODEL_DIR; import static oracle.weblogic.kubernetes.actions.ActionConstants.RESOURCE_DIR; import static oracle.weblogic.kubernetes.actions.TestActions.addLabelsToNamespace; import static oracle.weblogic.kubernetes.actions.TestActions.createDomainCustomResource; import static oracle.weblogic.kubernetes.utils.CommonTestUtils.checkPodReady; +import static oracle.weblogic.kubernetes.utils.CommonTestUtils.checkPodReadyAndServiceExists; import static oracle.weblogic.kubernetes.utils.CommonTestUtils.checkServiceExists; +import static oracle.weblogic.kubernetes.utils.CommonTestUtils.createDomainAndVerify; import static oracle.weblogic.kubernetes.utils.CommonTestUtils.createSecretWithUsernamePassword; import static oracle.weblogic.kubernetes.utils.CommonTestUtils.generateFileFromTemplate; import static oracle.weblogic.kubernetes.utils.CommonTestUtils.setPodAntiAffinity; @@ -58,7 +66,6 @@ import static oracle.weblogic.kubernetes.utils.OperatorUtils.installAndVerifyOperator; import static oracle.weblogic.kubernetes.utils.TestUtils.callWebAppAndWaitTillReady; import static oracle.weblogic.kubernetes.utils.ThreadSafeLogger.getLogger; -import static org.awaitility.Awaitility.with; import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; @@ -76,6 +83,7 @@ class ItIstioManagedCoherence { // constants for creating domain image using model in image private static final String COHERENCE_MODEL_FILE = "coherence-managed-wdt-config.yaml"; + private static final String MII_COHERENCE_MODEL_FILE = "coherence-managed-wdt-config-mii.yaml"; private static final String COHERENCE_MODEL_PROP = "coherence-managed-wdt-config.properties"; private static final String COHERENCE_IMAGE_NAME = "coherence-managed-image"; @@ -83,18 +91,17 @@ class ItIstioManagedCoherence { private static final String domainUid = "coherence-managed-domain"; private static final int NUMBER_OF_CLUSTERS = 2; private static final String CLUSTER_NAME_PREFIX = "cluster-"; - private static final int MANAGED_SERVER_PORT = 8001; private static final int replicaCount = 2; private static String adminServerPodName = domainUid + "-admin-server"; - private static String cluster1Hostname = null; - private static String cluster2Hostname = null; + private static final String miiImageName = "mii-image"; + private static final String miiDomainUid = "miidomain"; private static String opNamespace = null; - private static String domainNamespace = null; - private static ConditionFactory withStandardRetryPolicy = null; + private static String domainInImageNamespace = null; + private static String miiDomainNamespace = null; + private static String miiImage = null; + private static String encryptionSecretName = "encryptionsecret"; - private static boolean enableValidatingWebhook = false; - private static HelmParams voyagerHelmParams = null; private static LoggingFacade logger = null; /** @@ -108,36 +115,37 @@ class ItIstioManagedCoherence { * JUnit engine parameter resolution mechanism */ @BeforeAll - public static void init(@Namespaces(2) List namespaces) { + public static void init(@Namespaces(3) List namespaces) { logger = getLogger(); - // create standard, reusable retry/backoff policy - withStandardRetryPolicy = with().pollDelay(2, SECONDS) - .and().with().pollInterval(10, SECONDS) - .atMost(5, MINUTES).await(); // get a new unique opNamespace logger.info("Assigning a unique namespace for Operator"); assertNotNull(namespaces.get(0), "Namespace list is null"); opNamespace = namespaces.get(0); - // get a new unique domainNamespace - logger.info("Assigning a unique namespace for Domain"); + // get a new unique namespace for domain-in-image domain + logger.info("Assigning a unique namespace for domain-in-image Domain"); assertNotNull(namespaces.get(1), "Namespace list is null"); - domainNamespace = namespaces.get(1); + domainInImageNamespace = namespaces.get(1); + + // get a new unique namespace for model-in-image domain + logger.info("Assigning a unique namespace for model-in-image Domain"); + assertNotNull(namespaces.get(2), "Namespace list is null"); + miiDomainNamespace = namespaces.get(2); - // Label the domain/operator namespace with istio-injection=enabled Map labelMap = new HashMap(); labelMap.put("istio-injection", "enabled"); - assertDoesNotThrow(() -> addLabelsToNamespace(domainNamespace,labelMap)); - assertDoesNotThrow(() -> addLabelsToNamespace(opNamespace,labelMap)); + assertDoesNotThrow(() -> addLabelsToNamespace(domainInImageNamespace, labelMap)); + assertDoesNotThrow(() -> addLabelsToNamespace(miiDomainNamespace, labelMap)); + assertDoesNotThrow(() -> addLabelsToNamespace(opNamespace, labelMap)); // install and verify operator - installAndVerifyOperator(opNamespace, domainNamespace); + installAndVerifyOperator(opNamespace, domainInImageNamespace, miiDomainNamespace); // build Coherence applications Path distDir = BuildApplication.buildApplication(Paths.get(APP_DIR, COHERENCE_APP_NAME), - null, null, "builddir", domainNamespace); + null, null, "builddir", domainInImageNamespace); Path coherenceAppGarPath = Paths.get(distDir.toString(), COHERENCE_APP_NAME + ".gar"); Path coherenceAppEarPath = Paths.get(distDir.toString(), COHERENCE_APP_NAME + ".ear"); assertTrue(coherenceAppGarPath.toFile().exists(), "Application archive is not available"); @@ -147,7 +155,7 @@ public static void init(@Namespaces(2) List namespaces) { } /** - * Create domain with two clusters, cluster-1 and cluster-2. + * Create domain-in-image domain with two clusters, cluster-1 and cluster-2. * Associate them with a Coherence cluster * Deploy the EAR file to cluster-1 that has no storage enabled * Deploy the GAR file to cluster-2 that has storage enabled @@ -156,7 +164,7 @@ public static void init(@Namespaces(2) List namespaces) { */ @Test @DisplayName("Two cluster domain with a Coherence cluster with ISTIO and test interaction with cache data") - void testIstioMultiClusterCoherenceDomain() { + void testIstioMultiClusterCoherenceDomainInImageDomain() { // create a DomainHomeInImage image using WebLogic Image Tool String domImage = createAndVerifyDomainImage(); @@ -166,9 +174,9 @@ void testIstioMultiClusterCoherenceDomain() { String clusterService = domainUid + "-cluster-cluster-1"; Map templateMap = new HashMap(); - templateMap.put("NAMESPACE", domainNamespace); + templateMap.put("NAMESPACE", domainInImageNamespace); templateMap.put("DUID", domainUid); - templateMap.put("ADMIN_SERVICE",adminServerPodName); + templateMap.put("ADMIN_SERVICE", adminServerPodName); templateMap.put("CLUSTER_SERVICE", clusterService); Path srcHttpFile = Paths.get(RESOURCE_DIR, "istio", "istio-coh-http-template.yaml"); @@ -195,20 +203,69 @@ void testIstioMultiClusterCoherenceDomain() { assertTrue(testCompletedSuccessfully, "Test Coherence cache failed"); } + + /** + * Create model-in-image domain with two clusters, cluster-1 and cluster-2. + * Associate them with a Coherence cluster + * Deploy the EAR file to cluster-1 that has no storage enabled + * Deploy the GAR file to cluster-2 that has storage enabled + * Verify that data can be added and stored in the cache + * and can also be retrieved from cache. + */ + @Test + @DisplayName("Two cluster mii domain with a Coherence cluster with ISTIO and test interaction with cache data") + void testIstioMultiClusterCoherenceMiiDomain() { + + // create a model-in-image domain image using WebLogic Image Tool + miiImage = createAndPushMiiImage(); + + // create and verify a two-clusters WebLogic domain with a Coherence cluster + createMiiDomainWithMultiClusters(miiDomainUid, miiDomainNamespace); + + Map templateMap = new HashMap(); + templateMap.put("NAMESPACE", miiDomainNamespace); + templateMap.put("DUID", miiDomainUid); + templateMap.put("ADMIN_SERVICE", miiDomainUid + "-" + ADMIN_SERVER_NAME_BASE); + templateMap.put("CLUSTER_SERVICE", miiDomainUid + "-cluster-cluster-1"); + + Path srcHttpFile = Paths.get(RESOURCE_DIR, "istio", "istio-coh-http-template.yaml"); + Path targetHttpFile = assertDoesNotThrow( + () -> generateFileFromTemplate(srcHttpFile.toString(), "istio-http.yaml", templateMap)); + logger.info("Generated Http VS/Gateway file path is {0}", targetHttpFile); + + boolean deployRes = assertDoesNotThrow( + () -> deployHttpIstioGatewayAndVirtualservice(targetHttpFile)); + assertTrue(deployRes, "Failed to deploy Http Istio Gateway/VirtualService"); + + int istioIngressPort = getIstioHttpIngressPort(); + logger.info("Istio Ingress Port is {0}", istioIngressPort); + + // Make sure ready app is accessible thru Istio Ingress Port + String curlCmd = "curl --silent --show-error --noproxy '*' http://" + K8S_NODEPORT_HOST + ":" + istioIngressPort + + "/weblogic/ready --write-out %{http_code} -o /dev/null"; + logger.info("Executing curl command {0}", curlCmd); + assertTrue(callWebAppAndWaitTillReady(curlCmd, 60)); + + // test adding data to the cache and retrieving them from the cache + boolean testCompletedSuccessfully = assertDoesNotThrow(() + -> coherenceCacheTest(istioIngressPort), "Test Coherence cache failed"); + assertTrue(testCompletedSuccessfully, "Test Coherence cache failed"); + } + private static String createAndVerifyDomainImage() { // create image with model files logger.info("Create image with model file and verify"); String domImage = createImageAndVerify( COHERENCE_IMAGE_NAME, COHERENCE_MODEL_FILE, - COHERENCE_APP_NAME, COHERENCE_MODEL_PROP, domainUid); + COHERENCE_APP_NAME, COHERENCE_MODEL_PROP, domainUid); // docker login and push image to docker registry if necessary dockerLoginAndPushImageToRegistry(domImage); // create docker registry secret to pull the image from registry // this secret is used only for non-kind cluster - logger.info("Create docker registry secret in namespace {0}", domainNamespace); - createOcirRepoSecret(domainNamespace); + logger.info("Create docker registry secret in namespace {0}", domainInImageNamespace); + createOcirRepoSecret(domainInImageNamespace); return domImage; } @@ -216,31 +273,30 @@ private static void createAndVerifyDomain(String domImage) { // create secret for admin credentials logger.info("Create secret for admin credentials"); String adminSecretName = "weblogic-credentials"; - assertDoesNotThrow(() -> createSecretWithUsernamePassword(adminSecretName, domainNamespace, + assertDoesNotThrow(() -> createSecretWithUsernamePassword(adminSecretName, domainInImageNamespace, "weblogic", "welcome1"), String.format("create secret for admin credentials failed for %s", adminSecretName)); // create encryption secret logger.info("Create encryption secret"); - String encryptionSecretName = "encryptionsecret"; - assertDoesNotThrow(() -> createSecretWithUsernamePassword(encryptionSecretName, domainNamespace, + assertDoesNotThrow(() -> createSecretWithUsernamePassword(encryptionSecretName, domainInImageNamespace, "weblogicenc", "weblogicenc"), String.format("create encryption secret failed for %s", encryptionSecretName)); // create domain and verify logger.info("Create model in image domain {0} in namespace {1} using docker image {2}", - domainUid, domainNamespace, domImage); + domainUid, domainInImageNamespace, domImage); createDomainCrAndVerify(adminSecretName, domImage); // check that admin service exists in the domain namespace logger.info("Checking that admin service {0} exists in namespace {1}", - adminServerPodName, domainNamespace); - checkServiceExists(adminServerPodName, domainNamespace); + adminServerPodName, domainInImageNamespace); + checkServiceExists(adminServerPodName, domainInImageNamespace); // check that admin server pod is ready logger.info("Checking that admin server pod {0} is ready in namespace {1}", - adminServerPodName, domainNamespace); - checkPodReady(adminServerPodName, domainUid, domainNamespace); + adminServerPodName, domainInImageNamespace); + checkPodReady(adminServerPodName, domainUid, domainInImageNamespace); // check the readiness for the managed servers in each cluster for (int i = 1; i <= NUMBER_OF_CLUSTERS; i++) { @@ -250,13 +306,13 @@ private static void createAndVerifyDomain(String domImage) { // check that the 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); + managedServerPodName, domainInImageNamespace); + checkServiceExists(managedServerPodName, domainInImageNamespace); // check that the managed server pod is ready logger.info("Checking that managed server pod {0} is ready in namespace {1}", - managedServerPodName, domainNamespace); - checkPodReady(managedServerPodName, domainUid, domainNamespace); + managedServerPodName, domainInImageNamespace); + checkPodReady(managedServerPodName, domainUid, domainInImageNamespace); } } } @@ -277,7 +333,7 @@ private static void createDomainCrAndVerify(String adminSecretName, String domIm .kind("Domain") .metadata(new V1ObjectMeta() .name(domainUid) - .namespace(domainNamespace)) + .namespace(domainInImageNamespace)) .spec(new DomainSpec() .domainUid(domainUid) .domainHomeSourceType("Image") @@ -286,7 +342,7 @@ private static void createDomainCrAndVerify(String adminSecretName, String domIm .name(OCIR_SECRET_NAME)) .webLogicCredentialsSecret(new V1SecretReference() .name(adminSecretName) - .namespace(domainNamespace)) + .namespace(domainInImageNamespace)) .includeServerOutInPodLog(true) .serverStartPolicy("IF_NEEDED") .serverPod(new ServerPod() @@ -308,12 +364,12 @@ private static void createDomainCrAndVerify(String adminSecretName, String domIm .introspectorJobActiveDeadlineSeconds(300L))); setPodAntiAffinity(domain); logger.info("Create domain custom resource for domainUid {0} in namespace {1}", - domainUid, domainNamespace); + domainUid, domainInImageNamespace); boolean domCreated = assertDoesNotThrow(() -> createDomainCustomResource(domain), String.format("Create domain custom resource failed with ApiException for %s in namespace %s", - domainUid, domainNamespace)); + domainUid, domainInImageNamespace)); assertTrue(domCreated, String.format("Create domain custom resource failed with ApiException " - + "for %s in namespace %s", domainUid, domainNamespace)); + + "for %s in namespace %s", domainUid, domainInImageNamespace)); } private boolean coherenceCacheTest(int ingressServiceNodePort) { @@ -442,4 +498,138 @@ private ExecResult clearCache(String hostAndPort) { return result; } + + + /** + * Create mii image and push it to the registry. + * + * @return mii image created + */ + private String createAndPushMiiImage() { + // create image with model files + logger.info("Creating image with model file {0} and verify", MII_COHERENCE_MODEL_FILE); + List appSrcDirList = Collections.singletonList(COHERENCE_APP_NAME); + List wdtModelList = Collections.singletonList(MODEL_DIR + "/" + MII_COHERENCE_MODEL_FILE); + List modelPropList = Collections.singletonList(MODEL_DIR + "/" + COHERENCE_MODEL_PROP); + + miiImage = + createImageAndVerify(miiImageName, wdtModelList, appSrcDirList, modelPropList, WEBLOGIC_IMAGE_NAME, + WEBLOGIC_IMAGE_TAG, WLS_DOMAIN_TYPE, true, miiDomainUid, false); + + // docker login and push image to docker registry if necessary + dockerLoginAndPushImageToRegistry(miiImage); + + return miiImage; + } + + /** + * Create model in image domain with multiple clusters. + * + * @param domainNamespace namespace in which the domain will be created + * @return oracle.weblogic.domain.Domain objects + */ + private static Domain createMiiDomainWithMultiClusters(String domainUid, String domainNamespace) { + + // admin/managed server name here should match with WDT model yaml file + String adminServerPodName = domainUid + "-" + ADMIN_SERVER_NAME_BASE; + + // create docker registry secret to pull the image from registry + // this secret is used only for non-kind cluster + logger.info("Creating docker registry secret in namespace {0}", domainNamespace); + createOcirRepoSecret(domainNamespace); + + // create secret for admin credentials + logger.info("Creating secret for admin credentials"); + String adminSecretName = "weblogic-credentials"; + createSecretWithUsernamePassword(adminSecretName, domainNamespace, ADMIN_USERNAME_DEFAULT, ADMIN_PASSWORD_DEFAULT); + + // create encryption secret + logger.info("Creating encryption secret"); + createSecretWithUsernamePassword(encryptionSecretName, domainNamespace, "weblogicenc", "weblogicenc"); + + // construct the cluster list used for domain custom resource + List 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")); + } + + // set resource request and limit + Map resourceRequest = new HashMap<>(); + Map resourceLimit = new HashMap<>(); + resourceRequest.put("cpu", new Quantity("250m")); + resourceRequest.put("memory", new Quantity("768Mi")); + resourceLimit.put("cpu", new Quantity("2")); + resourceLimit.put("memory", new Quantity("2Gi")); + + // 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) + .domainHome("/u01/domains/" + domainUid) + .domainHomeSourceType("FromModel") + .image(miiImage) + .addImagePullSecretsItem(new V1LocalObjectReference() + .name(OCIR_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 ")) + .resources(new V1ResourceRequirements() + .requests(resourceRequest) + .limits(resourceLimit))) + .adminServer(new AdminServer() + .serverStartState("RUNNING")) + .clusters(clusterList) + .configuration(new Configuration() + .istio(new Istio() + .enabled(Boolean.TRUE) + .readinessPort(8888)) + .model(new Model() + .domainType(WLS_DOMAIN_TYPE) + .runtimeEncryptionSecret(encryptionSecretName)) + .introspectorJobActiveDeadlineSeconds(300L))); + + setPodAntiAffinity(domain); + + // 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 that admin server pod is ready and service exists in domain namespace + logger.info("Checking that admin server pod {0} is ready and service exists in namespace {1}", + adminServerPodName, domainNamespace); + checkPodReadyAndServiceExists(adminServerPodName, domainUid, 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 is ready and service exists in the namespace + logger.info("Checking that managed server pod {0} is ready and service exists in namespace {1}", + managedServerPodName, domainNamespace); + checkPodReadyAndServiceExists(managedServerPodName, domainUid, domainNamespace); + } + } + + return domain; + } } diff --git a/integration-tests/src/test/resources/wdt-models/coherence-managed-wdt-config-mii.yaml b/integration-tests/src/test/resources/wdt-models/coherence-managed-wdt-config-mii.yaml new file mode 100644 index 00000000000..cde02ea9e40 --- /dev/null +++ b/integration-tests/src/test/resources/wdt-models/coherence-managed-wdt-config-mii.yaml @@ -0,0 +1,71 @@ +# Copyright (c) 2020, 2021, Oracle and/or its affiliates. +# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. + +domainInfo: + AdminUserName: '@@PROP:AdminUserName@@' + AdminPassword: '@@PROP:AdminPassword@@' + ServerStartMode: 'prod' +topology: + Name: 'miidomain' + AdminServerName: 'admin-server' + Cluster: + 'cluster-1': + CoherenceClusterSystemResource: CoherenceCluster + CoherenceTier: + CoherenceWebFederatedStorageEnabled: false + CoherenceWebLocalStorageEnabled: false + LocalStorageEnabled: false + DynamicServers: + ServerNamePrefix: 'cluster-1-managed-server' + MaxDynamicClusterSize: 5 + CalculatedListenPorts: false + MaximumDynamicServerCount: 5 + DynamicClusterSize: 5 + ServerTemplate: 'cluster-1-template' + 'cluster-2': + CoherenceClusterSystemResource: CoherenceCluster + CoherenceTier: + CoherenceWebFederatedStorageEnabled: false + CoherenceWebLocalStorageEnabled: false + LocalStorageEnabled: true + DynamicServers: + ServerNamePrefix: 'cluster-2-managed-server' + MaxDynamicClusterSize: 5 + CalculatedListenPorts: false + MaximumDynamicServerCount: 5 + DynamicClusterSize: 5 + ServerTemplate: 'cluster-2-template' + Server: + 'admin-server': + ListenPort: 7001 + ServerTemplate: + 'cluster-1-template': + ListenPort: 8001 + Cluster: 'cluster-1' + CoherenceClusterSystemResource: CoherenceCluster + CoherenceMemberConfig: + UnicastListenAddress: 'miidomain-cluster-1-managed-server${id}' + 'cluster-2-template': + ListenPort: 8001 + Cluster: 'cluster-2' + CoherenceClusterSystemResource: CoherenceCluster + CoherenceMemberConfig: + UnicastListenAddress: 'miidomain-cluster-2-managed-server${id}' +resources: + CoherenceClusterSystemResource: + CoherenceCluster: + Target: 'cluster-1,cluster-2' + CoherenceResource: + CoherenceClusterParams: + ClusteringMode: unicast + ClusterListenPort: 7574 +appDeployments: + Application: + 'CoherenceApp': + SourcePath: 'wlsdeploy/applications/CoherenceApp.ear' + ModuleType: ear + Target: 'cluster-1' + 'CoherenceAppGAR': + SourcePath: 'wlsdeploy/applications/CoherenceApp.gar' + ModuleType: gar + Target: 'cluster-2' From 49af5efecb55f65a26354e7657ec1ca90070ac96 Mon Sep 17 00:00:00 2001 From: xiancao Date: Sat, 7 Aug 2021 00:56:17 +0000 Subject: [PATCH 2/3] cleanup --- .../oracle/weblogic/kubernetes/ItIstioManagedCoherence.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItIstioManagedCoherence.java b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItIstioManagedCoherence.java index ab1ab2c5b26..8c81372e1b6 100644 --- a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItIstioManagedCoherence.java +++ b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItIstioManagedCoherence.java @@ -221,7 +221,7 @@ void testIstioMultiClusterCoherenceMiiDomain() { // create and verify a two-clusters WebLogic domain with a Coherence cluster createMiiDomainWithMultiClusters(miiDomainUid, miiDomainNamespace); - + Map templateMap = new HashMap(); templateMap.put("NAMESPACE", miiDomainNamespace); templateMap.put("DUID", miiDomainUid); @@ -525,6 +525,7 @@ private String createAndPushMiiImage() { /** * Create model in image domain with multiple clusters. * + * @param domainUid the uid of the domain * @param domainNamespace namespace in which the domain will be created * @return oracle.weblogic.domain.Domain objects */ From ee1a0fcd7dbaa6a229fe82e17dde121e48d94e5b Mon Sep 17 00:00:00 2001 From: xiancao Date: Wed, 11 Aug 2021 02:51:04 +0000 Subject: [PATCH 3/3] address Pani's comments --- .../kubernetes/ItIstioManagedCoherence.java | 154 +--------------- .../kubernetes/utils/CommonMiiTestUtils.java | 164 ++++++++++++++++++ 2 files changed, 170 insertions(+), 148 deletions(-) diff --git a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItIstioManagedCoherence.java b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItIstioManagedCoherence.java index 33591a1d053..735c0604218 100644 --- a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItIstioManagedCoherence.java +++ b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItIstioManagedCoherence.java @@ -6,16 +6,13 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; -import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; -import io.kubernetes.client.custom.Quantity; import io.kubernetes.client.openapi.models.V1EnvVar; import io.kubernetes.client.openapi.models.V1LocalObjectReference; import io.kubernetes.client.openapi.models.V1ObjectMeta; -import io.kubernetes.client.openapi.models.V1ResourceRequirements; import io.kubernetes.client.openapi.models.V1SecretReference; import oracle.weblogic.domain.AdminServer; import oracle.weblogic.domain.Cluster; @@ -36,25 +33,19 @@ import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; -import static oracle.weblogic.kubernetes.TestConstants.ADMIN_PASSWORD_DEFAULT; import static oracle.weblogic.kubernetes.TestConstants.ADMIN_SERVER_NAME_BASE; -import static oracle.weblogic.kubernetes.TestConstants.ADMIN_USERNAME_DEFAULT; import static oracle.weblogic.kubernetes.TestConstants.DOMAIN_API_VERSION; import static oracle.weblogic.kubernetes.TestConstants.K8S_NODEPORT_HOST; import static oracle.weblogic.kubernetes.TestConstants.MANAGED_SERVER_NAME_BASE; import static oracle.weblogic.kubernetes.TestConstants.OCIR_SECRET_NAME; -import static oracle.weblogic.kubernetes.TestConstants.WEBLOGIC_IMAGE_NAME; -import static oracle.weblogic.kubernetes.TestConstants.WEBLOGIC_IMAGE_TAG; -import static oracle.weblogic.kubernetes.TestConstants.WLS_DOMAIN_TYPE; import static oracle.weblogic.kubernetes.actions.ActionConstants.APP_DIR; -import static oracle.weblogic.kubernetes.actions.ActionConstants.MODEL_DIR; import static oracle.weblogic.kubernetes.actions.ActionConstants.RESOURCE_DIR; import static oracle.weblogic.kubernetes.actions.TestActions.addLabelsToNamespace; import static oracle.weblogic.kubernetes.actions.TestActions.createDomainCustomResource; import static oracle.weblogic.kubernetes.utils.ApplicationUtils.callWebAppAndWaitTillReady; -import static oracle.weblogic.kubernetes.utils.CommonTestUtils.checkPodReadyAndServiceExists; +import static oracle.weblogic.kubernetes.utils.CommonMiiTestUtils.createAndPushMiiImage; +import static oracle.weblogic.kubernetes.utils.CommonMiiTestUtils.createMiiDomainWithIstioMultiClusters; import static oracle.weblogic.kubernetes.utils.CommonTestUtils.checkServiceExists; -import static oracle.weblogic.kubernetes.utils.DomainUtils.createDomainAndVerify; import static oracle.weblogic.kubernetes.utils.FileUtils.generateFileFromTemplate; import static oracle.weblogic.kubernetes.utils.ImageUtils.createImageAndVerify; import static oracle.weblogic.kubernetes.utils.ImageUtils.createOcirRepoSecret; @@ -163,7 +154,8 @@ public static void init(@Namespaces(3) List namespaces) { * and can also be retrieved from cache. */ @Test - @DisplayName("Two cluster domain with a Coherence cluster with ISTIO and test interaction with cache data") + @DisplayName("Two cluster domain-in-image domain with a Coherence cluster with ISTIO and " + + "test interaction with cache data") void testIstioMultiClusterCoherenceDomainInImageDomain() { // create a DomainHomeInImage image using WebLogic Image Tool @@ -217,10 +209,10 @@ void testIstioMultiClusterCoherenceDomainInImageDomain() { void testIstioMultiClusterCoherenceMiiDomain() { // create a model-in-image domain image using WebLogic Image Tool - miiImage = createAndPushMiiImage(); + miiImage = createAndPushMiiImage(miiImageName, MII_COHERENCE_MODEL_FILE, COHERENCE_APP_NAME, COHERENCE_MODEL_PROP); // create and verify a two-clusters WebLogic domain with a Coherence cluster - createMiiDomainWithMultiClusters(miiDomainUid, miiDomainNamespace); + createMiiDomainWithIstioMultiClusters(miiDomainUid, miiDomainNamespace, miiImage, NUMBER_OF_CLUSTERS, replicaCount); Map templateMap = new HashMap(); templateMap.put("NAMESPACE", miiDomainNamespace); @@ -499,138 +491,4 @@ private ExecResult clearCache(String hostAndPort) { return result; } - - /** - * Create mii image and push it to the registry. - * - * @return mii image created - */ - private String createAndPushMiiImage() { - // create image with model files - logger.info("Creating image with model file {0} and verify", MII_COHERENCE_MODEL_FILE); - List appSrcDirList = Collections.singletonList(COHERENCE_APP_NAME); - List wdtModelList = Collections.singletonList(MODEL_DIR + "/" + MII_COHERENCE_MODEL_FILE); - List modelPropList = Collections.singletonList(MODEL_DIR + "/" + COHERENCE_MODEL_PROP); - - miiImage = - createImageAndVerify(miiImageName, wdtModelList, appSrcDirList, modelPropList, WEBLOGIC_IMAGE_NAME, - WEBLOGIC_IMAGE_TAG, WLS_DOMAIN_TYPE, true, miiDomainUid, false); - - // docker login and push image to docker registry if necessary - dockerLoginAndPushImageToRegistry(miiImage); - - return miiImage; - } - - /** - * Create model in image domain with multiple clusters. - * - * @param domainUid the uid of the domain - * @param domainNamespace namespace in which the domain will be created - * @return oracle.weblogic.domain.Domain objects - */ - private static Domain createMiiDomainWithMultiClusters(String domainUid, String domainNamespace) { - - // admin/managed server name here should match with WDT model yaml file - String adminServerPodName = domainUid + "-" + ADMIN_SERVER_NAME_BASE; - - // create docker registry secret to pull the image from registry - // this secret is used only for non-kind cluster - logger.info("Creating docker registry secret in namespace {0}", domainNamespace); - createOcirRepoSecret(domainNamespace); - - // create secret for admin credentials - logger.info("Creating secret for admin credentials"); - String adminSecretName = "weblogic-credentials"; - createSecretWithUsernamePassword(adminSecretName, domainNamespace, ADMIN_USERNAME_DEFAULT, ADMIN_PASSWORD_DEFAULT); - - // create encryption secret - logger.info("Creating encryption secret"); - createSecretWithUsernamePassword(encryptionSecretName, domainNamespace, "weblogicenc", "weblogicenc"); - - // construct the cluster list used for domain custom resource - List 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")); - } - - // set resource request and limit - Map resourceRequest = new HashMap<>(); - Map resourceLimit = new HashMap<>(); - resourceRequest.put("cpu", new Quantity("250m")); - resourceRequest.put("memory", new Quantity("768Mi")); - resourceLimit.put("cpu", new Quantity("2")); - resourceLimit.put("memory", new Quantity("2Gi")); - - // 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) - .domainHome("/u01/domains/" + domainUid) - .domainHomeSourceType("FromModel") - .image(miiImage) - .addImagePullSecretsItem(new V1LocalObjectReference() - .name(OCIR_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 ")) - .resources(new V1ResourceRequirements() - .requests(resourceRequest) - .limits(resourceLimit))) - .adminServer(new AdminServer() - .serverStartState("RUNNING")) - .clusters(clusterList) - .configuration(new Configuration() - .istio(new Istio() - .enabled(Boolean.TRUE) - .readinessPort(8888)) - .model(new Model() - .domainType(WLS_DOMAIN_TYPE) - .runtimeEncryptionSecret(encryptionSecretName)) - .introspectorJobActiveDeadlineSeconds(300L))); - - setPodAntiAffinity(domain); - - // 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 that admin server pod is ready and service exists in domain namespace - logger.info("Checking that admin server pod {0} is ready and service exists in namespace {1}", - adminServerPodName, domainNamespace); - checkPodReadyAndServiceExists(adminServerPodName, domainUid, 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 is ready and service exists in the namespace - logger.info("Checking that managed server pod {0} is ready and service exists in namespace {1}", - managedServerPodName, domainNamespace); - checkPodReadyAndServiceExists(managedServerPodName, domainUid, domainNamespace); - } - } - - return domain; - } } diff --git a/integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/CommonMiiTestUtils.java b/integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/CommonMiiTestUtils.java index 463dd134457..7e6eb1de7f4 100644 --- a/integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/CommonMiiTestUtils.java +++ b/integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/CommonMiiTestUtils.java @@ -6,12 +6,14 @@ import java.time.OffsetDateTime; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Set; +import io.kubernetes.client.custom.Quantity; import io.kubernetes.client.custom.V1Patch; import io.kubernetes.client.openapi.models.V1Container; import io.kubernetes.client.openapi.models.V1EnvVar; @@ -24,6 +26,7 @@ import io.kubernetes.client.openapi.models.V1Pod; import io.kubernetes.client.openapi.models.V1PodSpec; import io.kubernetes.client.openapi.models.V1PodTemplateSpec; +import io.kubernetes.client.openapi.models.V1ResourceRequirements; import io.kubernetes.client.openapi.models.V1Secret; import io.kubernetes.client.openapi.models.V1SecretReference; import io.kubernetes.client.openapi.models.V1SecurityContext; @@ -38,6 +41,7 @@ import oracle.weblogic.domain.Configuration; import oracle.weblogic.domain.Domain; import oracle.weblogic.domain.DomainSpec; +import oracle.weblogic.domain.Istio; import oracle.weblogic.domain.Model; import oracle.weblogic.domain.OnlineUpdate; import oracle.weblogic.domain.ServerPod; @@ -51,14 +55,20 @@ import static java.util.concurrent.TimeUnit.SECONDS; import static oracle.weblogic.kubernetes.TestConstants.ADMIN_PASSWORD_DEFAULT; import static oracle.weblogic.kubernetes.TestConstants.ADMIN_PASSWORD_PATCH; +import static oracle.weblogic.kubernetes.TestConstants.ADMIN_SERVER_NAME_BASE; import static oracle.weblogic.kubernetes.TestConstants.ADMIN_USERNAME_DEFAULT; import static oracle.weblogic.kubernetes.TestConstants.ADMIN_USERNAME_PATCH; import static oracle.weblogic.kubernetes.TestConstants.BASE_IMAGES_REPO_SECRET; import static oracle.weblogic.kubernetes.TestConstants.DOMAIN_API_VERSION; import static oracle.weblogic.kubernetes.TestConstants.K8S_NODEPORT_HOST; +import static oracle.weblogic.kubernetes.TestConstants.MANAGED_SERVER_NAME_BASE; import static oracle.weblogic.kubernetes.TestConstants.MII_BASIC_APP_DEPLOYMENT_NAME; import static oracle.weblogic.kubernetes.TestConstants.OCIR_SECRET_NAME; +import static oracle.weblogic.kubernetes.TestConstants.WEBLOGIC_IMAGE_NAME; +import static oracle.weblogic.kubernetes.TestConstants.WEBLOGIC_IMAGE_TAG; import static oracle.weblogic.kubernetes.TestConstants.WEBLOGIC_IMAGE_TO_USE_IN_SPEC; +import static oracle.weblogic.kubernetes.TestConstants.WLS_DOMAIN_TYPE; +import static oracle.weblogic.kubernetes.actions.ActionConstants.MODEL_DIR; import static oracle.weblogic.kubernetes.actions.TestActions.createDomainCustomResource; import static oracle.weblogic.kubernetes.actions.TestActions.createSecret; import static oracle.weblogic.kubernetes.actions.TestActions.deleteConfigMap; @@ -73,12 +83,15 @@ import static oracle.weblogic.kubernetes.actions.impl.primitive.Kubernetes.listConfigMaps; import static oracle.weblogic.kubernetes.assertions.TestAssertions.podIntrospectVersionUpdated; import static oracle.weblogic.kubernetes.assertions.TestAssertions.verifyRollingRestartOccurred; +import static oracle.weblogic.kubernetes.utils.CommonTestUtils.checkPodReadyAndServiceExists; import static oracle.weblogic.kubernetes.utils.CommonTestUtils.checkServiceExists; import static oracle.weblogic.kubernetes.utils.CommonTestUtils.verifyCredentials; import static oracle.weblogic.kubernetes.utils.ConfigMapUtils.createConfigMapAndVerify; import static oracle.weblogic.kubernetes.utils.DomainUtils.createDomainAndVerify; import static oracle.weblogic.kubernetes.utils.ExecCommand.exec; +import static oracle.weblogic.kubernetes.utils.ImageUtils.createImageAndVerify; import static oracle.weblogic.kubernetes.utils.ImageUtils.createOcirRepoSecret; +import static oracle.weblogic.kubernetes.utils.ImageUtils.dockerLoginAndPushImageToRegistry; import static oracle.weblogic.kubernetes.utils.JobUtils.createJobAndWaitUntilComplete; import static oracle.weblogic.kubernetes.utils.JobUtils.getIntrospectJobName; import static oracle.weblogic.kubernetes.utils.PatchDomainUtils.patchDomainWithNewSecretAndVerify; @@ -1239,4 +1252,155 @@ public static ExecResult readFilesInPod(String domainNamespace, return result; } + + /** + * Create mii image and push it to the registry. + * + * @param miiImageNameBase the base mii image name used in local or to construct the image name in repository + * @param wdtModelFile wdt model file used to build the docker image + * @param appName application source directory used to build sample app ear files + * @param wdtModelPropFile wdt model properties file used to build the docker image + * @return mii image created + */ + public static String createAndPushMiiImage(String miiImageNameBase, + String wdtModelFile, + String appName, + String wdtModelPropFile) { + // create image with model files + LoggingFacade logger = getLogger(); + logger.info("Creating image with model file {0} and verify", wdtModelFile); + List appSrcDirList = Collections.singletonList(appName); + List wdtModelList = Collections.singletonList(MODEL_DIR + "/" + wdtModelFile); + List modelPropList = Collections.singletonList(MODEL_DIR + "/" + wdtModelPropFile); + + String miiImage = + createImageAndVerify(miiImageNameBase, wdtModelList, appSrcDirList, modelPropList, WEBLOGIC_IMAGE_NAME, + WEBLOGIC_IMAGE_TAG, WLS_DOMAIN_TYPE, true, null, false); + + // docker login and push image to docker registry if necessary + dockerLoginAndPushImageToRegistry(miiImage); + + return miiImage; + } + + /** + * Create model in image domain with multiple clusters. + * + * @param domainUid the uid of the domain + * @param domainNamespace namespace in which the domain will be created + * @param miiImage model in image domain docker image + * @param numOfClusters number of clusters in the domain + * @param replicaCount replica count of the cluster + * @return oracle.weblogic.domain.Domain objects + */ + public static Domain createMiiDomainWithIstioMultiClusters(String domainUid, + String domainNamespace, + String miiImage, + int numOfClusters, + int replicaCount) { + + LoggingFacade logger = getLogger(); + // admin/managed server name here should match with WDT model yaml file + String adminServerPodName = domainUid + "-" + ADMIN_SERVER_NAME_BASE; + + // create docker registry secret to pull the image from registry + // this secret is used only for non-kind cluster + logger.info("Creating docker registry secret in namespace {0}", domainNamespace); + createOcirRepoSecret(domainNamespace); + + // create secret for admin credentials + logger.info("Creating secret for admin credentials"); + String adminSecretName = "weblogic-credentials"; + createSecretWithUsernamePassword(adminSecretName, domainNamespace, ADMIN_USERNAME_DEFAULT, ADMIN_PASSWORD_DEFAULT); + + // create encryption secret + logger.info("Creating encryption secret"); + String encryptionsecret = "encryptionsecret"; + createSecretWithUsernamePassword(encryptionsecret, domainNamespace, "weblogicenc", "weblogicenc"); + + // construct the cluster list used for domain custom resource + List clusterList = new ArrayList<>(); + for (int i = numOfClusters; i >= 1; i--) { + clusterList.add(new Cluster() + .clusterName("cluster-" + i) + .replicas(replicaCount) + .serverStartState("RUNNING")); + } + + // set resource request and limit + Map resourceRequest = new HashMap<>(); + Map resourceLimit = new HashMap<>(); + resourceRequest.put("cpu", new Quantity("250m")); + resourceRequest.put("memory", new Quantity("768Mi")); + resourceLimit.put("cpu", new Quantity("2")); + resourceLimit.put("memory", new Quantity("2Gi")); + + // 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) + .domainHome("/u01/domains/" + domainUid) + .domainHomeSourceType("FromModel") + .image(miiImage) + .addImagePullSecretsItem(new V1LocalObjectReference() + .name(OCIR_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 ")) + .resources(new V1ResourceRequirements() + .requests(resourceRequest) + .limits(resourceLimit))) + .adminServer(new AdminServer() + .serverStartState("RUNNING")) + .clusters(clusterList) + .configuration(new Configuration() + .istio(new Istio() + .enabled(Boolean.TRUE) + .readinessPort(8888)) + .model(new Model() + .domainType(WLS_DOMAIN_TYPE) + .runtimeEncryptionSecret(encryptionsecret)) + .introspectorJobActiveDeadlineSeconds(300L))); + + setPodAntiAffinity(domain); + + // 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 that admin server pod is ready and service exists in domain namespace + logger.info("Checking that admin server pod {0} is ready and service exists in namespace {1}", + adminServerPodName, domainNamespace); + checkPodReadyAndServiceExists(adminServerPodName, domainUid, domainNamespace); + + // check the readiness for the managed servers in each cluster + for (int i = 1; i <= numOfClusters; i++) { + for (int j = 1; j <= replicaCount; j++) { + String managedServerPodName = + domainUid + "-cluster-" + i + "-" + MANAGED_SERVER_NAME_BASE + j; + + // check managed server pod is ready and service exists in the namespace + logger.info("Checking that managed server pod {0} is ready and service exists in namespace {1}", + managedServerPodName, domainNamespace); + checkPodReadyAndServiceExists(managedServerPodName, domainUid, domainNamespace); + } + } + + return domain; + } }