Skip to content

Commit fcac372

Browse files
committed
Merge branch 'domain-introspector' into domain-introspector-OWLS-69881
2 parents 5579069 + 5502c30 commit fcac372

38 files changed

+1471
-1138
lines changed

integration-tests/src/test/java/oracle/kubernetes/operator/BaseTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ public static void initialize(String appPropsFile) throws Exception {
148148
*/
149149
public void testAdminServerExternalService(Domain domain) throws Exception {
150150
logger.info("Inside testAdminServerExternalService");
151+
TestUtils.renewK8sClusterLease(getProjectRoot(), getLeaseId());
151152
domain.verifyAdminServerExternalService(getUsername(), getPassword());
152153
logger.info("Done - testAdminServerExternalService");
153154
}
@@ -159,6 +160,7 @@ public void testAdminServerExternalService(Domain domain) throws Exception {
159160
*/
160161
public void testAdminT3Channel(Domain domain) throws Exception {
161162
logger.info("Inside testAdminT3Channel");
163+
TestUtils.renewK8sClusterLease(getProjectRoot(), getLeaseId());
162164
Map<String, Object> domainMap = domain.getDomainMap();
163165
// check if the property is set to true
164166
Boolean exposeAdmint3Channel = (Boolean) domainMap.get("exposeAdminT3Channel");
@@ -203,6 +205,7 @@ public void testDomainLifecyle(Operator operator, Domain domain) throws Exceptio
203205
*/
204206
public void testClusterScaling(Operator operator, Domain domain) throws Exception {
205207
logger.info("Inside testClusterScaling");
208+
TestUtils.renewK8sClusterLease(getProjectRoot(), getLeaseId());
206209
Map<String, Object> domainMap = domain.getDomainMap();
207210
String domainUid = domain.getDomainUid();
208211
String domainNS = domainMap.get("namespace").toString();
@@ -263,6 +266,7 @@ public void testClusterScaling(Operator operator, Domain domain) throws Exceptio
263266
*/
264267
public void testWLDFScaling(Operator operator, Domain domain) throws Exception {
265268
logger.info("Inside testWLDFScaling");
269+
TestUtils.renewK8sClusterLease(getProjectRoot(), getLeaseId());
266270

267271
Map<String, Object> domainMap = domain.getDomainMap();
268272
String domainUid = domain.getDomainUid();

integration-tests/src/test/java/oracle/kubernetes/operator/ITOperator.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ public void test3CreateDomainInTest1NS() throws Exception {
127127
}
128128
// create domain3
129129
Domain domain3 = testDomainCreation(domain3YamlFile);
130-
131130
testWLDFScaling(operator1, domain3);
132131
logger.info("SUCCESS - test3CreateDomainInTest1NS");
133132
}
@@ -219,8 +218,6 @@ public void test7CreateDomainPVReclaimPolicyRecycle() throws Exception {
219218

220219
@Test
221220
public void test8WlsLivenessProbe() throws Exception {
222-
Assume.assumeFalse(
223-
System.getenv("QUICKTEST") != null && System.getenv("QUICKTEST").equalsIgnoreCase("true"));
224221

225222
logTestBegin("test8WlsLivenessProbe");
226223
logger.info("Checking if operator1 is running, if not creating");
@@ -299,9 +296,13 @@ private Domain testAllUseCasesForADomain(Operator operator, String domainYamlFil
299296
logger.info("Creating Domain & verifing the domain creation");
300297
// create domain1
301298
Domain domain = testDomainCreation(domainYamlFile);
302-
testDomainLifecyle(operator, domain);
299+
if (System.getenv("QUICKTEST") == null
300+
|| (System.getenv("QUICKTEST") != null
301+
&& !System.getenv("QUICKTEST").equalsIgnoreCase("true"))) {
302+
testDomainLifecyle(operator, domain);
303+
testOperatorLifecycle(operator, domain);
304+
}
303305
testClusterScaling(operator, domain);
304-
testOperatorLifecycle(operator, domain);
305306
return domain;
306307
}
307308

integration-tests/src/test/java/oracle/kubernetes/operator/utils/TestUtils.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,10 @@ public static void testWlsLivenessProbe(String domainUid, String serverName, Str
230230

231231
// kill server process 3 times
232232
for (int i = 0; i < 3; i++) {
233-
kubectlexecNoCheck(podName, namespace, "/shared/killserver.sh");
233+
ExecResult result = kubectlexecNoCheck(podName, namespace, "/shared/killserver.sh");
234+
logger.info("kill server process command exitValue " + result.exitValue());
235+
logger.info(
236+
"kill server process command result " + result.stdout() + " stderr " + result.stderr());
234237
Thread.sleep(2 * 1000);
235238
}
236239
// one more time so that liveness probe restarts
@@ -241,6 +244,7 @@ public static void testWlsLivenessProbe(String domainUid, String serverName, Str
241244
while (true) {
242245
long currentTime = System.currentTimeMillis();
243246
int finalRestartCnt = getPodRestartCount(podName, namespace);
247+
logger.info("initialRestartCnt " + initialRestartCnt + " finalRestartCnt " + finalRestartCnt);
244248
if ((finalRestartCnt - initialRestartCnt) == 1) {
245249
logger.info("WLS liveness probe test is successful.");
246250
break;
@@ -301,6 +305,8 @@ public static ExecResult kubectlexecNoCheck(String podName, String namespace, St
301305
.append(" ")
302306
.append(scriptPath);
303307

308+
ExecResult result = ExecCommand.exec("kubectl get pods -n " + namespace);
309+
logger.info("get pods before killing the server " + result.stdout() + "\n " + result.stderr());
304310
logger.info("Command to call kubectl sh file " + cmdKubectlSh);
305311
return ExecCommand.exec(cmdKubectlSh.toString());
306312
}
@@ -526,11 +532,11 @@ public static void renewK8sClusterLease(String projectRoot, String leaseId) thro
526532
+ " to try renew the lease. "
527533
+ "Some of the potential reasons for this failure are that another run"
528534
+ "may have obtained the lease, the lease may have been externally "
529-
+ "deleted, or the caller of run.sh may have forgotten to obtain the"
530-
+ "lease before calling run.sh (using 'lease.sh -o \"$LEASE_ID\"'). "
535+
+ "deleted, or the caller of the test may have forgotten to obtain the "
536+
+ "lease before calling the test (using 'lease.sh -o \"$LEASE_ID\"'). "
531537
+ "To force delete a lease no matter who owns the lease,"
532538
+ "call 'lease.sh -f' or 'kubernetes delete cm acceptance-test-lease'"
533-
+ "(this should only be done when sure there's no current run.sh "
539+
+ "(this should only be done when sure there's no current java tests "
534540
+ "that owns the lease). To view the current lease holder,"
535541
+ "use 'lease.sh -s'. To disable this lease check, do not set"
536542
+ "the LEASE_ID environment variable.");

model/src/main/java/oracle/kubernetes/weblogic/domain/ClusterConfigurator.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,8 @@ ClusterConfigurator withLivenessProbeSettings(
3939
ClusterConfigurator withAdditionalVolume(String name, String path);
4040

4141
ClusterConfigurator withAdditionalVolumeMount(String name, String path);
42+
43+
ClusterConfigurator withPodLabel(String name, String value);
44+
45+
ClusterConfigurator withPodAnnotation(String name, String value);
4246
}

model/src/main/java/oracle/kubernetes/weblogic/domain/DomainConfigurator.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,10 @@ protected String getAsName() {
232232

233233
public abstract DomainConfigurator withAdditionalVolumeMount(String name, String path);
234234

235+
public abstract DomainConfigurator withPodLabel(String name, String value);
236+
237+
public abstract DomainConfigurator withPodAnnotation(String name, String value);
238+
235239
/**
236240
* Adds a default server configuration to the domain, if not already present.
237241
*

model/src/main/java/oracle/kubernetes/weblogic/domain/ServerConfigurator.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,8 @@ ServerConfigurator withReadinessProbeSettings(
3737
ServerConfigurator withAdditionalVolume(String name, String path);
3838

3939
ServerConfigurator withAdditionalVolumeMount(String name, String path);
40+
41+
ServerConfigurator withPodLabel(String name, String value);
42+
43+
ServerConfigurator withPodAnnotation(String name, String value);
4044
}

model/src/main/java/oracle/kubernetes/weblogic/domain/v2/BaseConfiguration.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,22 @@ void addAdditionalVolumeMount(String name, String path) {
178178
serverPod.addAdditionalVolumeMount(name, path);
179179
}
180180

181+
public Map<String, String> getPodLabels() {
182+
return serverPod.getPodLabels();
183+
}
184+
185+
void addPodLabels(String name, String value) {
186+
serverPod.addPodLabel(name, value);
187+
}
188+
189+
public Map<String, String> getPodAnnotations() {
190+
return serverPod.getPodAnnotations();
191+
}
192+
193+
void addPodAnnotations(String name, String value) {
194+
serverPod.addPodAnnotations(name, value);
195+
}
196+
181197
@Override
182198
public String toString() {
183199
return new ToStringBuilder(this)

model/src/main/java/oracle/kubernetes/weblogic/domain/v2/Domain.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,24 @@ public V1PersistentVolumeClaim getRequiredPersistentVolumeClaim() {
387387
: spec.getStorage().getRequiredPersistentVolumeClaim(getDomainUID(), getNamespace());
388388
}
389389

390+
/**
391+
* Returns the name of the Kubernetes configmap that contains optional configuration overrides.
392+
*
393+
* @return name of the configmap
394+
*/
395+
public String getConfigOverrides() {
396+
return spec.getConfigOverrides();
397+
}
398+
399+
/**
400+
* Returns a list of Kubernetes secret names used in optional configuration overrides.
401+
*
402+
* @return list of Kubernetes secret names
403+
*/
404+
public List<String> getConfigOverrideSecrets() {
405+
return spec.getConfigOverrideSecrets();
406+
}
407+
390408
private String getNamespace() {
391409
return getMetadata().getNamespace();
392410
}

model/src/main/java/oracle/kubernetes/weblogic/domain/v2/DomainSpec.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ public class DomainSpec extends BaseConfiguration {
169169
private DomainStorage storage;
170170

171171
/**
172-
* The name of the Kubernetes configmap used in the WebLogic Configuration overrides.
172+
* The name of the Kubernetes configmap used for optional WebLogic configuration overrides.
173173
*
174174
* @since 2.0
175175
*/
@@ -179,7 +179,7 @@ public class DomainSpec extends BaseConfiguration {
179179
private String configOverrides;
180180

181181
/**
182-
* The list of names of the Kubernetes secrets used in the WebLogic Configuration overrides.
182+
* A list of names of the Kubernetes secrets used in the WebLogic Configuration overrides.
183183
*
184184
* @since 2.0
185185
*/
@@ -576,6 +576,11 @@ public void setConfigOverrides(@Nullable String overridess) {
576576
this.configOverrides = overridess;
577577
}
578578

579+
public DomainSpec withConfigOverrides(@Nullable String overridess) {
580+
this.configOverrides = overridess;
581+
return this;
582+
}
583+
579584
private boolean hasConfigOverrideSecrets() {
580585
return configOverrideSecrets != null && configOverrideSecrets.size() != 0;
581586
}
@@ -590,6 +595,11 @@ public void setConfigOverrideSecrets(@Nullable List<String> overridesSecretNames
590595
this.configOverrideSecrets = overridesSecretNames;
591596
}
592597

598+
public DomainSpec withConfigOverrideSecrets(@Nullable List<String> overridesSecretNames) {
599+
this.configOverrideSecrets = overridesSecretNames;
600+
return this;
601+
}
602+
593603
/**
594604
* Returns the name of the persistent volume claim for the logs and PV-based domain.
595605
*

model/src/main/java/oracle/kubernetes/weblogic/domain/v2/DomainV2Configurator.java

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,18 @@ public DomainConfigurator withConfigOverrideSecrets(String... secretNames) {
103103
return this;
104104
}
105105

106+
@Override
107+
public DomainConfigurator withPodLabel(String name, String value) {
108+
((BaseConfiguration) getDomainSpec()).addPodLabels(name, value);
109+
return this;
110+
}
111+
112+
@Override
113+
public DomainConfigurator withPodAnnotation(String name, String value) {
114+
((BaseConfiguration) getDomainSpec()).addPodAnnotations(name, value);
115+
return this;
116+
}
117+
106118
class AdminServerConfiguratorImpl extends ServerConfiguratorImpl
107119
implements AdminServerConfigurator {
108120
private AdminServer adminServer;
@@ -280,6 +292,18 @@ public ServerConfigurator withAdditionalVolumeMount(String name, String path) {
280292
server.addAdditionalVolumeMount(name, path);
281293
return this;
282294
}
295+
296+
@Override
297+
public ServerConfigurator withPodLabel(String name, String value) {
298+
server.addPodLabels(name, value);
299+
return this;
300+
}
301+
302+
@Override
303+
public ServerConfigurator withPodAnnotation(String name, String value) {
304+
server.addPodAnnotations(name, value);
305+
return this;
306+
}
283307
}
284308

285309
@Override
@@ -400,5 +424,17 @@ public ClusterConfigurator withAdditionalVolumeMount(String name, String path) {
400424
cluster.addAdditionalVolumeMount(name, path);
401425
return this;
402426
}
427+
428+
@Override
429+
public ClusterConfigurator withPodLabel(String name, String value) {
430+
cluster.addPodLabels(name, value);
431+
return this;
432+
}
433+
434+
@Override
435+
public ClusterConfigurator withPodAnnotation(String name, String value) {
436+
cluster.addPodAnnotations(name, value);
437+
return this;
438+
}
403439
}
404440
}

0 commit comments

Comments
 (0)