Skip to content

Commit 825b449

Browse files
committed
Consistently reread on conflict and add support for updating operator target namespaces while running
1 parent 353cb4e commit 825b449

File tree

11 files changed

+727
-607
lines changed

11 files changed

+727
-607
lines changed

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

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,8 @@ public NextAction apply(Packet packet) {
297297
madeChange = true;
298298
}
299299

300-
// This will control if we need to re-check states soon or if we can slow down checks
300+
// This will control if we need to re-check states soon or if we can slow down
301+
// checks
301302
packet.put(ProcessingConstants.STATUS_UNCHANGED, Boolean.valueOf(!madeChange));
302303

303304
if (madeChange) {
@@ -658,7 +659,12 @@ public NextAction onFailure(
658659
if (statusCode == CallBuilder.NOT_FOUND) {
659660
return doNext(packet); // Just ignore update
660661
}
661-
return super.onFailure(conflictStep, packet, e, statusCode, responseHeaders);
662+
return super.onFailure(
663+
getRereadDomainConflictStep(factory, info, meta, conflictStep),
664+
packet,
665+
e,
666+
statusCode,
667+
responseHeaders);
662668
}
663669

664670
@Override
@@ -675,6 +681,38 @@ public NextAction onSuccess(
675681
return na;
676682
}
677683

684+
private static Step getRereadDomainConflictStep(
685+
CallBuilderFactory factory, DomainPresenceInfo info, V1ObjectMeta meta, Step next) {
686+
return factory
687+
.create()
688+
.readDomainAsync(
689+
meta.getName(),
690+
meta.getNamespace(),
691+
new ResponseStep<Domain>(next) {
692+
@Override
693+
public NextAction onFailure(
694+
Packet packet,
695+
ApiException e,
696+
int statusCode,
697+
Map<String, List<String>> responseHeaders) {
698+
if (statusCode == CallBuilder.NOT_FOUND) {
699+
return doNext(packet);
700+
}
701+
return super.onFailure(packet, e, statusCode, responseHeaders);
702+
}
703+
704+
@Override
705+
public NextAction onSuccess(
706+
Packet packet,
707+
Domain result,
708+
int statusCode,
709+
Map<String, List<String>> responseHeaders) {
710+
info.setDomain(result);
711+
return doNext(packet);
712+
}
713+
});
714+
}
715+
678716
/**
679717
* Asynchronous step to set Domain condition to Failed
680718
*

0 commit comments

Comments
 (0)