|
54 | 54 | import static oracle.kubernetes.operator.DomainStatusUpdater.INSPECTING_DOMAIN_PROGRESS_REASON;
|
55 | 55 | import static oracle.kubernetes.operator.DomainStatusUpdater.createProgressingStartedEventStep;
|
56 | 56 | import static oracle.kubernetes.operator.LabelConstants.INTROSPECTION_DOMAIN_SPEC_GENERATION;
|
| 57 | +import static oracle.kubernetes.operator.LabelConstants.INTROSPECTION_STATE_LABEL; |
57 | 58 | import static oracle.kubernetes.operator.logging.MessageKeys.INTROSPECTOR_JOB_FAILED;
|
58 | 59 | import static oracle.kubernetes.operator.logging.MessageKeys.INTROSPECTOR_JOB_FAILED_DETAIL;
|
59 | 60 |
|
@@ -89,35 +90,38 @@ public static Step createDomainIntrospectorJobStep(Step next) {
|
89 | 90 |
|
90 | 91 | private static boolean runIntrospector(Packet packet, DomainPresenceInfo info) {
|
91 | 92 | WlsDomainConfig topology = (WlsDomainConfig) packet.get(ProcessingConstants.DOMAIN_TOPOLOGY);
|
92 |
| - LOGGER.info("runIntrospector topology: " + topology); |
93 |
| - LOGGER.info("runningServersCount: " + runningServersCount(info)); |
94 |
| - LOGGER.info("creatingServers: " + creatingServers(info)); |
95 |
| - //LOGGER.info("introspectionRequested: " + introspectionRequested(packet)); |
96 |
| - LOGGER.info("isModelInImageUpdate: " + isModelInImageUpdate(packet, info)); |
97 |
| - //LOGGER.info("isGenerationChanged: " + isGenerationChanged(packet, info)); |
98 |
| - boolean retVal = topology == null |
| 93 | + LOGGER.fine("runIntrospector topology: " + topology); |
| 94 | + LOGGER.fine("runningServersCount: " + runningServersCount(info)); |
| 95 | + LOGGER.fine("creatingServers: " + creatingServers(info)); |
| 96 | + LOGGER.fine("isModelInImageUpdate: " + isModelInImageUpdate(packet, info)); |
| 97 | + return topology == null |
99 | 98 | || isBringingUpNewDomain(packet, info)
|
100 | 99 | || introspectionRequested(packet)
|
101 |
| - || isModelInImageUpdate(packet, info); |
102 |
| - LOGGER.fine("DEBUG: runIntrospector retVal is : " + retVal); |
103 |
| - return retVal; |
| 100 | + || isModelInImageUpdate(packet, info) |
| 101 | + || isIntrospectVersionChanged(packet, info); |
104 | 102 | }
|
105 | 103 |
|
106 | 104 | private static boolean isBringingUpNewDomain(Packet packet, DomainPresenceInfo info) {
|
107 |
| - return isGenerationChanged(packet, info) ^ (runningServersCount(info) > 0 && creatingServers(info)); |
| 105 | + return runningServersCount(info) == 0 && creatingServers(info) && isGenerationChanged(packet, info); |
108 | 106 | }
|
109 | 107 |
|
110 | 108 | private static boolean introspectionRequested(Packet packet) {
|
111 | 109 | return packet.remove(ProcessingConstants.DOMAIN_INTROSPECT_REQUESTED) != null;
|
112 | 110 | }
|
113 | 111 |
|
| 112 | + private static boolean isIntrospectVersionChanged(Packet packet, DomainPresenceInfo info) { |
| 113 | + return Optional.ofNullable(packet.get(INTROSPECTION_STATE_LABEL)) |
| 114 | + .map(gen -> !gen.equals(getIntrospectVersion(info))).orElse(false); |
| 115 | + } |
| 116 | + |
114 | 117 | private static boolean isGenerationChanged(Packet packet, DomainPresenceInfo info) {
|
115 |
| - LOGGER.info("DEBUG: Domain Generation is " + getGeneration(info)); |
116 |
| - LOGGER.info("DEBUG: Generation from packet is " + packet.get(INTROSPECTION_DOMAIN_SPEC_GENERATION)); |
117 |
| - boolean ret = Optional.ofNullable(packet.get(INTROSPECTION_DOMAIN_SPEC_GENERATION)) |
118 |
| - .map(gen -> gen.equals(getGeneration(info))).orElse(true); |
119 |
| - LOGGER.info("DEBUG: isGenerationSame is " + ret); |
120 |
| - return !ret; |
| 118 | + return Optional.ofNullable(packet.get(INTROSPECTION_DOMAIN_SPEC_GENERATION)) |
| 119 | + .map(gen -> !gen.equals(getGeneration(info))).orElse(true); |
| 120 | + } |
| 121 | + |
| 122 | + private static String getIntrospectVersion(DomainPresenceInfo info) { |
| 123 | + return Optional.ofNullable(info.getDomain()).map(Domain::getSpec).map(s -> s.getIntrospectVersion()) |
| 124 | + .orElse(""); |
121 | 125 | }
|
122 | 126 |
|
123 | 127 | private static String getGeneration(DomainPresenceInfo info) {
|
|
0 commit comments