Skip to content

Commit 8fe6448

Browse files
committed
Minor changes.
1 parent f30a87b commit 8fe6448

File tree

1 file changed

+21
-17
lines changed
  • operator/src/main/java/oracle/kubernetes/operator/helpers

1 file changed

+21
-17
lines changed

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

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
import static oracle.kubernetes.operator.DomainStatusUpdater.INSPECTING_DOMAIN_PROGRESS_REASON;
5555
import static oracle.kubernetes.operator.DomainStatusUpdater.createProgressingStartedEventStep;
5656
import static oracle.kubernetes.operator.LabelConstants.INTROSPECTION_DOMAIN_SPEC_GENERATION;
57+
import static oracle.kubernetes.operator.LabelConstants.INTROSPECTION_STATE_LABEL;
5758
import static oracle.kubernetes.operator.logging.MessageKeys.INTROSPECTOR_JOB_FAILED;
5859
import static oracle.kubernetes.operator.logging.MessageKeys.INTROSPECTOR_JOB_FAILED_DETAIL;
5960

@@ -89,35 +90,38 @@ public static Step createDomainIntrospectorJobStep(Step next) {
8990

9091
private static boolean runIntrospector(Packet packet, DomainPresenceInfo info) {
9192
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
9998
|| isBringingUpNewDomain(packet, info)
10099
|| 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);
104102
}
105103

106104
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);
108106
}
109107

110108
private static boolean introspectionRequested(Packet packet) {
111109
return packet.remove(ProcessingConstants.DOMAIN_INTROSPECT_REQUESTED) != null;
112110
}
113111

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+
114117
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("");
121125
}
122126

123127
private static String getGeneration(DomainPresenceInfo info) {

0 commit comments

Comments
 (0)