Skip to content

Commit 13278d2

Browse files
committed
Merge remote-tracking branch 'origin/develop' into owls-70100
Pull custom sit config and latest changes
2 parents 15859cc + 2ed4e27 commit 13278d2

File tree

21 files changed

+490
-141
lines changed

21 files changed

+490
-141
lines changed

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

Lines changed: 34 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,20 @@ public class ITOperator extends BaseTest {
5454
private static Operator operatorForDel1;
5555
private static Operator operatorForDel2;
5656

57+
private static boolean QUICKTEST;
58+
private static boolean SMOKETEST;
59+
60+
// Set QUICKTEST env var to true to run a small subset of tests.
61+
// Set SMOKETEST env var to true to run an even smaller subset
62+
// of tests, plus leave domain1 up and running when the test completes.
63+
static {
64+
QUICKTEST =
65+
System.getenv("QUICKTEST") != null && System.getenv("QUICKTEST").equalsIgnoreCase("true");
66+
SMOKETEST =
67+
System.getenv("SMOKETEST") != null && System.getenv("SMOKETEST").equalsIgnoreCase("true");
68+
if (SMOKETEST) QUICKTEST = true;
69+
}
70+
5771
/**
5872
* This method gets called only once before any of the test methods are executed. It does the
5973
* initialization of the integration test properties defined in OperatorIT.properties and setting
@@ -103,16 +117,15 @@ public void test1CreateFirstOperatorAndDomain() throws Exception {
103117
logTestBegin("test1CreateFirstOperatorAndDomain");
104118
testCreateOperatorManagingDefaultAndTest1NS();
105119
Domain domain1 = testAllUseCasesForADomain(operator1, domain1YamlFile);
106-
domain1.testWlsLivenessProbe();
107-
domain1.shutdownUsingServerStartPolicy();
120+
if (!SMOKETEST) domain1.testWlsLivenessProbe();
121+
if (!SMOKETEST) domain1.shutdownUsingServerStartPolicy();
108122

109123
logger.info("SUCCESS - test1CreateFirstOperatorAndDomain");
110124
}
111125

112126
@Test
113127
public void test2CreateAnotherDomainInDefaultNS() throws Exception {
114-
Assume.assumeFalse(
115-
System.getenv("QUICKTEST") != null && System.getenv("QUICKTEST").equalsIgnoreCase("true"));
128+
Assume.assumeFalse(QUICKTEST);
116129

117130
logTestBegin("test2CreateAnotherDomainInDefaultNS");
118131
logger.info("Creating Domain domain2 & verifing the domain creation");
@@ -129,8 +142,7 @@ public void test2CreateAnotherDomainInDefaultNS() throws Exception {
129142

130143
@Test
131144
public void test3CreateDomainInTest1NS() throws Exception {
132-
Assume.assumeFalse(
133-
System.getenv("QUICKTEST") != null && System.getenv("QUICKTEST").equalsIgnoreCase("true"));
145+
Assume.assumeFalse(QUICKTEST);
134146

135147
logTestBegin("test3CreateDomainInTest1NS");
136148
logger.info("Creating Domain domain3 & verifing the domain creation");
@@ -146,8 +158,7 @@ public void test3CreateDomainInTest1NS() throws Exception {
146158

147159
@Test
148160
public void test4CreateAnotherOperatorManagingTest2NS() throws Exception {
149-
Assume.assumeFalse(
150-
System.getenv("QUICKTEST") != null && System.getenv("QUICKTEST").equalsIgnoreCase("true"));
161+
Assume.assumeFalse(QUICKTEST);
151162

152163
logTestBegin("test4CreateAnotherOperatorManagingTest2NS");
153164
logger.info("Creating Operator & waiting for the script to complete execution");
@@ -158,8 +169,7 @@ public void test4CreateAnotherOperatorManagingTest2NS() throws Exception {
158169

159170
@Test
160171
public void test5CreateConfiguredDomainInTest2NS() throws Exception {
161-
Assume.assumeFalse(
162-
System.getenv("QUICKTEST") != null && System.getenv("QUICKTEST").equalsIgnoreCase("true"));
172+
Assume.assumeFalse(QUICKTEST);
163173

164174
logTestBegin("test5CreateConfiguredDomainInTest2NS");
165175
logger.info("Creating Domain domain4 & verifing the domain creation");
@@ -198,8 +208,7 @@ public void test5CreateConfiguredDomainInTest2NS() throws Exception {
198208

199209
@Test
200210
public void test6CreateDomainWithStartPolicyAdminOnly() throws Exception {
201-
Assume.assumeFalse(
202-
System.getenv("QUICKTEST") != null && System.getenv("QUICKTEST").equalsIgnoreCase("true"));
211+
Assume.assumeFalse(QUICKTEST);
203212

204213
logTestBegin("test6CreateDomainWithStartPolicyAdminOnly");
205214
logger.info("Checking if operator1 is running, if not creating");
@@ -215,8 +224,7 @@ public void test6CreateDomainWithStartPolicyAdminOnly() throws Exception {
215224

216225
@Test
217226
public void test7CreateDomainPVReclaimPolicyRecycle() throws Exception {
218-
Assume.assumeFalse(
219-
System.getenv("QUICKTEST") != null && System.getenv("QUICKTEST").equalsIgnoreCase("true"));
227+
Assume.assumeFalse(QUICKTEST);
220228

221229
logTestBegin("test7CreateDomainPVReclaimPolicyRecycle");
222230
logger.info("Checking if operator1 is running, if not creating");
@@ -233,8 +241,7 @@ public void test7CreateDomainPVReclaimPolicyRecycle() throws Exception {
233241

234242
@Test
235243
public void test8CreateDomainOnExistingDir() throws Exception {
236-
Assume.assumeFalse(
237-
System.getenv("QUICKTEST") != null && System.getenv("QUICKTEST").equalsIgnoreCase("true"));
244+
Assume.assumeFalse(QUICKTEST);
238245

239246
logTestBegin("test8CreateDomainOnExistingDir");
240247
if (operator1 == null) {
@@ -251,8 +258,8 @@ public void test8CreateDomainOnExistingDir() throws Exception {
251258

252259
// @Test
253260
public void testACreateDomainApacheLB() throws Exception {
254-
Assume.assumeFalse(
255-
System.getenv("QUICKTEST") != null && System.getenv("QUICKTEST").equalsIgnoreCase("true"));
261+
Assume.assumeFalse(QUICKTEST);
262+
256263
logTestBegin("testACreateDomainApacheLB");
257264
logger.info("Creating Domain domain9 & verifing the domain creation");
258265
if (operator1 == null) {
@@ -268,8 +275,8 @@ public void testACreateDomainApacheLB() throws Exception {
268275

269276
@Test
270277
public void testBCreateDomainWithDefaultValuesInSampleInputs() throws Exception {
271-
Assume.assumeFalse(
272-
System.getenv("QUICKTEST") != null && System.getenv("QUICKTEST").equalsIgnoreCase("true"));
278+
Assume.assumeFalse(QUICKTEST);
279+
273280
logTestBegin("testBCreateDomainWithDefaultValuesInSampleInputs");
274281
logger.info("Creating Domain domain10 & verifing the domain creation");
275282
if (operator1 == null) {
@@ -284,8 +291,7 @@ public void testBCreateDomainWithDefaultValuesInSampleInputs() throws Exception
284291

285292
@Test
286293
public void testDeleteOneDomain() throws Exception {
287-
Assume.assumeFalse(
288-
System.getenv("QUICKTEST") != null && System.getenv("QUICKTEST").equalsIgnoreCase("true"));
294+
Assume.assumeFalse(QUICKTEST);
289295
logTestBegin("Deleting one domain.");
290296

291297
if (operatorForDel1 == null) {
@@ -303,8 +309,7 @@ public void testDeleteOneDomain() throws Exception {
303309

304310
@Test
305311
public void testDeleteTwoDomains() throws Exception {
306-
Assume.assumeFalse(
307-
System.getenv("QUICKTEST") != null && System.getenv("QUICKTEST").equalsIgnoreCase("true"));
312+
Assume.assumeFalse(QUICKTEST);
308313
logTestBegin("Deleting two domains.");
309314

310315
if (operatorForDel2 == null) {
@@ -337,9 +342,11 @@ private Domain testAllUseCasesForADomain(Operator operator, String domainYamlFil
337342
logger.info("Creating Domain & verifing the domain creation");
338343
// create domain1
339344
Domain domain = testDomainCreation(domainYamlFile);
340-
testClusterScaling(operator, domain);
341-
testDomainLifecyle(operator, domain);
342-
testOperatorLifecycle(operator, domain);
345+
if (!SMOKETEST) {
346+
testClusterScaling(operator, domain);
347+
testDomainLifecyle(operator, domain);
348+
testOperatorLifecycle(operator, domain);
349+
}
343350
return domain;
344351
}
345352

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,7 @@ public static void createRBACPoliciesForWLDFScaling() throws Exception {
728728
public static void deleteWeblogicDomainResources(String domainUid) throws Exception {
729729
StringBuilder cmd =
730730
new StringBuilder(BaseTest.getProjectRoot())
731-
.append("/kubernetes/delete-weblogic-domain-resources.sh ")
731+
.append("/kubernetes/samples/scripts/delete-weblogic-domain-resources.sh ")
732732
.append("-d ")
733733
.append(domainUid);
734734
logger.info("Running " + cmd);

kubernetes/delete-weblogic-domain-resources.sh renamed to kubernetes/samples/scripts/delete-weblogic-domain-resources.sh

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ cat << EOF
2929
or all resources were deleted (default $default_maxwaitsecs seconds).
3030
3131
The domains can be specified as a comma-separated list of
32-
domain-uids (no spaces), or the keyword 'all'. The domains can be
33-
located in any kubernetes namespace.
32+
domain-uids (no spaces). The domains can be located in any
33+
kubernetes namespace.
3434
3535
Specify '-t' to run the script in a test mode which will
3636
show kubernetes commands but not actually perform them.
@@ -73,18 +73,14 @@ EOF
7373
#
7474
function getDomainResources {
7575
local domain_regex=''
76-
if [ "$1" = "all" ]; then
77-
LABEL_SELECTOR="weblogic.domainUID"
78-
else
79-
LABEL_SELECTOR="weblogic.domainUID in ($1)"
80-
IFS=',' read -ra UIDS <<< "$1"
81-
for i in "${!UIDS[@]}"; do
82-
if [ $i -gt 0 ]; then
83-
domain_regex="$domain_regex|"
84-
fi
85-
domain_regex="$domain_regex^Domain ${UIDS[$i]} "
86-
done
87-
fi
76+
LABEL_SELECTOR="weblogic.domainUID in ($1)"
77+
IFS=',' read -ra UIDS <<< "$1"
78+
for i in "${!UIDS[@]}"; do
79+
if [ $i -gt 0 ]; then
80+
domain_regex="$domain_regex|"
81+
fi
82+
domain_regex="$domain_regex^Domain ${UIDS[$i]} "
83+
done
8884

8985
# clean the output file
9086
if [ -e $2 ]; then
@@ -122,7 +118,6 @@ function getDomainResources {
122118
#
123119
# Usage:
124120
# deleteDomains domainA,domainB,... maxwaitsecs
125-
# deleteDomains all maxwaitsecs
126121
#
127122
# Internal helper function
128123
# This function first sets the serverStartPolicy of each Domain to NEVER
@@ -131,9 +126,7 @@ function getDomainResources {
131126
# any remaining k8s resources for domain $1 (including any remaining pods)
132127
# and retries these direct deletes up to $2 seconds.
133128
#
134-
# If $1 has special value "all", it deletes all domains in all namespaces.
135-
#
136-
# If global $test_mode is true, it shows candidate actions but doesn't
129+
# If global $test_mode is true, it shows candidate actions but doesn't
137130
# actually perform them
138131
#
139132
function deleteDomains {

operator/src/main/java/oracle/kubernetes/operator/DomainProcessorImpl.java

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
import oracle.kubernetes.operator.work.Fiber;
5050
import oracle.kubernetes.operator.work.Fiber.CompletionCallback;
5151
import oracle.kubernetes.operator.work.FiberGate;
52+
import oracle.kubernetes.operator.work.FiberGateFactory;
5253
import oracle.kubernetes.operator.work.NextAction;
5354
import oracle.kubernetes.operator.work.Packet;
5455
import oracle.kubernetes.operator.work.Step;
@@ -62,7 +63,15 @@ public class DomainProcessorImpl implements DomainProcessor {
6263

6364
private static final LoggingFacade LOGGER = LoggingFactory.getLogger("Operator", "Operator");
6465

65-
private static final FiberGate FIBER_GATE = new FiberGate(Main.engine);
66+
private static final FiberGateFactory FACTORY =
67+
() -> {
68+
return new FiberGate(Main.engine);
69+
};
70+
private static final ConcurrentMap<String, FiberGate> fiberGates = new ConcurrentHashMap<>();
71+
72+
private static FiberGate getFiberGate(String ns) {
73+
return fiberGates.computeIfAbsent(ns, k -> FACTORY.get());
74+
}
6675

6776
// Map from namespace to map of domainUID to Domain
6877
private static final ConcurrentMap<String, ConcurrentMap<String, DomainPresenceInfo>> domains =
@@ -754,6 +763,7 @@ void runDomainPlan(
754763
Step.StepAndPacket plan,
755764
boolean isDeleting,
756765
boolean isWillInterrupt) {
766+
FiberGate gate = getFiberGate(ns);
757767
CompletionCallback cc =
758768
new CompletionCallback() {
759769
@Override
@@ -765,7 +775,7 @@ public void onCompletion(Packet packet) {
765775
public void onThrowable(Packet packet, Throwable throwable) {
766776
LOGGER.severe(MessageKeys.EXCEPTION, throwable);
767777

768-
FIBER_GATE.startFiberIfLastFiberMatches(
778+
gate.startFiberIfLastFiberMatches(
769779
domainUID,
770780
Fiber.getCurrentIfSet(),
771781
DomainStatusUpdater.createFailedStep(throwable, null),
@@ -782,8 +792,7 @@ public void onThrowable(Packet packet, Throwable throwable) {
782792
}
783793
});
784794

785-
FIBER_GATE
786-
.getExecutor()
795+
gate.getExecutor()
787796
.schedule(
788797
() -> {
789798
DomainPresenceInfo existing = getExisting(ns, domainUID);
@@ -798,9 +807,9 @@ public void onThrowable(Packet packet, Throwable throwable) {
798807
};
799808

800809
if (isWillInterrupt) {
801-
FIBER_GATE.startFiber(domainUID, plan.step, plan.packet, cc);
810+
gate.startFiber(domainUID, plan.step, plan.packet, cc);
802811
} else {
803-
FIBER_GATE.startFiberIfNoCurrentFiber(domainUID, plan.step, plan.packet, cc);
812+
gate.startFiberIfNoCurrentFiber(domainUID, plan.step, plan.packet, cc);
804813
}
805814
}
806815

operator/src/main/java/oracle/kubernetes/operator/Main.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,11 @@ public StartNamespacesStep(Collection<String> targetNamespaces) {
240240
this.targetNamespaces = targetNamespaces;
241241
}
242242

243+
@Override
244+
protected String getDetail() {
245+
return String.join(",", targetNamespaces);
246+
}
247+
243248
@Override
244249
public NextAction apply(Packet packet) {
245250
// check for any existing resources and add the watches on them

operator/src/main/java/oracle/kubernetes/operator/calls/AsyncRequestStep.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ public AsyncRequestStep(
7070
next.setPrevious(this);
7171
}
7272

73+
@Override
74+
protected String getDetail() {
75+
return requestParams.call;
76+
}
77+
7378
@Override
7479
public NextAction apply(Packet packet) {
7580
// clear out earlier results

operator/src/main/java/oracle/kubernetes/operator/helpers/JobHelper.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ List<V1EnvVar> getEnvironmentVariables(TuningParameters tuningParameters) {
7575
addEnvVar(envVarList, "LOG_HOME", getEffectiveLogHome());
7676
addEnvVar(envVarList, "INTROSPECT_HOME", getIntrospectHome());
7777
addEnvVar(envVarList, "SERVER_OUT_IN_POD_LOG", getIncludeServerOutInPodLog());
78+
addEnvVar(envVarList, "ADMIN_SECRET_NAME", getAdminSecretName());
7879

7980
return envVarList;
8081
}

operator/src/main/java/oracle/kubernetes/operator/helpers/JobStepContext.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ private String getDomainResourceName() {
6363

6464
abstract String getJobName();
6565

66-
private String getAdminSecretName() {
66+
String getAdminSecretName() {
6767
return getDomain().getAdminSecret().getName();
6868
}
6969

operator/src/main/java/oracle/kubernetes/operator/helpers/RollingHelper.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ private RollingStep(Map<String, StepAndPacket> rolling, Step next) {
6363
this.rolling = rolling;
6464
}
6565

66+
@Override
67+
protected String getDetail() {
68+
return String.join(",", rolling.keySet());
69+
}
70+
6671
@Override
6772
public NextAction apply(Packet packet) {
6873
DomainPresenceInfo info = packet.getSPI(DomainPresenceInfo.class);

operator/src/main/java/oracle/kubernetes/operator/steps/ManagedServerUpIteratorStep.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import java.util.ArrayList;
88
import java.util.Collection;
9+
import java.util.List;
910
import java.util.Map;
1011
import java.util.concurrent.ConcurrentHashMap;
1112
import oracle.kubernetes.operator.ProcessingConstants;
@@ -31,6 +32,15 @@ public ManagedServerUpIteratorStep(Collection<ServerStartupInfo> c, Step next) {
3132
this.c = c;
3233
}
3334

35+
@Override
36+
protected String getDetail() {
37+
List<String> serversToStart = new ArrayList<>();
38+
for (ServerStartupInfo ssi : c) {
39+
serversToStart.add(ssi.serverConfig.getName());
40+
}
41+
return String.join(",", serversToStart);
42+
}
43+
3444
@Override
3545
public NextAction apply(Packet packet) {
3646
Collection<StepAndPacket> startDetails = new ArrayList<>();

0 commit comments

Comments
 (0)