Skip to content

Commit 704a915

Browse files
committed
Merge branch 'backport-main-sankar' into 'release/4.0'
backporting changes from main branch MRs 4214,4213, and 4208 See merge request weblogic-cloud/weblogic-kubernetes-operator!4235
2 parents 1fbca7d + 1f50608 commit 704a915

File tree

13 files changed

+1431
-22
lines changed

13 files changed

+1431
-22
lines changed

integration-tests/src/test/java/oracle/verrazzano/weblogic/Workload.java

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33

44
package oracle.verrazzano.weblogic;
55

6+
import java.util.HashMap;
7+
import java.util.Map;
8+
69
import io.kubernetes.client.common.KubernetesObject;
710
import io.kubernetes.client.openapi.models.V1ObjectMeta;
811
import io.swagger.annotations.ApiModel;
@@ -25,6 +28,9 @@ public class Workload implements KubernetesObject {
2528
@ApiModelProperty("The Workload meta-data. Must include the name and namespace.")
2629
private V1ObjectMeta metadata = new V1ObjectMeta();
2730

31+
@ApiModelProperty("Configmap data of the Workload.")
32+
Map<String, String> data = new HashMap<>();
33+
2834
@ApiModelProperty("The specification of the Workload. Required.")
2935
private WorkloadSpec spec = new WorkloadSpec();
3036

@@ -94,7 +100,24 @@ public WorkloadSpec getSpec() {
94100

95101
public void setSpec(WorkloadSpec spec) {
96102
this.spec = spec;
97-
}
103+
}
104+
105+
public Workload data(Map<String, String> data) {
106+
this.data = data;
107+
return this;
108+
}
109+
110+
public Map<String, String> data() {
111+
return data;
112+
}
113+
114+
public Map<String, String> getData() {
115+
return data;
116+
}
117+
118+
public void setData(Map<String, String> data) {
119+
this.data = data;
120+
}
98121

99122
@Override
100123
public String toString() {
@@ -103,6 +126,7 @@ public String toString() {
103126
.append("kind", kind)
104127
.append("metadata", metadata)
105128
.append("spec", spec)
129+
.append("data", data)
106130
.toString();
107131
}
108132

@@ -113,6 +137,7 @@ public int hashCode() {
113137
.append(apiVersion)
114138
.append(kind)
115139
.append(spec)
140+
.append(data)
116141
.toHashCode();
117142
}
118143

@@ -131,6 +156,7 @@ public boolean equals(Object other) {
131156
.append(apiVersion, rhs.apiVersion)
132157
.append(kind, rhs.kind)
133158
.append(spec, rhs.spec)
159+
.append(data, rhs.data)
134160
.isEquals();
135161
}
136162

integration-tests/src/test/java/oracle/verrazzano/weblogic/kubernetes/ItVzDBOperator.java

Lines changed: 992 additions & 0 deletions
Large diffs are not rendered by default.

integration-tests/src/test/java/oracle/weblogic/kubernetes/TestConstants.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ public interface TestConstants {
9797
public static final String FMWINFRA_IMAGE_NAME_DEFAULT = "test-images/fmw-infrastructure";
9898
public static final String FMWINFRA_IMAGE_TAG_DEFAULT = "12.2.1.4";
9999
public static final String DB_IMAGE_NAME_DEFAULT = "test-images/database/enterprise";
100+
public static final String DB_PREBUILT_IMAGE_NAME_DEFAULT = "test-images/database/express";
100101
public static final String DB_IMAGE_TAG_DEFAULT = "12.2.0.1-slim";
101102

102103
// repository to push the domain images created during test execution
@@ -128,7 +129,10 @@ public interface TestConstants {
128129
// if base images repo is OCIR use OCIR default image values
129130
public static final String DB_IMAGE_NAME = BASE_IMAGES_PREFIX
130131
+ getNonEmptySystemProperty("wko.it.db.image.name", DB_IMAGE_NAME_DEFAULT);
132+
public static final String DB_PREBUILT_IMAGE_NAME = BASE_IMAGES_PREFIX
133+
+ getNonEmptySystemProperty("wko.it.db.prebuilt.image.name", DB_PREBUILT_IMAGE_NAME_DEFAULT);
131134
public static final String DB_IMAGE_TAG = getNonEmptySystemProperty("wko.it.db.image.tag", DB_IMAGE_TAG_DEFAULT);
135+
public static final String DB_IMAGE_PREBUILT_TAG = getNonEmptySystemProperty("wko.it.db.image.tag", "18.4.0-xe");
132136

133137
// WebLogic Base Image with Japanese Locale
134138
public static final String LOCALE_IMAGE_NAME = TEST_IMAGES_REPO + "/" + TEST_IMAGES_TENANCY + "/test-images/weblogic";
@@ -347,7 +351,9 @@ public interface TestConstants {
347351
getNonEmptySystemProperty("wko.it.istio.version", "1.13.2");
348352

349353
//MySQL database constants
350-
public static final String MYSQL_VERSION = "5.6";
354+
public static final String MYSQL_IMAGE = BASE_IMAGES_PREFIX
355+
+ "/test-images/database/mysql";
356+
public static final String MYSQL_VERSION = "8.0.29";
351357

352358
//OKE constants
353359
public static final boolean OKE_CLUSTER =
@@ -405,10 +411,10 @@ public interface TestConstants {
405411
public static final String ORACLE_DB_SECRET_NAME = "oracle-db-secret";
406412

407413
// Oracle database operator constants
408-
public static final String ORACLE_DB_OPERATOR_RELEASE_LATEST = "release/0.2.0";
414+
public static final String ORACLE_DB_OPERATOR_RELEASE_LATEST = "release/0.2.1";
409415
public static final String ORACLE_DB_OPERATOR_RELEASE =
410416
getNonEmptySystemProperty("wko.it.oracle.db.operator.release", ORACLE_DB_OPERATOR_RELEASE_LATEST);
411-
public static final String DB_OPERATOR_IMAGE = BASE_IMAGES_PREFIX + "test-images/database/operator:0.2.0";
417+
public static final String DB_OPERATOR_IMAGE = BASE_IMAGES_PREFIX + "test-images/database/operator:0.2.1";
412418
public static final String CERT_MANAGER
413419
= "https://github.com/jetstack/cert-manager/releases/latest/download/cert-manager.yaml";
414420
public static final String DB_OPERATOR_YAML_URL = "https://raw.githubusercontent.com/"

integration-tests/src/test/java/oracle/weblogic/kubernetes/actions/impl/primitive/Kubernetes.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1369,6 +1369,32 @@ public static boolean createComponent(Component component, String... comVersion)
13691369
return true;
13701370
}
13711371

1372+
/**
1373+
* Delete Component Custom Resources from a given namespace.
1374+
*
1375+
* @param name of the component to delete
1376+
* @param namespace namespace name
1377+
* @return true if the resource exists and deleted
1378+
* @throws io.kubernetes.client.openapi.ApiException when list fails
1379+
*/
1380+
public static boolean deleteComponent(String name, String namespace)
1381+
throws ApiException {
1382+
KubernetesApiResponse<Component> response = null;
1383+
try {
1384+
response = vzComCrdClient.delete(namespace, name);
1385+
} catch (Exception ex) {
1386+
getLogger().warning(ex.getMessage());
1387+
throw ex;
1388+
}
1389+
1390+
if (!response.isSuccess()) {
1391+
getLogger().warning("Failed to delete config map '" + name + "' from namespace: "
1392+
+ namespace + " with HTTP status code: " + response.getHttpStatusCode());
1393+
return false;
1394+
}
1395+
return response.isSuccess();
1396+
}
1397+
13721398
/**
13731399
* List Component Custom Resources from a given namespace.
13741400
*

integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/CommonTestUtils.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,8 @@ public static void runJavacInsidePod(String podName, String namespace, String de
811811
StringBuffer javacCmd = new StringBuffer(KUBERNETES_CLI + " exec -n ");
812812
javacCmd.append(namespace);
813813
javacCmd.append(" -it ");
814-
javacCmd.append(podName);
814+
javacCmd.append(" -c weblogic-server ");
815+
javacCmd.append(podName);
815816
javacCmd.append(" -- /bin/bash -c \"");
816817
javacCmd.append("javac -cp ");
817818
javacCmd.append(jarLocation);
@@ -844,6 +845,7 @@ public static Callable<Boolean> runClientInsidePod(String podName, String namesp
844845
StringBuffer javapCmd = new StringBuffer(KUBERNETES_CLI + " exec -n ");
845846
javapCmd.append(namespace);
846847
javapCmd.append(" -it ");
848+
javapCmd.append(" -c weblogic-server ");
847849
javapCmd.append(podName);
848850
javapCmd.append(" -- /bin/bash -c \"");
849851
javapCmd.append("java -cp ");

integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/ConfigMapUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ public static void editConfigMap(String oldRegex, String newRegex,
269269
/**
270270
* Read the content of a model file as a String and add it to a map.
271271
*/
272-
private static void addModelFile(Map<String, String> data, String modelFile) {
272+
public static void addModelFile(Map<String, String> data, String modelFile) {
273273
LoggingFacade logger = getLogger();
274274
logger.info("Add model file {0}", modelFile);
275275

0 commit comments

Comments
 (0)