Skip to content

Commit 254448e

Browse files
committed
Support explicit recheck and resolve flow of control for domain status conflict
1 parent 3ca2e8e commit 254448e

File tree

2 files changed

+23
-16
lines changed

2 files changed

+23
-16
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -303,10 +303,10 @@ public NextAction apply(Packet packet) {
303303
@Override
304304
public NextAction onFailure(Packet packet, ApiException e, int statusCode,
305305
Map<String, List<String>> responseHeaders) {
306-
if (statusCode == CallBuilder.NOT_FOUND || statusCode == CallBuilder.CONFLICT) {
306+
if (statusCode == CallBuilder.NOT_FOUND) {
307307
return doNext(packet); // Just ignore update
308308
}
309-
return super.onFailure(packet, e, statusCode, responseHeaders);
309+
return super.onFailure(next, packet, e, statusCode, responseHeaders);
310310
}
311311

312312
@Override
@@ -426,10 +426,10 @@ public NextAction apply(Packet packet) {
426426
@Override
427427
public NextAction onFailure(Packet packet, ApiException e, int statusCode,
428428
Map<String, List<String>> responseHeaders) {
429-
if (statusCode == CallBuilder.NOT_FOUND || statusCode == CallBuilder.CONFLICT) {
429+
if (statusCode == CallBuilder.NOT_FOUND) {
430430
return doNext(packet); // Just ignore update
431431
}
432-
return super.onFailure(packet, e, statusCode, responseHeaders);
432+
return super.onFailure(next, packet, e, statusCode, responseHeaders);
433433
}
434434

435435
@Override
@@ -547,10 +547,10 @@ public NextAction apply(Packet packet) {
547547
@Override
548548
public NextAction onFailure(Packet packet, ApiException e, int statusCode,
549549
Map<String, List<String>> responseHeaders) {
550-
if (statusCode == CallBuilder.NOT_FOUND || statusCode == CallBuilder.CONFLICT) {
550+
if (statusCode == CallBuilder.NOT_FOUND) {
551551
return doNext(packet); // Just ignore update
552552
}
553-
return super.onFailure(packet, e, statusCode, responseHeaders);
553+
return super.onFailure(next, packet, e, statusCode, responseHeaders);
554554
}
555555

556556
@Override

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

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ public static void doRestartAdmin(String principal, String domainUID) {
364364
if (info != null) {
365365
Domain dom = info.getDomain();
366366
if (dom != null) {
367-
doCheckAndCreateDomainPresence(dom, true, null, null);
367+
doCheckAndCreateDomainPresence(dom, false, true, null, null);
368368
}
369369
}
370370
}
@@ -381,7 +381,7 @@ public static void doRollingRestartServers(String principal, String domainUID, L
381381
if (info != null) {
382382
Domain dom = info.getDomain();
383383
if (dom != null) {
384-
doCheckAndCreateDomainPresence(dom, false, servers, null);
384+
doCheckAndCreateDomainPresence(dom, false, false, servers, null);
385385
}
386386
}
387387
}
@@ -398,18 +398,25 @@ public static void doRollingRestartClusters(String principal, String domainUID,
398398
if (info != null) {
399399
Domain dom = info.getDomain();
400400
if (dom != null) {
401-
doCheckAndCreateDomainPresence(dom, false, null, clusters);
401+
doCheckAndCreateDomainPresence(dom, false, false, null, clusters);
402402
}
403403
}
404404
}
405405

406406
private static void doCheckAndCreateDomainPresence(Domain dom) {
407-
doCheckAndCreateDomainPresence(dom, false, null, null);
407+
doCheckAndCreateDomainPresence(dom, false, false, null, null);
408+
}
409+
410+
private static void doCheckAndCreateDomainPresence(Domain dom, boolean explicitRecheck) {
411+
doCheckAndCreateDomainPresence(dom, explicitRecheck, false, null, null);
408412
}
409413

410414
private static void doCheckAndCreateDomainPresence(
411-
Domain dom, boolean explicitRestartAdmin,
412-
List<String> explicitRestartServers, List<String> explicitRestartClusters) {
415+
Domain dom,
416+
boolean explicitRecheck,
417+
boolean explicitRestartAdmin,
418+
List<String> explicitRestartServers,
419+
List<String> explicitRestartClusters) {
413420
LOGGER.entering();
414421

415422
boolean hasExplicitRestarts = explicitRestartAdmin || explicitRestartServers != null || explicitRestartClusters != null;
@@ -426,7 +433,7 @@ private static void doCheckAndCreateDomainPresence(
426433
// Has the spec actually changed? We will get watch events for status updates
427434
Domain current = info.getDomain();
428435
if (current != null) {
429-
if (!hasExplicitRestarts && spec.equals(current.getSpec())) {
436+
if (!explicitRecheck && !hasExplicitRestarts && spec.equals(current.getSpec())) {
430437
// nothing in the spec has changed
431438
LOGGER.fine(MessageKeys.NOT_STARTING_DOMAINUID_THREAD, domainUID);
432439
return;
@@ -1274,7 +1281,7 @@ private static void dispatchPodWatch(Watch.Response<V1Pod> item) {
12741281
if (sko.getPod() != null) {
12751282
// Pod was deleted, but sko still contains a non-null entry
12761283
LOGGER.info(MessageKeys.POD_DELETED, domainUID, metadata.getNamespace(), serverName);
1277-
doCheckAndCreateDomainPresence(info.getDomain());
1284+
doCheckAndCreateDomainPresence(info.getDomain(), true);
12781285
}
12791286
}
12801287
}
@@ -1307,7 +1314,7 @@ private static void dispatchServiceWatch(Watch.Response<V1Service> item) {
13071314
if ((channelName != null ? sko.getChannels().get(channelName) : sko.getService()) != null) {
13081315
// Service was deleted, but sko still contains a non-null entry
13091316
LOGGER.info(MessageKeys.SERVICE_DELETED, domainUID, metadata.getNamespace(), serverName);
1310-
doCheckAndCreateDomainPresence(info.getDomain());
1317+
doCheckAndCreateDomainPresence(info.getDomain(), true);
13111318
}
13121319
}
13131320
}
@@ -1336,7 +1343,7 @@ private static void dispatchIngressWatch(Watch.Response<V1beta1Ingress> item) {
13361343
if (clusterName != null && info.getIngresses().get(clusterName) != null) {
13371344
// Ingress was deleted, but sko still contains a non-null entry
13381345
LOGGER.info(MessageKeys.INGRESS_DELETED, domainUID, metadata.getNamespace(), clusterName);
1339-
doCheckAndCreateDomainPresence(info.getDomain());
1346+
doCheckAndCreateDomainPresence(info.getDomain(), true);
13401347
}
13411348
}
13421349
}

0 commit comments

Comments
 (0)