|
4 | 4 |
|
5 | 5 | package oracle.kubernetes.operator; |
6 | 6 |
|
7 | | -import io.kubernetes.client.ApiException; |
8 | 7 | import io.kubernetes.client.models.V1ObjectMeta; |
9 | 8 | import io.kubernetes.client.models.V1Pod; |
10 | 9 | import java.util.ArrayList; |
|
14 | 13 | import java.util.Map; |
15 | 14 | import java.util.TreeMap; |
16 | 15 | import java.util.concurrent.ConcurrentMap; |
| 16 | +import oracle.kubernetes.operator.calls.CallResponse; |
17 | 17 | import oracle.kubernetes.operator.helpers.CallBuilder; |
18 | 18 | import oracle.kubernetes.operator.helpers.DomainPresenceInfo; |
19 | 19 | import oracle.kubernetes.operator.helpers.DomainPresenceInfo.ServerStartupInfo; |
20 | | -import oracle.kubernetes.operator.helpers.ResponseStep; |
21 | 20 | import oracle.kubernetes.operator.helpers.ServerKubernetesObjects; |
22 | 21 | import oracle.kubernetes.operator.logging.LoggingFacade; |
23 | 22 | import oracle.kubernetes.operator.logging.LoggingFactory; |
24 | 23 | import oracle.kubernetes.operator.logging.MessageKeys; |
| 24 | +import oracle.kubernetes.operator.steps.DefaultResponseStep; |
25 | 25 | import oracle.kubernetes.operator.wlsconfig.WlsClusterConfig; |
26 | 26 | import oracle.kubernetes.operator.wlsconfig.WlsDomainConfig; |
27 | 27 | import oracle.kubernetes.operator.wlsconfig.WlsServerConfig; |
@@ -295,7 +295,8 @@ public NextAction apply(Packet packet) { |
295 | 295 | madeChange = true; |
296 | 296 | } |
297 | 297 |
|
298 | | - // This will control if we need to re-check states soon or if we can slow down checks |
| 298 | + // This will control if we need to re-check states soon or if we can slow down |
| 299 | + // checks |
299 | 300 | packet.put(ProcessingConstants.STATUS_UNCHANGED, Boolean.valueOf(!madeChange)); |
300 | 301 |
|
301 | 302 | if (madeChange) { |
@@ -643,33 +644,43 @@ private static NextAction doDomainUpdate( |
643 | 644 | meta.getName(), |
644 | 645 | meta.getNamespace(), |
645 | 646 | dom, |
646 | | - new ResponseStep<Domain>(next) { |
| 647 | + new DefaultResponseStep<Domain>(next) { |
647 | 648 | @Override |
648 | | - public NextAction onFailure( |
649 | | - Packet packet, |
650 | | - ApiException e, |
651 | | - int statusCode, |
652 | | - Map<String, List<String>> responseHeaders) { |
653 | | - if (statusCode == CallBuilder.NOT_FOUND) { |
| 649 | + public NextAction onFailure(Packet packet, CallResponse<Domain> callResponse) { |
| 650 | + if (callResponse.getStatusCode() == CallBuilder.NOT_FOUND) { |
654 | 651 | return doNext(packet); // Just ignore update |
655 | 652 | } |
656 | | - return super.onFailure(conflictStep, packet, e, statusCode, responseHeaders); |
| 653 | + return super.onFailure( |
| 654 | + getRereadDomainConflictStep(info, meta, conflictStep), |
| 655 | + packet, |
| 656 | + callResponse); |
657 | 657 | } |
658 | 658 |
|
659 | 659 | @Override |
660 | | - public NextAction onSuccess( |
661 | | - Packet packet, |
662 | | - Domain result, |
663 | | - int statusCode, |
664 | | - Map<String, List<String>> responseHeaders) { |
665 | | - info.setDomain(result); |
| 660 | + public NextAction onSuccess(Packet packet, CallResponse<Domain> callResponse) { |
| 661 | + info.setDomain(callResponse.getResult()); |
666 | 662 | return doNext(packet); |
667 | 663 | } |
668 | 664 | }), |
669 | 665 | packet); |
670 | 666 | return na; |
671 | 667 | } |
672 | 668 |
|
| 669 | + private static Step getRereadDomainConflictStep( |
| 670 | + DomainPresenceInfo info, V1ObjectMeta meta, Step next) { |
| 671 | + return new CallBuilder() |
| 672 | + .readDomainAsync( |
| 673 | + meta.getName(), |
| 674 | + meta.getNamespace(), |
| 675 | + new DefaultResponseStep<Domain>(next) { |
| 676 | + @Override |
| 677 | + public NextAction onSuccess(Packet packet, CallResponse<Domain> callResponse) { |
| 678 | + info.setDomain(callResponse.getResult()); |
| 679 | + return doNext(packet); |
| 680 | + } |
| 681 | + }); |
| 682 | + } |
| 683 | + |
673 | 684 | /** |
674 | 685 | * Asynchronous step to set Domain condition to Failed |
675 | 686 | * |
|
0 commit comments