Skip to content

Commit 61133ba

Browse files
committed
Clone packet and additional logging
1 parent e81f256 commit 61133ba

File tree

6 files changed

+91
-79
lines changed

6 files changed

+91
-79
lines changed

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

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ public NextAction onSuccess(Packet packet, V1ServiceList result, int statusCode,
270270
if (info == null) {
271271
info = created;
272272
}
273-
ServerKubernetesObjects sko = info.getServers().computeIfAbsent(serverName, k -> new ServerKubernetesObjects());
273+
ServerKubernetesObjects sko = info.getServers().putIfAbsent(serverName, new ServerKubernetesObjects());
274274
if (channelName != null) {
275275
sko.getChannels().put(channelName, service);
276276
} else {
@@ -305,7 +305,7 @@ public NextAction onSuccess(Packet packet, V1PodList result, int statusCode,
305305
if (info == null) {
306306
info = created;
307307
}
308-
ServerKubernetesObjects sko = info.getServers().computeIfAbsent(serverName, k -> new ServerKubernetesObjects());
308+
ServerKubernetesObjects sko = info.getServers().putIfAbsent(serverName, new ServerKubernetesObjects());
309309
sko.getPod().set(pod);
310310
}
311311
}
@@ -784,7 +784,18 @@ public NextAction apply(Packet packet) {
784784

785785
Domain dom = info.getDomain();
786786
DomainSpec spec = dom.getSpec();
787-
787+
788+
if (LOGGER.isFineEnabled()) {
789+
Collection<String> runningList = new ArrayList<>();
790+
for (Map.Entry<String, ServerKubernetesObjects> entry : info.getServers().entrySet()) {
791+
ServerKubernetesObjects sko = entry.getValue();
792+
if (sko != null && sko.getPod() != null) {
793+
runningList.add(entry.getKey());
794+
}
795+
}
796+
LOGGER.fine("Running servers for domain with UID: " + spec.getDomainUID() + ", running list: " + runningList);
797+
}
798+
788799
String sc = spec.getStartupControl();
789800
if (sc == null) {
790801
sc = StartupControlConstants.AUTO_STARTUPCONTROL;
@@ -1020,15 +1031,6 @@ public NextAction apply(Packet packet) {
10201031
Domain dom = info.getDomain();
10211032
DomainSpec spec = dom.getSpec();
10221033

1023-
Collection<String> runningList = new ArrayList<>();
1024-
for (Map.Entry<String, ServerKubernetesObjects> entry : info.getServers().entrySet()) {
1025-
ServerKubernetesObjects sko = entry.getValue();
1026-
if (sko != null && sko.getPod() != null) {
1027-
runningList.add(entry.getKey());
1028-
}
1029-
}
1030-
LOGGER.fine("Running servers for domain with UID: " + spec.getDomainUID() + ", running list: " + runningList);
1031-
10321034
Collection<String> serverList = new ArrayList<>();
10331035
for (ServerStartupInfo ssi : c) {
10341036
serverList.add(ssi.serverConfig.getName());
@@ -1087,7 +1089,7 @@ public NextAction apply(Packet packet) {
10871089
Collection<StepAndPacket> startDetails = new ArrayList<>();
10881090

10891091
for (Map.Entry<String, ServerKubernetesObjects> entry : c) {
1090-
startDetails.add(new StepAndPacket(new ServerDownStep(entry.getKey(), entry.getValue(), null), packet));
1092+
startDetails.add(new StepAndPacket(new ServerDownStep(entry.getKey(), entry.getValue(), null), packet.clone()));
10911093
}
10921094

10931095
if (LOGGER.isFineEnabled()) {
@@ -1444,7 +1446,7 @@ private static void dispatchPodWatch(Watch.Response<V1Pod> item) {
14441446
if (domainUID != null) {
14451447
DomainPresenceInfo info = domains.get(domainUID);
14461448
if (info != null && serverName != null) {
1447-
ServerKubernetesObjects sko = info.getServers().computeIfAbsent(serverName, k -> new ServerKubernetesObjects());
1449+
ServerKubernetesObjects sko = info.getServers().putIfAbsent(serverName, new ServerKubernetesObjects());
14481450
if (sko != null) {
14491451
Fiber f;
14501452
Packet packet;
@@ -1505,7 +1507,7 @@ private static void dispatchServiceWatch(Watch.Response<V1Service> item) {
15051507
if (domainUID != null) {
15061508
DomainPresenceInfo info = domains.get(domainUID);
15071509
if (info != null && serverName != null) {
1508-
ServerKubernetesObjects sko = info.getServers().computeIfAbsent(serverName, k -> new ServerKubernetesObjects());
1510+
ServerKubernetesObjects sko = info.getServers().putIfAbsent(serverName, new ServerKubernetesObjects());
15091511
if (sko != null) {
15101512
switch (item.type) {
15111513
case "ADDED":

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

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1256,9 +1256,13 @@ public NextAction doPotentialRetry(Step conflictStep, Packet packet, ApiExceptio
12561256
timeoutSeconds *= 2;
12571257
}
12581258

1259-
LOGGER.info(MessageKeys.ASYNC_RETRY, String.valueOf(waitTime));
12601259
NextAction na = new NextAction();
1261-
na.delay(retryStep, packet, waitTime, TimeUnit.MILLISECONDS);
1260+
if (statusCode == 0 && retryCount <= 2) {
1261+
na.invoke(retryStep, packet);
1262+
} else {
1263+
LOGGER.info(MessageKeys.ASYNC_RETRY, String.valueOf(waitTime));
1264+
na.delay(retryStep, packet, waitTime, TimeUnit.MILLISECONDS);
1265+
}
12621266
return na;
12631267
} else if (statusCode == 409 /* Conflict */ && conflictStep != null) {
12641268
// Conflict is an optimistic locking failure. Therefore, we can't
@@ -1318,6 +1322,8 @@ public NextAction apply(Packet packet) {
13181322
}
13191323
RetryStrategy _retry = retry;
13201324

1325+
LOGGER.fine(MessageKeys.ASYNC_REQUEST, requestParams.call, requestParams.namespace, requestParams.name, requestParams.body, fieldSelector, labelSelector, resourceVersion);
1326+
13211327
AtomicBoolean didResume = new AtomicBoolean(false);
13221328
AtomicBoolean didRecycle = new AtomicBoolean(false);
13231329
ClientUsage usage = useClient();
@@ -1357,7 +1363,8 @@ public void onSuccess(T result, int statusCode, Map<String, List<String>> respon
13571363
// timeout handling
13581364
fiber.owner.getExecutor().schedule(() -> {
13591365
if (didRecycle.compareAndSet(false, true)) {
1360-
usage.recycle();
1366+
// don't recycle on timeout because state is unknown
1367+
// usage.recycle();
13611368
}
13621369
if (didResume.compareAndSet(false, true)) {
13631370
try {
@@ -1372,7 +1379,8 @@ public void onSuccess(T result, int statusCode, Map<String, List<String>> respon
13721379
} catch (Throwable t) {
13731380
LOGGER.warning(MessageKeys.ASYNC_FAILURE, t, 0, null, requestParams, requestParams.namespace, requestParams.name, requestParams.body, fieldSelector, labelSelector, resourceVersion);
13741381
if (didRecycle.compareAndSet(false, true)) {
1375-
usage.recycle();
1382+
// don't recycle on throwable because state is unknown
1383+
// usage.recycle();
13761384
}
13771385
if (didResume.compareAndSet(false, true)) {
13781386
packet.getComponents().put(RESPONSE_COMPONENT_NAME, Component.createFor(RetryStrategy.class, _retry));

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ public NextAction apply(Packet packet) {
203203

204204
// Verify if Kubernetes api server has a matching Pod
205205
// Create or replace, if necessary
206-
ServerKubernetesObjects sko = info.getServers().computeIfAbsent(spec.getAsName(), k -> new ServerKubernetesObjects());
206+
ServerKubernetesObjects sko = info.getServers().putIfAbsent(spec.getAsName(), new ServerKubernetesObjects());
207207

208208
// First, verify existing Pod
209209
Step read = CallBuilder.create().readPodAsync(podName, namespace, new ResponseStep<V1Pod>(next) {
@@ -535,7 +535,7 @@ public NextAction apply(Packet packet) {
535535

536536
// Verify if Kubernetes api server has a matching Pod
537537
// Create or replace, if necessary
538-
ServerKubernetesObjects sko = info.getServers().computeIfAbsent(weblogicServerName, k -> new ServerKubernetesObjects());
538+
ServerKubernetesObjects sko = info.getServers().putIfAbsent(weblogicServerName, new ServerKubernetesObjects());
539539

540540
// First, verify there existing Pod
541541
Step read = CallBuilder.create().readPodAsync(podName, namespace, new ResponseStep<V1Pod>(next) {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public NextAction apply(Packet packet) {
100100

101101
// Verify if Kubernetes api server has a matching Service
102102
// Create or replace, if necessary
103-
ServerKubernetesObjects sko = info.getServers().computeIfAbsent(serverName, k -> new ServerKubernetesObjects());
103+
ServerKubernetesObjects sko = info.getServers().putIfAbsent(serverName, new ServerKubernetesObjects());
104104

105105
// First, verify existing Service
106106
Step read = CallBuilder.create().readServiceAsync(name, namespace, new ResponseStep<V1Service>(next) {
@@ -315,7 +315,7 @@ public NextAction apply(Packet packet) {
315315

316316
// Verify if Kubernetes api server has a matching Service
317317
// Create or replace, if necessary
318-
ServerKubernetesObjects sko = info.getServers().computeIfAbsent(serverName, k -> new ServerKubernetesObjects());
318+
ServerKubernetesObjects sko = info.getServers().putIfAbsent(serverName, new ServerKubernetesObjects());
319319

320320
// First, verify existing Service
321321
Step read = CallBuilder.create().readServiceAsync(name, namespace, new ResponseStep<V1Service>(next) {

src/main/java/oracle/kubernetes/operator/logging/MessageKeys.java

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -101,33 +101,34 @@ private MessageKeys() {
101101
public static final String EXCH_WRONG_PROTOCOL = "WLSKO-0085";
102102
public static final String EXCH_CHANNEL_NOT_DEFINED = "WLSKO-0086";
103103
public static final String EXCH_OUTSIDE_RANGE="WLSKO-0087";
104-
public static final String ASYNC_FAILURE = "WLSKO-0088";
105-
public static final String ASYNC_SUCCESS = "WLSKO-0089";
106-
public static final String ASYNC_NO_RETRY = "WLSKO-0090";
107-
public static final String ASYNC_RETRY = "WLSKO-0091";
108-
public static final String ASYNC_TIMEOUT = "WLSKO-0092";
109-
public static final String DOMAIN_STATUS = "WLSKO-0093";
110-
public static final String INVALID_MANAGE_SERVER_COUNT = "WLSKO-0094";
111-
public static final String SCALE_COUNT_GREATER_THAN_CONFIGURED = "WLSKO-0095";
112-
public static final String SCALING_AUTO_CONTROL_AUTO = "WLSKO-0096";
113-
public static final String MATCHING_DOMAIN_NOT_FOUND = "WLSKO-0097";
114-
public static final String INVALID_DOMAIN_UID = "WLSKO-0098";
115-
public static final String NULL_DOMAIN_UID = "WLSKO-0099";
116-
public static final String NULL_TOKEN_REVIEW_STATUS = "WLSKO-0100";
117-
public static final String NULL_USER_INFO = "WLSKO-0101";
118-
public static final String RESOURCE_BUNDLE_NOT_FOUND = "WLSKO-0102";
119-
public static final String RESTART_ADMIN_COMPLETE = "WLSKO-0103";
120-
public static final String RESTART_SERVERS_COMPLETE = "WLSKO-0104";
121-
public static final String ROLLING_CLUSTERS_COMPLETE = "WLSKO-0105";
122-
public static final String RESTART_ADMIN_STARTING = "WLSKO-0106";
123-
public static final String RESTART_SERVERS_STARTING = "WLSKO-0107";
124-
public static final String ROLLING_CLUSTERS_STARTING = "WLSKO-0108";
125-
public static final String CYCLING_SERVERS = "WLSKO-0109";
126-
public static final String ROLLING_SERVERS = "WLSKO-0110";
127-
public static final String REMOVING_INGRESS = "WLSKO-0111";
128-
public static final String LIST_INGRESS_FOR_DOMAIN = "WLSKO-0112";
129-
public static final String POD_DELETED = "WLSKO-0113";
130-
public static final String SERVICE_DELETED = "WLSKO-0114";
131-
public static final String INGRESS_DELETED = "WLSKO-0115";
104+
public static final String ASYNC_REQUEST = "WLSKO-0088";
105+
public static final String ASYNC_FAILURE = "WLSKO-0089";
106+
public static final String ASYNC_SUCCESS = "WLSKO-0090";
107+
public static final String ASYNC_NO_RETRY = "WLSKO-0091";
108+
public static final String ASYNC_RETRY = "WLSKO-0092";
109+
public static final String ASYNC_TIMEOUT = "WLSKO-0093";
110+
public static final String DOMAIN_STATUS = "WLSKO-0094";
111+
public static final String INVALID_MANAGE_SERVER_COUNT = "WLSKO-0095";
112+
public static final String SCALE_COUNT_GREATER_THAN_CONFIGURED = "WLSKO-0096";
113+
public static final String SCALING_AUTO_CONTROL_AUTO = "WLSKO-0097";
114+
public static final String MATCHING_DOMAIN_NOT_FOUND = "WLSKO-0098";
115+
public static final String INVALID_DOMAIN_UID = "WLSKO-0099";
116+
public static final String NULL_DOMAIN_UID = "WLSKO-0100";
117+
public static final String NULL_TOKEN_REVIEW_STATUS = "WLSKO-0101";
118+
public static final String NULL_USER_INFO = "WLSKO-0102";
119+
public static final String RESOURCE_BUNDLE_NOT_FOUND = "WLSKO-0103";
120+
public static final String RESTART_ADMIN_COMPLETE = "WLSKO-0104";
121+
public static final String RESTART_SERVERS_COMPLETE = "WLSKO-0105";
122+
public static final String ROLLING_CLUSTERS_COMPLETE = "WLSKO-0106";
123+
public static final String RESTART_ADMIN_STARTING = "WLSKO-0107";
124+
public static final String RESTART_SERVERS_STARTING = "WLSKO-0108";
125+
public static final String ROLLING_CLUSTERS_STARTING = "WLSKO-0109";
126+
public static final String CYCLING_SERVERS = "WLSKO-0110";
127+
public static final String ROLLING_SERVERS = "WLSKO-0111";
128+
public static final String REMOVING_INGRESS = "WLSKO-0112";
129+
public static final String LIST_INGRESS_FOR_DOMAIN = "WLSKO-0113";
130+
public static final String POD_DELETED = "WLSKO-0114";
131+
public static final String SERVICE_DELETED = "WLSKO-0115";
132+
public static final String INGRESS_DELETED = "WLSKO-0116";
132133

133134
}

src/main/resources/Operator.properties

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -86,33 +86,34 @@ WLSKO-0084=Listen and Public ports are not the same for external channel: {0}
8686
WLSKO-0085=External Channel {0} is using {1} protocol. For non-T3 channels use Ingress instead
8787
WLSKO-0086=External Channel {0} is not defined in server {1}
8888
WLSKO-0087=External Channel {0} port {1} is outside the NodePort range starting at {2} through {3}
89-
WLSKO-0088=Async call failed: {0}, code: {1}, headers {2} after invoking {3}, namespace: {4}, name: {5}, body: {6}, fieldSelector: {7}, labelSelector: {8}, resourceVersion: {9}
90-
WLSKO-0089=Async call succeeded with result: {0}, code: {1}, headers {2}
91-
WLSKO-0090=Async call will not be retried after message: {0}, code: {1}, headers {2}
92-
WLSKO-0091=Async call will be retried after delay: {0} ms
93-
WLSKO-0092=Async call timed-out while invoking {0}, namespace: {1}, name: {2}, body: {3}, fieldSelector: {4}, labelSelector: {5}, resourceVersion: {6}
94-
WLSKO-0093=Status for Domain with UID {0} is now, available server: {1}, available clusters: {2}, unavailable servers: {3}, unavailable clusters: {4}, conditions: {5}
95-
WLSKO-0094=Specified managed server count parameter of {0} is invalid. Please specify a positive managed server count for scaling
96-
WLSKO-0095=Requested scaling count of {0} is greater than configured cluster size of {1} for WebLogic cluster {2}. Please increase the number of configured managed servers for WebLogic cluster {3}
97-
WLSKO-0096=Scaling of WLS Cluster {0} is only supported with Startup Control=AUTO
98-
WLSKO-0097=Domain matching {0} not found
99-
WLSKO-0098=Invalid domain UID: {0}
100-
WLSKO-0099=Null domainUID
101-
WLSKO-0100=Null V1TokenReviewStatus
102-
WLSKO-0101=Null userInfo {0}
103-
WLSKO-0102=Could not find the resource bundle
104-
WLSKO-0103=Restart of administration server for Domain with UID {0} has completed
105-
WLSKO-0104=Restart of servers for Domain with UID {0} in the list {1} has completed
106-
WLSKO-0105=Rolling restart of servers for Domain with UID {0} in the list of clusters {1} has completed
107-
WLSKO-0106=Restart of administration server for Domain with UID {0} is starting
108-
WLSKO-0107=Restart of servers for Domain with UID {0} in the list {1} is starting
109-
WLSKO-0108=Rolling restart of servers for Domain with UID {0} in the list of clusters {1} is starting
110-
WLSKO-0109=Cycling of servers for Domain with UID {0} in the list {1} now
111-
WLSKO-0110=Rolling of servers for Domain with UID {0} in the list {1} now with ready servers {2}
112-
WLSKO-0111=Removing Ingress {0} in namespace {1}
113-
WLSKO-0112=List Ingress for domain with domainUID {0} in namespace {1}
114-
WLSKO-0113=Pod for domain with domainUID {0} in namespace {1} and with server name {2} deleted; validating domain
115-
WLSKO-0114=Service for domain with domainUID {0} in namespace {1} and with server name {2} deleted; validating domain
116-
WLSKO-0115=Ingress for domain with domainUID {0} in namespace {1} and with cluster name {2} deleted; validating domain
89+
WLSKO-0088=Async call: invoking {0}, namespace: {1}, name: {2}, body: {3}, fieldSelector: {4}, labelSelector: {5}, resourceVersion: {6}
90+
WLSKO-0089=Async call failed: {0}, code: {1}, headers {2} after invoking {3}, namespace: {4}, name: {5}, body: {6}, fieldSelector: {7}, labelSelector: {8}, resourceVersion: {9}
91+
WLSKO-0090=Async call succeeded with result: {0}, code: {1}, headers {2}
92+
WLSKO-0091=Async call will not be retried after message: {0}, code: {1}, headers {2}
93+
WLSKO-0092=Async call will be retried after delay: {0} ms
94+
WLSKO-0093=Async call timed-out while invoking {0}, namespace: {1}, name: {2}, body: {3}, fieldSelector: {4}, labelSelector: {5}, resourceVersion: {6}
95+
WLSKO-0094=Status for Domain with UID {0} is now, available server: {1}, available clusters: {2}, unavailable servers: {3}, unavailable clusters: {4}, conditions: {5}
96+
WLSKO-0095=Specified managed server count parameter of {0} is invalid. Please specify a positive managed server count for scaling
97+
WLSKO-0096=Requested scaling count of {0} is greater than configured cluster size of {1} for WebLogic cluster {2}. Please increase the number of configured managed servers for WebLogic cluster {3}
98+
WLSKO-0097=Scaling of WLS Cluster {0} is only supported with Startup Control=AUTO
99+
WLSKO-0098=Domain matching {0} not found
100+
WLSKO-0099=Invalid domain UID: {0}
101+
WLSKO-0100=Null domainUID
102+
WLSKO-0101=Null V1TokenReviewStatus
103+
WLSKO-0102=Null userInfo {0}
104+
WLSKO-0103=Could not find the resource bundle
105+
WLSKO-0104=Restart of administration server for Domain with UID {0} has completed
106+
WLSKO-0105=Restart of servers for Domain with UID {0} in the list {1} has completed
107+
WLSKO-0106=Rolling restart of servers for Domain with UID {0} in the list of clusters {1} has completed
108+
WLSKO-0107=Restart of administration server for Domain with UID {0} is starting
109+
WLSKO-0108=Restart of servers for Domain with UID {0} in the list {1} is starting
110+
WLSKO-0109=Rolling restart of servers for Domain with UID {0} in the list of clusters {1} is starting
111+
WLSKO-0110=Cycling of servers for Domain with UID {0} in the list {1} now
112+
WLSKO-0111=Rolling of servers for Domain with UID {0} in the list {1} now with ready servers {2}
113+
WLSKO-0112=Removing Ingress {0} in namespace {1}
114+
WLSKO-0113=List Ingress for domain with domainUID {0} in namespace {1}
115+
WLSKO-0114=Pod for domain with domainUID {0} in namespace {1} and with server name {2} deleted; validating domain
116+
WLSKO-0115=Service for domain with domainUID {0} in namespace {1} and with server name {2} deleted; validating domain
117+
WLSKO-0116=Ingress for domain with domainUID {0} in namespace {1} and with cluster name {2} deleted; validating domain
117118

118119

0 commit comments

Comments
 (0)