Skip to content

Commit 36d9272

Browse files
committed
Merge branch 'introspection-followup' into 'main'
Fix additional problems with introspection and creation of config map See merge request weblogic-cloud/weblogic-kubernetes-operator!4733
2 parents 85ee3c6 + f963a99 commit 36d9272

File tree

4 files changed

+4
-41
lines changed

4 files changed

+4
-41
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ public interface LabelConstants {
2424
String INTROSPECTION_STATE_LABEL = "weblogic.introspectVersion";
2525
String MII_UPDATED_RESTART_REQUIRED_LABEL = "weblogic.configChangesPendingRestart";
2626
String INTROSPECTION_DOMAIN_SPEC_GENERATION = "weblogic.domainSpecGeneration";
27-
String INTROSPECTION_CLUSTER_SPEC_GENERATION = "weblogic.clusterSpecGeneration";
2827
String INTROSPECTION_TIME = "weblogic.introspectionTime";
2928
String TO_BE_ROLLED_LABEL = "weblogic.awaitingPodRoll";
3029
String TO_BE_SHUTDOWN_LABEL = "weblogic.awaitingShutdown";

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

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@
5959
import static oracle.kubernetes.operator.IntrospectorConfigMapConstants.SECRETS_MD_5;
6060
import static oracle.kubernetes.operator.IntrospectorConfigMapConstants.SIT_CONFIG_FILE_PREFIX;
6161
import static oracle.kubernetes.operator.KubernetesConstants.SCRIPT_CONFIG_MAP_NAME;
62-
import static oracle.kubernetes.operator.LabelConstants.INTROSPECTION_CLUSTER_SPEC_GENERATION;
6362
import static oracle.kubernetes.operator.LabelConstants.INTROSPECTION_DOMAIN_SPEC_GENERATION;
6463
import static oracle.kubernetes.operator.LabelConstants.INTROSPECTION_STATE_LABEL;
6564
import static oracle.kubernetes.operator.LabelConstants.INTROSPECTION_TIME;
@@ -332,11 +331,6 @@ public Result onSuccess(Packet packet, KubernetesApiResponse<V1ConfigMap> callRe
332331
.ifPresent(value -> addLabel(INTROSPECTION_STATE_LABEL, value));
333332
Optional.ofNullable(domain).map(DomainResource::getMetadata).map(V1ObjectMeta::getGeneration)
334333
.ifPresent(value -> addLabel(INTROSPECTION_DOMAIN_SPEC_GENERATION, value.toString()));
335-
DomainPresenceInfo.fromPacket(packet).map(DomainPresenceInfo::getReferencedClusters)
336-
.ifPresent(list -> list.forEach(cluster -> Optional.ofNullable(cluster.getMetadata())
337-
.map(V1ObjectMeta::getGeneration)
338-
.ifPresent(value -> addLabel(INTROSPECTION_CLUSTER_SPEC_GENERATION + "."
339-
+ cluster.getMetadata().getName(), value.toString()))));
340334
Optional.ofNullable((String) packet.get(INTROSPECTION_TIME))
341335
.ifPresent(value -> addLabel(INTROSPECTION_TIME, value));
342336
V1ConfigMap existingMap = withoutTransientData(callResponse.getObject());
@@ -927,9 +921,6 @@ private void recordIntrospectVersionAndGeneration(V1ConfigMap result, Packet pac
927921
() -> packet.remove(INTROSPECTION_STATE_LABEL));
928922
Optional.ofNullable(labels).map(l -> l.get(INTROSPECTION_DOMAIN_SPEC_GENERATION))
929923
.ifPresent(generation -> packet.put(INTROSPECTION_DOMAIN_SPEC_GENERATION, generation));
930-
Optional.ofNullable(labels).ifPresent(x -> x.entrySet().stream()
931-
.filter(entry -> entry.getKey().startsWith(INTROSPECTION_CLUSTER_SPEC_GENERATION))
932-
.forEach(entry -> packet.put(entry.getKey(), entry.getValue())));
933924
Optional.ofNullable(labels).map(l -> l.get(INTROSPECTION_TIME))
934925
.ifPresent(value -> packet.put(INTROSPECTION_TIME, value));
935926
}

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

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@
6464
import static oracle.kubernetes.operator.DomainStatusUpdater.createIntrospectionFailureSteps;
6565
import static oracle.kubernetes.operator.DomainStatusUpdater.createRemoveFailuresStep;
6666
import static oracle.kubernetes.operator.DomainStatusUpdater.createRemoveSelectedFailuresStep;
67-
import static oracle.kubernetes.operator.LabelConstants.INTROSPECTION_CLUSTER_SPEC_GENERATION;
6867
import static oracle.kubernetes.operator.LabelConstants.INTROSPECTION_DOMAIN_SPEC_GENERATION;
6968
import static oracle.kubernetes.operator.LabelConstants.INTROSPECTION_STATE_LABEL;
7069
import static oracle.kubernetes.operator.LabelConstants.INTROSPECTION_TIME;
@@ -361,8 +360,7 @@ private Collection<String> getRunningServerNames() {
361360
}
362361

363362
private boolean isBringingUpNewDomain(Packet packet) {
364-
return getNumRunningServers() == 0 && creatingServers(info)
365-
&& (isDomainGenerationChanged(packet) || isAnyClusterGenerationChanged(packet));
363+
return getNumRunningServers() == 0 && creatingServers(info) && (isDomainGenerationChanged(packet));
366364
}
367365

368366
private int getNumRunningServers() {
@@ -382,31 +380,6 @@ private String getDomainGeneration() {
382380
.orElse("");
383381
}
384382

385-
private boolean isAnyClusterGenerationChanged(Packet packet) {
386-
List<ClusterResource> referencedClusters = info.getReferencedClusters();
387-
if (referencedClusters.size() != packet.entrySet().stream()
388-
.filter(entry -> entry.getKey().startsWith(INTROSPECTION_CLUSTER_SPEC_GENERATION)).count()) {
389-
return true;
390-
}
391-
392-
for (ClusterResource clusterResource : referencedClusters) {
393-
if (Optional.ofNullable(packet.get(INTROSPECTION_CLUSTER_SPEC_GENERATION
394-
+ "." + clusterResource.getMetadata().getName()))
395-
.map(gen -> !gen.equals(getClusterGeneration(clusterResource))).orElse(true)) {
396-
return true;
397-
}
398-
}
399-
400-
return false;
401-
}
402-
403-
private String getClusterGeneration(ClusterResource clusterResource) {
404-
return Optional.ofNullable(clusterResource.getMetadata())
405-
.map(V1ObjectMeta::getGeneration)
406-
.map(Object::toString)
407-
.orElse("");
408-
}
409-
410383
// Returns true if an introspection was requested. Clears the flag in any case.
411384
private boolean isIntrospectionRequested(Packet packet) {
412385
return packet.remove(DOMAIN_INTROSPECT_REQUESTED) != null;
@@ -904,8 +877,8 @@ private Step createIntrospectorConfigMap() {
904877

905878
// Returns a chain of steps which read the pod log and create a config map.
906879
private Step processIntrospectorPodLog(Step next) {
907-
return Step.chain(waitForJobPod(), readNamedPodLog(), deleteIntrospectorJob(),
908-
createIntrospectorConfigMap(), next);
880+
return Step.chain(waitForJobPod(), readNamedPodLog(),
881+
createIntrospectorConfigMap(), deleteIntrospectorJob(), next);
909882
}
910883

911884
private String getName(V1Pod pod) {

operator/src/main/java/oracle/kubernetes/operator/makeright/MakeRightDomainOperationImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,8 @@ private Step createDomainUpPlan(DomainPresenceInfo info) {
293293
Step domainUpStrategy =
294294
Step.chain(
295295
ConfigMapHelper.createOrReplaceFluentdConfigMapStep(),
296-
domainIntrospectionSteps(),
297296
ConfigMapHelper.createOrReplaceFluentbitConfigMapStep(),
297+
domainIntrospectionSteps(),
298298
new DomainStatusStep(),
299299
DomainProcessorImpl.bringAdminServerUp(info),
300300
managedServerStrategy);

0 commit comments

Comments
 (0)