From d8dc1a7b7b0a77aa0da9bfa95092d076c82b2a74 Mon Sep 17 00:00:00 2001 From: Dongbo Xiao Date: Fri, 23 Oct 2020 09:43:08 -0400 Subject: [PATCH 01/17] initial changes to add introspect version to pod labels --- .../operator/DomainProcessorImpl.java | 2 +- .../operator/helpers/AnnotationHelper.java | 15 ++++ .../helpers/DomainValidationSteps.java | 9 +- .../operator/helpers/PodHelper.java | 9 ++ .../operator/helpers/PodStepContext.java | 62 ++++++++++++++ .../operator/logging/MessageKeys.java | 2 + .../src/main/resources/Operator.properties | 2 + .../operator/DomainProcessorTest.java | 85 +++++++++++++++++++ .../operator/helpers/PodHelperTestBase.java | 19 +++++ 9 files changed, 197 insertions(+), 8 deletions(-) diff --git a/operator/src/main/java/oracle/kubernetes/operator/DomainProcessorImpl.java b/operator/src/main/java/oracle/kubernetes/operator/DomainProcessorImpl.java index bc464989f83..1524c87f9a9 100644 --- a/operator/src/main/java/oracle/kubernetes/operator/DomainProcessorImpl.java +++ b/operator/src/main/java/oracle/kubernetes/operator/DomainProcessorImpl.java @@ -887,7 +887,7 @@ Step createDomainUpPlan(DomainPresenceInfo info) { Step domainUpStrategy = Step.chain( domainIntrospectionSteps(info), - DomainValidationSteps.createAfterIntrospectValidationSteps(info.getDomainUid()), + DomainValidationSteps.createAfterIntrospectValidationSteps(), new DomainStatusStep(info, null), bringAdminServerUp(info, delegate.getPodAwaiterStepFactory(info.getNamespace())), managedServerStrategy); diff --git a/operator/src/main/java/oracle/kubernetes/operator/helpers/AnnotationHelper.java b/operator/src/main/java/oracle/kubernetes/operator/helpers/AnnotationHelper.java index 952e2782b97..a47bca8f1ea 100644 --- a/operator/src/main/java/oracle/kubernetes/operator/helpers/AnnotationHelper.java +++ b/operator/src/main/java/oracle/kubernetes/operator/helpers/AnnotationHelper.java @@ -3,14 +3,17 @@ package oracle.kubernetes.operator.helpers; +import java.util.Collections; import java.util.Map; import java.util.Optional; import java.util.function.Function; +import java.util.stream.Stream; import io.kubernetes.client.openapi.models.V1ObjectMeta; import io.kubernetes.client.openapi.models.V1Pod; import io.kubernetes.client.openapi.models.V1Service; import io.kubernetes.client.util.Yaml; +import oracle.kubernetes.operator.LabelConstants; import org.apache.commons.codec.digest.DigestUtils; /** Annotates pods, services with details about the Domain instance and checks these annotations. */ @@ -51,7 +54,19 @@ private static V1Pod addHashAndDebug(V1Pod pod) { } private static V1Pod addHash(V1Pod pod) { + Map labels = + Optional.ofNullable(pod).map(V1Pod::getMetadata).map(V1ObjectMeta::getLabels).orElse(Collections.emptyMap()); + String introspectVersion = null; + boolean restoreNeeded = false; + if (!labels.isEmpty() && labels.containsKey(LabelConstants.INTROSPECTION_STATE_LABEL)) { + restoreNeeded = true; + introspectVersion = pod.getMetadata().getLabels().remove(LabelConstants.INTROSPECTION_STATE_LABEL); + } + pod.getMetadata().putAnnotationsItem(SHA256_ANNOTATION, HASH_FUNCTION.apply(pod)); + if (restoreNeeded) { + pod.getMetadata().getLabels().put(LabelConstants.INTROSPECTION_STATE_LABEL, introspectVersion); + } return pod; } diff --git a/operator/src/main/java/oracle/kubernetes/operator/helpers/DomainValidationSteps.java b/operator/src/main/java/oracle/kubernetes/operator/helpers/DomainValidationSteps.java index f926514e52b..301294abdba 100644 --- a/operator/src/main/java/oracle/kubernetes/operator/helpers/DomainValidationSteps.java +++ b/operator/src/main/java/oracle/kubernetes/operator/helpers/DomainValidationSteps.java @@ -48,8 +48,8 @@ public static Step createAdditionalDomainValidationSteps(V1PodSpec podSpec) { return new DomainAdditionalValidationStep(podSpec); } - public static Step createAfterIntrospectValidationSteps(String domainUid) { - return new DomainAfterIntrospectValidationStep(domainUid); + public static Step createAfterIntrospectValidationSteps() { + return new DomainAfterIntrospectValidationStep(); } private static Step createListSecretsStep(String domainNamespace) { @@ -230,11 +230,6 @@ private boolean hasMatchingMetadata(V1ObjectMeta metadata, String name, String n } private static class DomainAfterIntrospectValidationStep extends Step { - private String domainUid; - - public DomainAfterIntrospectValidationStep(String domainUid) { - this.domainUid = domainUid; - } @Override public NextAction apply(Packet packet) { diff --git a/operator/src/main/java/oracle/kubernetes/operator/helpers/PodHelper.java b/operator/src/main/java/oracle/kubernetes/operator/helpers/PodHelper.java index 3bb72dc34e8..e0e1c6a7daa 100644 --- a/operator/src/main/java/oracle/kubernetes/operator/helpers/PodHelper.java +++ b/operator/src/main/java/oracle/kubernetes/operator/helpers/PodHelper.java @@ -305,6 +305,10 @@ String getPodPatchedMessageKey() { return MessageKeys.ADMIN_POD_PATCHED; } + @Override + String getPodUpdatedMessageKey() { + return MessageKeys.ADMIN_POD_UPDATED; + } @Override String getPodReplacedMessageKey() { return MessageKeys.ADMIN_POD_REPLACED; @@ -455,6 +459,11 @@ String getPodPatchedMessageKey() { return MessageKeys.MANAGED_POD_PATCHED; } + @Override + String getPodUpdatedMessageKey() { + return MessageKeys.MANAGED_POD_UPDATED; + } + @Override protected String getPodReplacedMessageKey() { return MessageKeys.MANAGED_POD_REPLACED; diff --git a/operator/src/main/java/oracle/kubernetes/operator/helpers/PodStepContext.java b/operator/src/main/java/oracle/kubernetes/operator/helpers/PodStepContext.java index bafcb49fcf6..861e9b76679 100644 --- a/operator/src/main/java/oracle/kubernetes/operator/helpers/PodStepContext.java +++ b/operator/src/main/java/oracle/kubernetes/operator/helpers/PodStepContext.java @@ -7,6 +7,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; @@ -58,6 +59,8 @@ import oracle.kubernetes.weblogic.domain.model.Shutdown; import org.apache.commons.lang3.builder.EqualsBuilder; +import static oracle.kubernetes.operator.LabelConstants.INTROSPECTION_STATE_LABEL; + public abstract class PodStepContext extends BasePodStepContext { private static final LoggingFacade LOGGER = LoggingFactory.getLogger("Operator", "Operator"); @@ -364,6 +367,24 @@ protected Step patchPod(V1Pod currentPod, Step next) { new V1Patch(patchBuilder.build().toString()), patchResponse(next)); } + private Step updateCurrentPod(V1Pod currentPod, Step next) { + return createProgressingStep(updatePod(currentPod, next)); + } + + protected Step updatePod(V1Pod currentPod, Step next) { + JsonPatchBuilder patchBuilder = Json.createPatchBuilder(); + String baseName = "/metadata/labels/"; + if (!getPodLabels().containsKey(INTROSPECTION_STATE_LABEL)) { + patchBuilder.add(baseName + INTROSPECTION_STATE_LABEL, getDomain().getSpec().getIntrospectVersion()); + } else { + patchBuilder.replace(baseName + INTROSPECTION_STATE_LABEL, getDomain().getSpec().getIntrospectVersion()); + } + + return new CallBuilder() + .patchPodAsync(getPodName(), getNamespace(), getDomainUid(), + new V1Patch(patchBuilder.build().toString()), updateResponse(next)); + } + private Map getLabels(V1Pod pod) { return Optional.ofNullable(pod.getMetadata()).map(V1ObjectMeta::getLabels).orElseGet(Collections::emptyMap); } @@ -384,6 +405,10 @@ private void logPodPatched() { LOGGER.info(getPodPatchedMessageKey(), getDomainUid(), getServerName()); } + private void logPodUpdated() { + LOGGER.info(getPodUpdatedMessageKey(), getDomainUid(), getServerName(), getDomain().getIntrospectVersion()); + } + private void logPodReplaced() { LOGGER.info(getPodReplacedMessageKey(), getDomainUid(), getServerName()); } @@ -394,6 +419,8 @@ private void logPodReplaced() { abstract String getPodPatchedMessageKey(); + abstract String getPodUpdatedMessageKey(); + abstract String getPodReplacedMessageKey(); Step createCyclePodStep(Step next) { @@ -439,6 +466,10 @@ private ResponseStep patchResponse(Step next) { return new PatchPodResponseStep(next); } + private ResponseStep updateResponse(Step next) { + return new UpdatePodResponseStep(next); + } + V1Pod createPodModel() { return withNonHashedElements(AnnotationHelper.withSha256Hash(createPodRecipe())); } @@ -544,6 +575,8 @@ LabelConstants.CLUSTERRESTARTVERSION_LABEL, getServerSpec().getClusterRestartVer .putLabelsItem( LabelConstants.SERVERRESTARTVERSION_LABEL, getServerSpec().getServerRestartVersion()); + Optional.ofNullable(getDomain().getSpec().getIntrospectVersion()) + .ifPresent(version -> addIntrospectVersionLabel(metadata, version)); Optional.ofNullable(miiDomainZipHash) .ifPresent(hash -> addHashLabel(metadata, LabelConstants.MODEL_IN_IMAGE_DOMAINZIP_HASH, hash)); Optional.ofNullable(miiModelSecretsHash) @@ -556,6 +589,10 @@ LabelConstants.CLUSTERRESTARTVERSION_LABEL, getServerSpec().getClusterRestartVer return metadata; } + private void addIntrospectVersionLabel(V1ObjectMeta metadata, String introspectVersion) { + metadata.putLabelsItem(INTROSPECTION_STATE_LABEL, introspectVersion); + } + private void addHashLabel(V1ObjectMeta metadata, String label, String hash) { metadata.putLabelsItem(label, formatHashLabel(hash)); } @@ -847,6 +884,10 @@ public NextAction apply(Packet packet) { return doNext(patchCurrentPod(currentPod, getNext()), packet); } else { logPodExists(); + if (!Objects.equals(currentPod.getMetadata().getLabels().get(INTROSPECTION_STATE_LABEL), + getDomain().getSpec().getIntrospectVersion())) { + return doNext(updateCurrentPod(currentPod, getNext()), packet); + } return doNext(packet); } } @@ -965,4 +1006,25 @@ public NextAction onSuccess(Packet packet, CallResponse callResponse) { } } + private class UpdatePodResponseStep extends BaseResponseStep { + private final Step next; + + UpdatePodResponseStep(Step next) { + super(next); + this.next = next; + } + + @Override + public NextAction onSuccess(Packet packet, CallResponse callResponse) { + + V1Pod newPod = callResponse.getResult(); + logPodUpdated(); + if (newPod != null) { + setRecordedPod(newPod); + } + + return doNext(next, packet); + } + } + } diff --git a/operator/src/main/java/oracle/kubernetes/operator/logging/MessageKeys.java b/operator/src/main/java/oracle/kubernetes/operator/logging/MessageKeys.java index 816fbc79564..e1ec3da76e0 100644 --- a/operator/src/main/java/oracle/kubernetes/operator/logging/MessageKeys.java +++ b/operator/src/main/java/oracle/kubernetes/operator/logging/MessageKeys.java @@ -133,6 +133,8 @@ public class MessageKeys { public static final String INTROSPECTOR_JOB_FAILED = "WLSKO-0175"; public static final String INTROSPECTOR_JOB_FAILED_DETAIL = "WLSKO-0176"; public static final String INTROSPECTOR_POD_FAILED = "WLSKO-0177"; + public static final String ADMIN_POD_UPDATED = "WLSKO-0178"; + public static final String MANAGED_POD_UPDATED = "WLSKO-0179"; // domain status messages public static final String DUPLICATE_SERVER_NAME_FOUND = "WLSDO-0001"; diff --git a/operator/src/main/resources/Operator.properties b/operator/src/main/resources/Operator.properties index 8607bdc13f8..6bb7a086a01 100644 --- a/operator/src/main/resources/Operator.properties +++ b/operator/src/main/resources/Operator.properties @@ -187,6 +187,8 @@ WLSKO-0175=Job {0} in namespace {1} failed with status {2}. Check log messages \ copied from the introspector pod {3} log for additional information. WLSKO-0176=Job {1} in namespace {0} failed, job details are {2} WLSKO-0177=Pod {0} in namespace {1} failed, the pod status is {2} +WLSKO-0178=Patching administration server Pod with ''weblogic.introspectVersion'' {2} for WebLogic domain with UID: {0}. Administration server name: {1}. +WLSKO-0179=Patching managed server Pod with ''weblogic.introspectVersion'' {2} for WebLogic domain with UID: {0}. Managed server name: {1}. # Domain status messages diff --git a/operator/src/test/java/oracle/kubernetes/operator/DomainProcessorTest.java b/operator/src/test/java/oracle/kubernetes/operator/DomainProcessorTest.java index 2d04051c8c8..48395fcc877 100644 --- a/operator/src/test/java/oracle/kubernetes/operator/DomainProcessorTest.java +++ b/operator/src/test/java/oracle/kubernetes/operator/DomainProcessorTest.java @@ -414,6 +414,91 @@ private Stream getConfigMaps() { return testSupport.getResources(CONFIG_MAP).stream(); } + @Test + public void afterInitialIntrospection_serverPodsHaveInitialIntrospectVersionLabel() throws Exception { + domainConfigurator.withIntrospectVersion(OLD_INTROSPECTION_STATE); + testSupport.doOnCreate(POD, p -> recordPodCreation((V1Pod) p)); + domainConfigurator.configureCluster(CLUSTER).withReplicas(MIN_REPLICAS); + DomainPresenceInfo info = new DomainPresenceInfo(newDomain); + processor.createMakeRightOperation(info).withExplicitRecheck().execute(); + List runningPods = getRunningPods(); + + //one introspector pod, one admin server pod and two managed server pods + assertThat(runningPods.size(), equalTo(4)); + for (V1Pod pod: runningPods) { + if (!pod.getMetadata().getName().contains(LegalNames.getIntrospectorJobNameSuffix())) { + assertThat(getServerPodIntrospectionVersion(pod), equalTo(OLD_INTROSPECTION_STATE)); + } + } + } + + @Test + public void afterIntrospection_serverPodsHaveUpToDateIntrospectVersionLabel() throws Exception { + establishPreviousIntrospection(null); + domainConfigurator.withIntrospectVersion(NEW_INTROSPECTION_STATE); + DomainPresenceInfo info = new DomainPresenceInfo(newDomain); + processor.createMakeRightOperation(info).withExplicitRecheck().execute(); + + assertThat(job, notNullValue()); + + List runningPods = getRunningPods(); + + //one introspector pod, one admin server pod and two managed server pods + assertThat(runningPods.size(), equalTo(4)); + + for (V1Pod pod: runningPods) { + if (!pod.getMetadata().getName().contains(LegalNames.getIntrospectorJobNameSuffix())) { + assertThat(getServerPodIntrospectionVersion(pod), equalTo(NEW_INTROSPECTION_STATE)); + } + } + } + + @Test + public void afterScaleupClusterIntrospection_serverPodsHaveUpToDateIntrospectVersionLabel() throws Exception { + establishPreviousIntrospection(null); + domainConfigurator.configureCluster(CLUSTER).withReplicas(3); + domainConfigurator.withIntrospectVersion("after-scaleup"); + DomainPresenceInfo info = new DomainPresenceInfo(newDomain); + processor.createMakeRightOperation(info).withExplicitRecheck().execute(); + List runningPods = getRunningPods(); + + //one introspector pod, one admin server pod and three managed server pods + assertThat(runningPods.size(), equalTo(5)); + + for (V1Pod pod: runningPods) { + if (!pod.getMetadata().getName().contains(LegalNames.getIntrospectorJobNameSuffix())) { + assertThat(getServerPodIntrospectionVersion(pod), equalTo("after-scaleup")); + } + } + } + + @Test + public void afterScaledownClusterIntrospection_serverPodsHaveUpToDateIntrospectVersionLabel() throws Exception { + establishPreviousIntrospection(null); + domainConfigurator.configureCluster(CLUSTER).withReplicas(1); + domainConfigurator.withIntrospectVersion("after-scaledown"); + DomainPresenceInfo info = new DomainPresenceInfo(newDomain); + processor.createMakeRightOperation(info).withExplicitRecheck().execute(); + List runningPods = getRunningPods(); + + //one introspector pod, one admin server pod and one managed server pod + assertThat(runningPods.size(), equalTo(3)); + + for (V1Pod pod: runningPods) { + if (!pod.getMetadata().getName().contains(LegalNames.getIntrospectorJobNameSuffix())) { + assertThat(getServerPodIntrospectionVersion(pod), equalTo("after-scaledown")); + } + } + } + + private String getServerPodIntrospectionVersion(V1Pod pod) { + return Optional.ofNullable(pod) + .map(V1Pod::getMetadata) + .map(V1ObjectMeta::getLabels) + .map(m -> m.get(INTROSPECTION_STATE_LABEL)) + .orElse(null); + } + private boolean isIntrospectorMeta(@Nullable V1ObjectMeta meta) { return meta != null && NS.equals(meta.getNamespace()) && INTROSPECTOR_MAP_NAME.equals(meta.getName()); } diff --git a/operator/src/test/java/oracle/kubernetes/operator/helpers/PodHelperTestBase.java b/operator/src/test/java/oracle/kubernetes/operator/helpers/PodHelperTestBase.java index 171a9ec627a..5373fb6db55 100644 --- a/operator/src/test/java/oracle/kubernetes/operator/helpers/PodHelperTestBase.java +++ b/operator/src/test/java/oracle/kubernetes/operator/helpers/PodHelperTestBase.java @@ -765,11 +765,21 @@ void initializeExistingPod() { initializeExistingPod(createPodModel()); } + void initializeExistingPodWithIntrospectVersion(String introspectVersion) { + initializeExistingPodWithIntrospectVersion(createPodModel(), introspectVersion); + } + void initializeExistingPod(V1Pod pod) { testSupport.defineResources(pod); domainPresenceInfo.setServerPod(getServerName(), pod); } + void initializeExistingPodWithIntrospectVersion(V1Pod pod, String introspectVersion) { + testSupport.defineResources(pod); + pod.getMetadata().getLabels().put(LabelConstants.INTROSPECTION_STATE_LABEL, introspectVersion); + domainPresenceInfo.setServerPod(getServerName(), pod); + } + private V1Pod createPodModel() { return createPod(testSupport.getPacket()); } @@ -952,6 +962,15 @@ public void whenServerConfigurationAddsIntrospectionVersion_dontReplacePod() { verifyPodNotReplaced(); } + @Test + public void whenServerConfigurationIntrospectionVersionTheSame_dontReplacePod() { + initializeExistingPodWithIntrospectVersion("123"); + + configurator.withIntrospectVersion("123"); + + verifyPodNotReplaced(); + } + @Test public void whenServerListenPortChanged_replacePod() { initializeExistingPod(); From 46bb990ba30944301cf553b43e090faa21a3b07d Mon Sep 17 00:00:00 2001 From: Dongbo Xiao Date: Fri, 23 Oct 2020 13:53:53 -0400 Subject: [PATCH 02/17] work in progress --- .../operator/helpers/AnnotationHelper.java | 12 ---- .../operator/helpers/PodHelper.java | 1 + .../operator/helpers/PodStepContext.java | 60 ++++++++----------- .../operator/helpers/AdminPodHelperTest.java | 7 +++ .../helpers/ManagedPodHelperTest.java | 4 ++ .../operator/helpers/PodHelperTestBase.java | 14 ++++- 6 files changed, 48 insertions(+), 50 deletions(-) diff --git a/operator/src/main/java/oracle/kubernetes/operator/helpers/AnnotationHelper.java b/operator/src/main/java/oracle/kubernetes/operator/helpers/AnnotationHelper.java index a47bca8f1ea..ed2235631cf 100644 --- a/operator/src/main/java/oracle/kubernetes/operator/helpers/AnnotationHelper.java +++ b/operator/src/main/java/oracle/kubernetes/operator/helpers/AnnotationHelper.java @@ -54,19 +54,7 @@ private static V1Pod addHashAndDebug(V1Pod pod) { } private static V1Pod addHash(V1Pod pod) { - Map labels = - Optional.ofNullable(pod).map(V1Pod::getMetadata).map(V1ObjectMeta::getLabels).orElse(Collections.emptyMap()); - String introspectVersion = null; - boolean restoreNeeded = false; - if (!labels.isEmpty() && labels.containsKey(LabelConstants.INTROSPECTION_STATE_LABEL)) { - restoreNeeded = true; - introspectVersion = pod.getMetadata().getLabels().remove(LabelConstants.INTROSPECTION_STATE_LABEL); - } - pod.getMetadata().putAnnotationsItem(SHA256_ANNOTATION, HASH_FUNCTION.apply(pod)); - if (restoreNeeded) { - pod.getMetadata().getLabels().put(LabelConstants.INTROSPECTION_STATE_LABEL, introspectVersion); - } return pod; } diff --git a/operator/src/main/java/oracle/kubernetes/operator/helpers/PodHelper.java b/operator/src/main/java/oracle/kubernetes/operator/helpers/PodHelper.java index e0e1c6a7daa..751181bcaeb 100644 --- a/operator/src/main/java/oracle/kubernetes/operator/helpers/PodHelper.java +++ b/operator/src/main/java/oracle/kubernetes/operator/helpers/PodHelper.java @@ -309,6 +309,7 @@ String getPodPatchedMessageKey() { String getPodUpdatedMessageKey() { return MessageKeys.ADMIN_POD_UPDATED; } + @Override String getPodReplacedMessageKey() { return MessageKeys.ADMIN_POD_REPLACED; diff --git a/operator/src/main/java/oracle/kubernetes/operator/helpers/PodStepContext.java b/operator/src/main/java/oracle/kubernetes/operator/helpers/PodStepContext.java index 861e9b76679..aba94afdd9d 100644 --- a/operator/src/main/java/oracle/kubernetes/operator/helpers/PodStepContext.java +++ b/operator/src/main/java/oracle/kubernetes/operator/helpers/PodStepContext.java @@ -493,6 +493,9 @@ V1Pod withNonHashedElements(V1Pod pod) { .filter(PodStepContext::isCustomerItem) .forEach(e -> metadata.putAnnotationsItem(e.getKey(), e.getValue())); + Optional.ofNullable(getDomain().getSpec().getIntrospectVersion()) + .ifPresent(version -> metadata.putLabelsItem(INTROSPECTION_STATE_LABEL, version)); + setTerminationGracePeriod(pod); getContainer(pod).map(V1Container::getEnv).ifPresent(this::updateEnv); @@ -575,8 +578,6 @@ LabelConstants.CLUSTERRESTARTVERSION_LABEL, getServerSpec().getClusterRestartVer .putLabelsItem( LabelConstants.SERVERRESTARTVERSION_LABEL, getServerSpec().getServerRestartVersion()); - Optional.ofNullable(getDomain().getSpec().getIntrospectVersion()) - .ifPresent(version -> addIntrospectVersionLabel(metadata, version)); Optional.ofNullable(miiDomainZipHash) .ifPresent(hash -> addHashLabel(metadata, LabelConstants.MODEL_IN_IMAGE_DOMAINZIP_HASH, hash)); Optional.ofNullable(miiModelSecretsHash) @@ -589,10 +590,6 @@ LabelConstants.CLUSTERRESTARTVERSION_LABEL, getServerSpec().getClusterRestartVer return metadata; } - private void addIntrospectVersionLabel(V1ObjectMeta metadata, String introspectVersion) { - metadata.putLabelsItem(INTROSPECTION_STATE_LABEL, introspectVersion); - } - private void addHashLabel(V1ObjectMeta metadata, String label, String hash) { metadata.putLabelsItem(label, formatHashLabel(hash)); } @@ -965,65 +962,56 @@ public NextAction onSuccess(Packet packet, CallResponse callResponses) { } } - private class ReplacePodResponseStep extends BaseResponseStep { + private class ReplacePodResponseStep extends PatchPodResponseStep { ReplacePodResponseStep(Step next) { super(next); } @Override - public NextAction onSuccess(Packet packet, CallResponse callResponse) { - - V1Pod newPod = callResponse.getResult(); + public void logPodChanged() { logPodReplaced(); - if (newPod != null) { - setRecordedPod(newPod); - } + } - PodAwaiterStepFactory pw = packet.getSpi(PodAwaiterStepFactory.class); - return doNext(pw.waitForReady(newPod, getNext()), packet); + @Override + public NextAction onSuccess(Packet packet, CallResponse callResponse) { + return doNext( + packet.getSpi(PodAwaiterStepFactory.class).waitForReady(processResponse(callResponse), getNext()), + packet); } } private class PatchPodResponseStep extends BaseResponseStep { - private final Step next; - PatchPodResponseStep(Step next) { - super(next); - this.next = next; + PatchPodResponseStep(Step next) { super(next); } + + public void logPodChanged() { + logPodPatched(); } @Override public NextAction onSuccess(Packet packet, CallResponse callResponse) { + processResponse(callResponse); + return doNext(getNext(), packet); + } + protected V1Pod processResponse(CallResponse callResponse) { V1Pod newPod = callResponse.getResult(); - logPodPatched(); + logPodChanged(); if (newPod != null) { setRecordedPod(newPod); } - - return doNext(next, packet); + return newPod; } } - private class UpdatePodResponseStep extends BaseResponseStep { - private final Step next; + private class UpdatePodResponseStep extends PatchPodResponseStep { - UpdatePodResponseStep(Step next) { - super(next); - this.next = next; - } + UpdatePodResponseStep(Step next) { super(next); } @Override - public NextAction onSuccess(Packet packet, CallResponse callResponse) { - - V1Pod newPod = callResponse.getResult(); + public void logPodChanged() { logPodUpdated(); - if (newPod != null) { - setRecordedPod(newPod); - } - - return doNext(next, packet); } } diff --git a/operator/src/test/java/oracle/kubernetes/operator/helpers/AdminPodHelperTest.java b/operator/src/test/java/oracle/kubernetes/operator/helpers/AdminPodHelperTest.java index 0d245127e21..abec921d14e 100644 --- a/operator/src/test/java/oracle/kubernetes/operator/helpers/AdminPodHelperTest.java +++ b/operator/src/test/java/oracle/kubernetes/operator/helpers/AdminPodHelperTest.java @@ -37,6 +37,7 @@ import static oracle.kubernetes.operator.logging.MessageKeys.ADMIN_POD_EXISTS; import static oracle.kubernetes.operator.logging.MessageKeys.ADMIN_POD_PATCHED; import static oracle.kubernetes.operator.logging.MessageKeys.ADMIN_POD_REPLACED; +import static oracle.kubernetes.operator.logging.MessageKeys.ADMIN_POD_UPDATED; import static oracle.kubernetes.operator.logging.MessageKeys.DOMAIN_VALIDATION_FAILED; import static oracle.kubernetes.utils.LogMatcher.containsFine; import static oracle.kubernetes.utils.LogMatcher.containsInfo; @@ -100,6 +101,12 @@ String getReplacedMessageKey() { return ADMIN_POD_REPLACED; } + @Override + String getUpdatedMessageKey() { + return ADMIN_POD_UPDATED; + } + + @Override void setServerPort(int port) { getServerTopology().setAdminPort(port); diff --git a/operator/src/test/java/oracle/kubernetes/operator/helpers/ManagedPodHelperTest.java b/operator/src/test/java/oracle/kubernetes/operator/helpers/ManagedPodHelperTest.java index ff434ddbaca..e8ae1457a6c 100644 --- a/operator/src/test/java/oracle/kubernetes/operator/helpers/ManagedPodHelperTest.java +++ b/operator/src/test/java/oracle/kubernetes/operator/helpers/ManagedPodHelperTest.java @@ -46,6 +46,7 @@ import static oracle.kubernetes.operator.logging.MessageKeys.MANAGED_POD_EXISTS; import static oracle.kubernetes.operator.logging.MessageKeys.MANAGED_POD_PATCHED; import static oracle.kubernetes.operator.logging.MessageKeys.MANAGED_POD_REPLACED; +import static oracle.kubernetes.operator.logging.MessageKeys.MANAGED_POD_UPDATED; import static oracle.kubernetes.utils.LogMatcher.containsFine; import static oracle.kubernetes.utils.LogMatcher.containsInfo; import static oracle.kubernetes.utils.LogMatcher.containsSevere; @@ -103,6 +104,9 @@ String getReplacedMessageKey() { return MANAGED_POD_REPLACED; } + @Override + String getUpdatedMessageKey() { return MANAGED_POD_UPDATED; } + @Override String getDomainValidationFailedKey() { return DOMAIN_VALIDATION_FAILED; diff --git a/operator/src/test/java/oracle/kubernetes/operator/helpers/PodHelperTestBase.java b/operator/src/test/java/oracle/kubernetes/operator/helpers/PodHelperTestBase.java index 5373fb6db55..3b444751b04 100644 --- a/operator/src/test/java/oracle/kubernetes/operator/helpers/PodHelperTestBase.java +++ b/operator/src/test/java/oracle/kubernetes/operator/helpers/PodHelperTestBase.java @@ -241,6 +241,7 @@ private String[] getMessageKeys() { getExistsMessageKey(), getPatchedMessageKey(), getReplacedMessageKey(), + getUpdatedMessageKey(), getDomainValidationFailedKey() }; } @@ -547,6 +548,13 @@ public void whenPodCreationFailsDueToQuotaExceeded_abortFiber() { // todo set property to indicate dynamic/on_restart copying protected abstract void verifyPodReplaced(); + protected void verifyPodUpdated() { + testSupport.runSteps(getStepFactory(), terminalStep); + + assertThat(logRecords, containsFine(getExistsMessageKey())); + assertThat(logRecords, containsInfo(getUpdatedMessageKey())); + } + protected void verifyPodNotReplaced() { testSupport.runSteps(getStepFactory(), terminalStep); @@ -954,12 +962,12 @@ public void whenServerConfigurationAddsRestartVersion_replacePod() { } @Test - public void whenServerConfigurationAddsIntrospectionVersion_dontReplacePod() { + public void whenServerConfigurationAddsIntrospectionVersion_updatePod() { initializeExistingPod(); configurator.withIntrospectVersion("123"); - verifyPodNotReplaced(); + verifyPodUpdated(); } @Test @@ -1037,6 +1045,8 @@ public void whenCompliantPodExists_logIt() { abstract String getReplacedMessageKey(); + abstract String getUpdatedMessageKey(); + abstract String getDomainValidationFailedKey(); abstract V1Pod createTestPodModel(); From a900afafcbe52ec912887214141859a6dfe6e593 Mon Sep 17 00:00:00 2001 From: Dongbo Xiao Date: Sun, 25 Oct 2020 22:24:37 -0400 Subject: [PATCH 03/17] work in progress --- .../operator/helpers/AnnotationHelper.java | 3 --- .../operator/helpers/PodStepContext.java | 25 +++++++++++++++---- .../helpers/ManagedPodHelperTest.java | 4 ++- .../operator/helpers/PodHelperTestBase.java | 19 +++++++++----- 4 files changed, 36 insertions(+), 15 deletions(-) diff --git a/operator/src/main/java/oracle/kubernetes/operator/helpers/AnnotationHelper.java b/operator/src/main/java/oracle/kubernetes/operator/helpers/AnnotationHelper.java index ed2235631cf..952e2782b97 100644 --- a/operator/src/main/java/oracle/kubernetes/operator/helpers/AnnotationHelper.java +++ b/operator/src/main/java/oracle/kubernetes/operator/helpers/AnnotationHelper.java @@ -3,17 +3,14 @@ package oracle.kubernetes.operator.helpers; -import java.util.Collections; import java.util.Map; import java.util.Optional; import java.util.function.Function; -import java.util.stream.Stream; import io.kubernetes.client.openapi.models.V1ObjectMeta; import io.kubernetes.client.openapi.models.V1Pod; import io.kubernetes.client.openapi.models.V1Service; import io.kubernetes.client.util.Yaml; -import oracle.kubernetes.operator.LabelConstants; import org.apache.commons.codec.digest.DigestUtils; /** Annotates pods, services with details about the Domain instance and checks these annotations. */ diff --git a/operator/src/main/java/oracle/kubernetes/operator/helpers/PodStepContext.java b/operator/src/main/java/oracle/kubernetes/operator/helpers/PodStepContext.java index aba94afdd9d..7694b56cbff 100644 --- a/operator/src/main/java/oracle/kubernetes/operator/helpers/PodStepContext.java +++ b/operator/src/main/java/oracle/kubernetes/operator/helpers/PodStepContext.java @@ -7,7 +7,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; -import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; @@ -881,13 +880,25 @@ public NextAction apply(Packet packet) { return doNext(patchCurrentPod(currentPod, getNext()), packet); } else { logPodExists(); - if (!Objects.equals(currentPod.getMetadata().getLabels().get(INTROSPECTION_STATE_LABEL), - getDomain().getSpec().getIntrospectVersion())) { + if (introspectVersionChanged(currentPod)) { return doNext(updateCurrentPod(currentPod, getNext()), packet); } return doNext(packet); } } + + private boolean introspectVersionChanged(V1Pod currentPod) { + return !Objects.equals(getPodIntrospectVersionLabel(currentPod), getDomain().getSpec().getIntrospectVersion()); + } + + private Object getPodIntrospectVersionLabel(V1Pod pod) { + return getIntrospectVersionlabel(Optional.ofNullable(pod.getMetadata()) + .map(V1ObjectMeta::getLabels).orElse(Collections.emptyMap())); + } + + private Object getIntrospectVersionlabel(Map labels) { + return labels.get(INTROSPECTION_STATE_LABEL); + } } private abstract class BaseResponseStep extends ResponseStep { @@ -983,7 +994,9 @@ public NextAction onSuccess(Packet packet, CallResponse callResponse) { private class PatchPodResponseStep extends BaseResponseStep { - PatchPodResponseStep(Step next) { super(next); } + PatchPodResponseStep(Step next) { + super(next); + } public void logPodChanged() { logPodPatched(); @@ -1007,7 +1020,9 @@ protected V1Pod processResponse(CallResponse callResponse) { private class UpdatePodResponseStep extends PatchPodResponseStep { - UpdatePodResponseStep(Step next) { super(next); } + UpdatePodResponseStep(Step next) { + super(next); + } @Override public void logPodChanged() { diff --git a/operator/src/test/java/oracle/kubernetes/operator/helpers/ManagedPodHelperTest.java b/operator/src/test/java/oracle/kubernetes/operator/helpers/ManagedPodHelperTest.java index e8ae1457a6c..3af98dcb801 100644 --- a/operator/src/test/java/oracle/kubernetes/operator/helpers/ManagedPodHelperTest.java +++ b/operator/src/test/java/oracle/kubernetes/operator/helpers/ManagedPodHelperTest.java @@ -105,7 +105,9 @@ String getReplacedMessageKey() { } @Override - String getUpdatedMessageKey() { return MANAGED_POD_UPDATED; } + String getUpdatedMessageKey() { + return MANAGED_POD_UPDATED; + } @Override String getDomainValidationFailedKey() { diff --git a/operator/src/test/java/oracle/kubernetes/operator/helpers/PodHelperTestBase.java b/operator/src/test/java/oracle/kubernetes/operator/helpers/PodHelperTestBase.java index 3b444751b04..2fb520c6fc4 100644 --- a/operator/src/test/java/oracle/kubernetes/operator/helpers/PodHelperTestBase.java +++ b/operator/src/test/java/oracle/kubernetes/operator/helpers/PodHelperTestBase.java @@ -555,6 +555,13 @@ protected void verifyPodUpdated() { assertThat(logRecords, containsInfo(getUpdatedMessageKey())); } + protected void verifyPodNotUpdated() { + testSupport.runSteps(getStepFactory(), terminalStep); + + assertThat(logRecords, containsFine(getExistsMessageKey())); + assertThat(logRecords, not(containsInfo(getUpdatedMessageKey()))); + } + protected void verifyPodNotReplaced() { testSupport.runSteps(getStepFactory(), terminalStep); @@ -773,15 +780,15 @@ void initializeExistingPod() { initializeExistingPod(createPodModel()); } - void initializeExistingPodWithIntrospectVersion(String introspectVersion) { - initializeExistingPodWithIntrospectVersion(createPodModel(), introspectVersion); - } - void initializeExistingPod(V1Pod pod) { testSupport.defineResources(pod); domainPresenceInfo.setServerPod(getServerName(), pod); } + void initializeExistingPodWithIntrospectVersion(String introspectVersion) { + initializeExistingPodWithIntrospectVersion(createPodModel(), introspectVersion); + } + void initializeExistingPodWithIntrospectVersion(V1Pod pod, String introspectVersion) { testSupport.defineResources(pod); pod.getMetadata().getLabels().put(LabelConstants.INTROSPECTION_STATE_LABEL, introspectVersion); @@ -971,12 +978,12 @@ public void whenServerConfigurationAddsIntrospectionVersion_updatePod() { } @Test - public void whenServerConfigurationIntrospectionVersionTheSame_dontReplacePod() { + public void whenServerConfigurationIntrospectionVersionTheSame_dontUpdatePod() { initializeExistingPodWithIntrospectVersion("123"); configurator.withIntrospectVersion("123"); - verifyPodNotReplaced(); + verifyPodNotUpdated(); } @Test From ad4be5622e4f6f0d4602fb10cc30403b3e353c49 Mon Sep 17 00:00:00 2001 From: Dongbo Xiao Date: Mon, 26 Oct 2020 10:08:26 -0400 Subject: [PATCH 04/17] cleanup --- .../operator/helpers/PodStepContext.java | 10 ++++------ .../kubernetes/operator/DomainProcessorTest.java | 15 ++++++--------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/operator/src/main/java/oracle/kubernetes/operator/helpers/PodStepContext.java b/operator/src/main/java/oracle/kubernetes/operator/helpers/PodStepContext.java index 7694b56cbff..5cc58a10f61 100644 --- a/operator/src/main/java/oracle/kubernetes/operator/helpers/PodStepContext.java +++ b/operator/src/main/java/oracle/kubernetes/operator/helpers/PodStepContext.java @@ -892,12 +892,10 @@ private boolean introspectVersionChanged(V1Pod currentPod) { } private Object getPodIntrospectVersionLabel(V1Pod pod) { - return getIntrospectVersionlabel(Optional.ofNullable(pod.getMetadata()) - .map(V1ObjectMeta::getLabels).orElse(Collections.emptyMap())); - } - - private Object getIntrospectVersionlabel(Map labels) { - return labels.get(INTROSPECTION_STATE_LABEL); + return Optional.ofNullable(pod.getMetadata()) + .map(V1ObjectMeta::getLabels) + .map(labels -> labels.get(INTROSPECTION_STATE_LABEL)) + .orElse(null); } } diff --git a/operator/src/test/java/oracle/kubernetes/operator/DomainProcessorTest.java b/operator/src/test/java/oracle/kubernetes/operator/DomainProcessorTest.java index 48395fcc877..d280d68445e 100644 --- a/operator/src/test/java/oracle/kubernetes/operator/DomainProcessorTest.java +++ b/operator/src/test/java/oracle/kubernetes/operator/DomainProcessorTest.java @@ -421,8 +421,8 @@ public void afterInitialIntrospection_serverPodsHaveInitialIntrospectVersionLabe domainConfigurator.configureCluster(CLUSTER).withReplicas(MIN_REPLICAS); DomainPresenceInfo info = new DomainPresenceInfo(newDomain); processor.createMakeRightOperation(info).withExplicitRecheck().execute(); - List runningPods = getRunningPods(); + List runningPods = getRunningPods(); //one introspector pod, one admin server pod and two managed server pods assertThat(runningPods.size(), equalTo(4)); for (V1Pod pod: runningPods) { @@ -435,17 +435,14 @@ public void afterInitialIntrospection_serverPodsHaveInitialIntrospectVersionLabe @Test public void afterIntrospection_serverPodsHaveUpToDateIntrospectVersionLabel() throws Exception { establishPreviousIntrospection(null); + domainConfigurator.withIntrospectVersion(NEW_INTROSPECTION_STATE); DomainPresenceInfo info = new DomainPresenceInfo(newDomain); processor.createMakeRightOperation(info).withExplicitRecheck().execute(); - assertThat(job, notNullValue()); - List runningPods = getRunningPods(); - //one introspector pod, one admin server pod and two managed server pods assertThat(runningPods.size(), equalTo(4)); - for (V1Pod pod: runningPods) { if (!pod.getMetadata().getName().contains(LegalNames.getIntrospectorJobNameSuffix())) { assertThat(getServerPodIntrospectionVersion(pod), equalTo(NEW_INTROSPECTION_STATE)); @@ -456,15 +453,15 @@ public void afterIntrospection_serverPodsHaveUpToDateIntrospectVersionLabel() th @Test public void afterScaleupClusterIntrospection_serverPodsHaveUpToDateIntrospectVersionLabel() throws Exception { establishPreviousIntrospection(null); + domainConfigurator.configureCluster(CLUSTER).withReplicas(3); domainConfigurator.withIntrospectVersion("after-scaleup"); DomainPresenceInfo info = new DomainPresenceInfo(newDomain); processor.createMakeRightOperation(info).withExplicitRecheck().execute(); - List runningPods = getRunningPods(); + List runningPods = getRunningPods(); //one introspector pod, one admin server pod and three managed server pods assertThat(runningPods.size(), equalTo(5)); - for (V1Pod pod: runningPods) { if (!pod.getMetadata().getName().contains(LegalNames.getIntrospectorJobNameSuffix())) { assertThat(getServerPodIntrospectionVersion(pod), equalTo("after-scaleup")); @@ -475,15 +472,15 @@ public void afterScaleupClusterIntrospection_serverPodsHaveUpToDateIntrospectVer @Test public void afterScaledownClusterIntrospection_serverPodsHaveUpToDateIntrospectVersionLabel() throws Exception { establishPreviousIntrospection(null); + domainConfigurator.configureCluster(CLUSTER).withReplicas(1); domainConfigurator.withIntrospectVersion("after-scaledown"); DomainPresenceInfo info = new DomainPresenceInfo(newDomain); processor.createMakeRightOperation(info).withExplicitRecheck().execute(); - List runningPods = getRunningPods(); + List runningPods = getRunningPods(); //one introspector pod, one admin server pod and one managed server pod assertThat(runningPods.size(), equalTo(3)); - for (V1Pod pod: runningPods) { if (!pod.getMetadata().getName().contains(LegalNames.getIntrospectorJobNameSuffix())) { assertThat(getServerPodIntrospectionVersion(pod), equalTo("after-scaledown")); From 4d7ce38c0c4ac946af45553d7c504c7e59821c51 Mon Sep 17 00:00:00 2001 From: Dongbo Xiao Date: Mon, 26 Oct 2020 10:12:22 -0400 Subject: [PATCH 05/17] fix unit test failure in PodWatcherTest not related to this PR --- .../main/java/oracle/kubernetes/operator/WaitForReadyStep.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/operator/src/main/java/oracle/kubernetes/operator/WaitForReadyStep.java b/operator/src/main/java/oracle/kubernetes/operator/WaitForReadyStep.java index 1bad5c9183e..3fff52e1f20 100644 --- a/operator/src/main/java/oracle/kubernetes/operator/WaitForReadyStep.java +++ b/operator/src/main/java/oracle/kubernetes/operator/WaitForReadyStep.java @@ -29,7 +29,8 @@ abstract class WaitForReadyStep extends Step { static int getWatchBackstopRecheckDelaySeconds() { return Optional.ofNullable(TuningParameters.getInstance()) - .map(parameters -> parameters.getWatchTuning().watchBackstopRecheckDelay) + .map(TuningParameters::getWatchTuning) + .map(tuning -> tuning.watchBackstopRecheckDelay) .orElse(DEFAULT_RECHECK_SECONDS); } From 6d9bb16c1fdbbef3ba6751ad38b6556516fc10ef Mon Sep 17 00:00:00 2001 From: Dongbo Xiao Date: Mon, 26 Oct 2020 16:38:23 -0400 Subject: [PATCH 06/17] minor changes --- .../oracle/kubernetes/operator/helpers/PodStepContext.java | 2 +- operator/src/main/resources/Operator.properties | 4 ++-- .../oracle/kubernetes/operator/helpers/PodHelperTestBase.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/operator/src/main/java/oracle/kubernetes/operator/helpers/PodStepContext.java b/operator/src/main/java/oracle/kubernetes/operator/helpers/PodStepContext.java index 5cc58a10f61..505c9eba1de 100644 --- a/operator/src/main/java/oracle/kubernetes/operator/helpers/PodStepContext.java +++ b/operator/src/main/java/oracle/kubernetes/operator/helpers/PodStepContext.java @@ -879,10 +879,10 @@ public NextAction apply(Packet packet) { } else if (mustPatchPod(currentPod)) { return doNext(patchCurrentPod(currentPod, getNext()), packet); } else { - logPodExists(); if (introspectVersionChanged(currentPod)) { return doNext(updateCurrentPod(currentPod, getNext()), packet); } + logPodExists(); return doNext(packet); } } diff --git a/operator/src/main/resources/Operator.properties b/operator/src/main/resources/Operator.properties index 6bb7a086a01..059b2c9939f 100644 --- a/operator/src/main/resources/Operator.properties +++ b/operator/src/main/resources/Operator.properties @@ -187,8 +187,8 @@ WLSKO-0175=Job {0} in namespace {1} failed with status {2}. Check log messages \ copied from the introspector pod {3} log for additional information. WLSKO-0176=Job {1} in namespace {0} failed, job details are {2} WLSKO-0177=Pod {0} in namespace {1} failed, the pod status is {2} -WLSKO-0178=Patching administration server Pod with ''weblogic.introspectVersion'' {2} for WebLogic domain with UID: {0}. Administration server name: {1}. -WLSKO-0179=Patching managed server Pod with ''weblogic.introspectVersion'' {2} for WebLogic domain with UID: {0}. Managed server name: {1}. +WLSKO-0178=Patching administration server Pod labels with ''weblogic.introspectVersion'' {2} for WebLogic domain with UID: {0}. Administration server name: {1}. +WLSKO-0179=Patching managed server Pod labels with ''weblogic.introspectVersion'' {2} for WebLogic domain with UID: {0}. Managed server name: {1}. # Domain status messages diff --git a/operator/src/test/java/oracle/kubernetes/operator/helpers/PodHelperTestBase.java b/operator/src/test/java/oracle/kubernetes/operator/helpers/PodHelperTestBase.java index 2fb520c6fc4..b5b0c4ebb8f 100644 --- a/operator/src/test/java/oracle/kubernetes/operator/helpers/PodHelperTestBase.java +++ b/operator/src/test/java/oracle/kubernetes/operator/helpers/PodHelperTestBase.java @@ -551,7 +551,7 @@ public void whenPodCreationFailsDueToQuotaExceeded_abortFiber() { protected void verifyPodUpdated() { testSupport.runSteps(getStepFactory(), terminalStep); - assertThat(logRecords, containsFine(getExistsMessageKey())); + assertThat(logRecords, not(containsFine(getExistsMessageKey()))); assertThat(logRecords, containsInfo(getUpdatedMessageKey())); } From 5501a1b7f54ca640e3810d979b93d09be2aecb66 Mon Sep 17 00:00:00 2001 From: Dongbo Xiao Date: Mon, 26 Oct 2020 16:53:17 -0400 Subject: [PATCH 07/17] doc changes --- .../managing-domains/domain-lifecycle/introspection.md | 2 ++ .../content/userguide/managing-domains/domain-resource.md | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docs-source/content/userguide/managing-domains/domain-lifecycle/introspection.md b/docs-source/content/userguide/managing-domains/domain-lifecycle/introspection.md index 9981d45ea7d..2b841ee3433 100644 --- a/docs-source/content/userguide/managing-domains/domain-lifecycle/introspection.md +++ b/docs-source/content/userguide/managing-domains/domain-lifecycle/introspection.md @@ -44,6 +44,8 @@ Set `introspectVersion` to a new value. As with `restartVersion`, the `introspectVersion` field has no required format; however, we recommend using a value likely to be unique such as a continually increasing number or a timestamp. +Starting from release 3.1.0, if the domain resource's `spec.introspectVersion` is set, the WebLogic Server pods in the domain will contain a label in the metadata with the key `weblogic.IntrospectVersion` to indicate which introspectVersion that the pod is running at. When the domain's `spec.intrsopectVersion` is changed, the WebLogic Server pods that have been restarted or that will not be restarted will have the new label value, and all WebLogic Server pods that are yet to be restarted will continue have the old value until they are restarted. + #### Failed introspection Sometimes the Kubernetes Job, named `DOMAIN_UID-introspector`, created for the introspection will fail. diff --git a/docs-source/content/userguide/managing-domains/domain-resource.md b/docs-source/content/userguide/managing-domains/domain-resource.md index 293c784aac8..02aa5eb7428 100644 --- a/docs-source/content/userguide/managing-domains/domain-resource.md +++ b/docs-source/content/userguide/managing-domains/domain-resource.md @@ -161,7 +161,7 @@ Elements related to domain [startup and shutdown]({{< relref "/userguide/managin * `replicas`: The default number of cluster member Managed Server instances to start for each WebLogic cluster in the domain configuration, unless `replicas` is specified for that cluster under the `clusters` field. For each cluster, the operator will sort cluster member Managed Server names from the WebLogic domain configuration by normalizing any numbers in the Managed Server name and then sorting alphabetically. This is done so that server names such as "managed-server10" come after "managed-server9". The operator will then start Managed Servers from the sorted list, up to the `replicas` count, unless specific Managed Servers are specified as starting in their entry under the `managedServers` field. In that case, the specified Managed Servers will be started and then additional cluster members will be started, up to the `replicas` count, by finding further cluster members in the sorted list that are not already started. If cluster members are started because of their entries under `managedServers`, then a cluster may have more cluster members running than its `replicas` count. Defaults to 0. * `maxClusterConcurrentStartup`: The maximum number of cluster member Managed Server instances that the operator will start in parallel for a given cluster, if `maxConcurrentStartup` is not specified for a specific cluster under the `clusters` field. A value of 0 means there is no configured limit. Defaults to 0. * `allowReplicasBelowMinDynClusterSize`: Whether to allow the number of running cluster member Managed Server instances to drop below the minimum dynamic cluster size configured in the WebLogic domain configuration, if this is not specified for a specific cluster under the `clusters` field. Defaults to true. -* `introspectVersion`: Changes to this field cause the operator to repeat its introspection of the WebLogic domain configuration. Repeating introspection is required for the operator to recognize changes to the domain configuration, such as adding a new WebLogic cluster or Managed Server instance, to regenerate configuration overrides, or to regenerate the WebLogic domain home when the `domainHomeSourceType` is FromModel. Introspection occurs automatically, without requiring change to this field, when servers are first started or restarted after a full domain shut down. For the FromModel `domainHomeSourceType`, introspection also occurs when a running server must be restarted because of changes to any of the fields [listed here]({{< relref "/userguide/managing-domains/domain-lifecycle/startup#fields-that-cause-servers-to-be-restarted" >}}). See also `overridesConfigurationStrategy`. +* `introspectVersion`: Changes to this field cause the operator to repeat its introspection of the WebLogic domain configuration (see [initiate introspection]({{< relref "/userguide/managing-domains/domain-lifecycle/introspection/_index.md#initiating-introspection" >}})). Repeating introspection is required for the operator to recognize changes to the domain configuration, such as adding a new WebLogic cluster or Managed Server instance, to regenerate configuration overrides, or to regenerate the WebLogic domain home when the `domainHomeSourceType` is FromModel. Introspection occurs automatically, without requiring change to this field, when servers are first started or restarted after a full domain shut down. For the FromModel `domainHomeSourceType`, introspection also occurs when a running server must be restarted because of changes to any of the fields [listed here]({{< relref "/userguide/managing-domains/domain-lifecycle/startup#fields-that-cause-servers-to-be-restarted" >}}). See also `overridesConfigurationStrategy`. Elements related to specifying and overriding WebLogic domain configuration: From cc78fc7d9cfd325080f458b28698ed58f347d57c Mon Sep 17 00:00:00 2001 From: Dongbo Xiao Date: Mon, 26 Oct 2020 17:28:26 -0400 Subject: [PATCH 08/17] add an example in the doc --- .../domain-lifecycle/introspection.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/docs-source/content/userguide/managing-domains/domain-lifecycle/introspection.md b/docs-source/content/userguide/managing-domains/domain-lifecycle/introspection.md index 2b841ee3433..d9e83753b27 100644 --- a/docs-source/content/userguide/managing-domains/domain-lifecycle/introspection.md +++ b/docs-source/content/userguide/managing-domains/domain-lifecycle/introspection.md @@ -44,7 +44,20 @@ Set `introspectVersion` to a new value. As with `restartVersion`, the `introspectVersion` field has no required format; however, we recommend using a value likely to be unique such as a continually increasing number or a timestamp. -Starting from release 3.1.0, if the domain resource's `spec.introspectVersion` is set, the WebLogic Server pods in the domain will contain a label in the metadata with the key `weblogic.IntrospectVersion` to indicate which introspectVersion that the pod is running at. When the domain's `spec.intrsopectVersion` is changed, the WebLogic Server pods that have been restarted or that will not be restarted will have the new label value, and all WebLogic Server pods that are yet to be restarted will continue have the old value until they are restarted. +Starting from operator 3.1.0, if a domain resource's `spec.introspectVersion` is set, each of the domain's WebLogic Server pods will have a label with the key `weblogic.IntrospectVersion` to indicate the `introspectVersion` that the pod is running at. + +``` +Name: domain1-admin-server +Namespace: domain1-ns +Priority: 0 +Labels: weblogic.createdByOperator=true + weblogic.domainName=domain1 + weblogic.domainUID=domain1 + weblogic.introspectVersion=12345 + weblogic.serverName=admin-server +``` + +When a domain's `spec.intrsopectVersion` is changed, the `weblogic.introspectVersion` label of each WebLogic Server pod is updated to the new `introspectVersion` value either when the operator restarts the pod, or when the operator determines that the pod does not need to be restarted. #### Failed introspection From eef06c56df8c07216148bcde5b2e3053fb33c874 Mon Sep 17 00:00:00 2001 From: Dongbo Xiao Date: Tue, 27 Oct 2020 10:28:17 -0400 Subject: [PATCH 09/17] doc edits to address review comments --- .../managing-domains/domain-lifecycle/introspection.md | 4 ++-- .../content/userguide/managing-domains/domain-resource.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs-source/content/userguide/managing-domains/domain-lifecycle/introspection.md b/docs-source/content/userguide/managing-domains/domain-lifecycle/introspection.md index d9e83753b27..87742a4160f 100644 --- a/docs-source/content/userguide/managing-domains/domain-lifecycle/introspection.md +++ b/docs-source/content/userguide/managing-domains/domain-lifecycle/introspection.md @@ -44,7 +44,7 @@ Set `introspectVersion` to a new value. As with `restartVersion`, the `introspectVersion` field has no required format; however, we recommend using a value likely to be unique such as a continually increasing number or a timestamp. -Starting from operator 3.1.0, if a domain resource's `spec.introspectVersion` is set, each of the domain's WebLogic Server pods will have a label with the key `weblogic.IntrospectVersion` to indicate the `introspectVersion` that the pod is running at. +Beginning with operator 3.1.0, if a domain resource's `spec.introspectVersion` is set, each of the domain's WebLogic Server pods will have a label with the key `weblogic.IntrospectVersion` to indicate the `introspectVersion` at which the pod is running. ``` Name: domain1-admin-server @@ -57,7 +57,7 @@ Labels: weblogic.createdByOperator=true weblogic.serverName=admin-server ``` -When a domain's `spec.intrsopectVersion` is changed, the `weblogic.introspectVersion` label of each WebLogic Server pod is updated to the new `introspectVersion` value either when the operator restarts the pod, or when the operator determines that the pod does not need to be restarted. +When a domain's `spec.intrsopectVersion` is changed, the `weblogic.introspectVersion` label of each WebLogic Server pod is updated to the new `introspectVersion` value, either when the operator restarts the pod or when the operator determines that the pod does not need to be restarted. #### Failed introspection diff --git a/docs-source/content/userguide/managing-domains/domain-resource.md b/docs-source/content/userguide/managing-domains/domain-resource.md index 02aa5eb7428..75a1d96e6fc 100644 --- a/docs-source/content/userguide/managing-domains/domain-resource.md +++ b/docs-source/content/userguide/managing-domains/domain-resource.md @@ -161,14 +161,14 @@ Elements related to domain [startup and shutdown]({{< relref "/userguide/managin * `replicas`: The default number of cluster member Managed Server instances to start for each WebLogic cluster in the domain configuration, unless `replicas` is specified for that cluster under the `clusters` field. For each cluster, the operator will sort cluster member Managed Server names from the WebLogic domain configuration by normalizing any numbers in the Managed Server name and then sorting alphabetically. This is done so that server names such as "managed-server10" come after "managed-server9". The operator will then start Managed Servers from the sorted list, up to the `replicas` count, unless specific Managed Servers are specified as starting in their entry under the `managedServers` field. In that case, the specified Managed Servers will be started and then additional cluster members will be started, up to the `replicas` count, by finding further cluster members in the sorted list that are not already started. If cluster members are started because of their entries under `managedServers`, then a cluster may have more cluster members running than its `replicas` count. Defaults to 0. * `maxClusterConcurrentStartup`: The maximum number of cluster member Managed Server instances that the operator will start in parallel for a given cluster, if `maxConcurrentStartup` is not specified for a specific cluster under the `clusters` field. A value of 0 means there is no configured limit. Defaults to 0. * `allowReplicasBelowMinDynClusterSize`: Whether to allow the number of running cluster member Managed Server instances to drop below the minimum dynamic cluster size configured in the WebLogic domain configuration, if this is not specified for a specific cluster under the `clusters` field. Defaults to true. -* `introspectVersion`: Changes to this field cause the operator to repeat its introspection of the WebLogic domain configuration (see [initiate introspection]({{< relref "/userguide/managing-domains/domain-lifecycle/introspection/_index.md#initiating-introspection" >}})). Repeating introspection is required for the operator to recognize changes to the domain configuration, such as adding a new WebLogic cluster or Managed Server instance, to regenerate configuration overrides, or to regenerate the WebLogic domain home when the `domainHomeSourceType` is FromModel. Introspection occurs automatically, without requiring change to this field, when servers are first started or restarted after a full domain shut down. For the FromModel `domainHomeSourceType`, introspection also occurs when a running server must be restarted because of changes to any of the fields [listed here]({{< relref "/userguide/managing-domains/domain-lifecycle/startup#fields-that-cause-servers-to-be-restarted" >}}). See also `overridesConfigurationStrategy`. +* `introspectVersion`: Changes to this field cause the operator to repeat its introspection of the WebLogic domain configuration (see [initiating introspection]({{< relref "/userguide/managing-domains/domain-lifecycle/introspection/_index.md#initiating-introspection" >}})). Repeating introspection is required for the operator to recognize changes to the domain configuration, such as adding a new WebLogic cluster or Managed Server instance, to regenerate configuration overrides, or to regenerate the WebLogic domain home when the `domainHomeSourceType` is FromModel. Introspection occurs automatically, without requiring change to this field, when servers are first started or restarted after a full domain shut down. For the FromModel `domainHomeSourceType`, introspection also occurs when a running server must be restarted because of changes to any of the fields [listed here]({{< relref "/userguide/managing-domains/domain-lifecycle/startup#fields-that-cause-servers-to-be-restarted" >}}). See also `overridesConfigurationStrategy`. Elements related to specifying and overriding WebLogic domain configuration: * These elements are under `configuration`. * `overridesConfigMap`: The name of the ConfigMap for WebLogic [configuration overrides]({{< relref "/userguide/managing-domains/configoverrides/_index.md" >}}). If this field is specified, then the value of `spec.configOverrides` is ignored. - * `overrideDistributionStrategy`: Determines how updated configuration overrides are distributed to already running WebLogic Server instances following introspection when the `domainHomeSourceType` is PersistentVolume or Image. Configuration overrides are generated during introspection from Secrets, the `overrideConfigMap` field, and WebLogic domain topology. Legal values are DYNAMIC, which means that the operator will distribute updated configuration overrides dynamically to running servers, and ON_RESTART, which means that servers will use updated configuration overrides only after the server's next restart. The selection of ON_RESTART will not cause servers to restart when there are updated configuration overrides available. See also `introspectVersion`. Defaults to DYNAMIC. + * `overrideDistributionStrategy`: Determines how updated configuration overrides are distributed to already running WebLogic Server instances following introspection when the `domainHomeSourceType` is PersistentVolume or Image. Configuration overrides are generated during introspection from Secrets, the `overridesConfigMap` field, and WebLogic domain topology. Legal values are DYNAMIC, which means that the operator will distribute updated configuration overrides dynamically to running servers, and ON_RESTART, which means that servers will use updated configuration overrides only after the server's next restart. The selection of ON_RESTART will not cause servers to restart when there are updated configuration overrides available. See also `introspectVersion`. Defaults to DYNAMIC. * `secrets`: A list of names of the Secrets for WebLogic [configuration overrides]({{< relref "/userguide/managing-domains/configoverrides/_index.md" >}}) or model. If this field is specified, then the value of `spec.configOverrideSecrets` is ignored. * `introspectorJobActiveDeadlineSeconds`: The introspector job timeout value in seconds. If this field is specified, then the operator's ConfigMap `data.introspectorJobActiveDeadlineSeconds` value is ignored. Defaults to 120 seconds. From 965b0935b45e994651f1da566b7bb82c12502a75 Mon Sep 17 00:00:00 2001 From: Dongbo Xiao Date: Tue, 27 Oct 2020 12:08:07 -0400 Subject: [PATCH 10/17] address review comments --- .../managing-domains/domain-lifecycle/introspection.md | 4 ++-- .../content/userguide/managing-domains/domain-resource.md | 2 +- .../oracle/kubernetes/operator/helpers/PodStepContext.java | 6 +++--- operator/src/main/resources/Operator.properties | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs-source/content/userguide/managing-domains/domain-lifecycle/introspection.md b/docs-source/content/userguide/managing-domains/domain-lifecycle/introspection.md index 87742a4160f..7257fb996bf 100644 --- a/docs-source/content/userguide/managing-domains/domain-lifecycle/introspection.md +++ b/docs-source/content/userguide/managing-domains/domain-lifecycle/introspection.md @@ -44,7 +44,7 @@ Set `introspectVersion` to a new value. As with `restartVersion`, the `introspectVersion` field has no required format; however, we recommend using a value likely to be unique such as a continually increasing number or a timestamp. -Beginning with operator 3.1.0, if a domain resource's `spec.introspectVersion` is set, each of the domain's WebLogic Server pods will have a label with the key `weblogic.IntrospectVersion` to indicate the `introspectVersion` at which the pod is running. +Beginning with operator 3.1.0, if a domain resource's `spec.introspectVersion` is set, each of the domain's WebLogic Server pods will have a label with the key `weblogic.introspectVersion` to indicate the `introspectVersion` at which the pod is running. ``` Name: domain1-admin-server @@ -57,7 +57,7 @@ Labels: weblogic.createdByOperator=true weblogic.serverName=admin-server ``` -When a domain's `spec.intrsopectVersion` is changed, the `weblogic.introspectVersion` label of each WebLogic Server pod is updated to the new `introspectVersion` value, either when the operator restarts the pod or when the operator determines that the pod does not need to be restarted. +When a domain's `spec.introspectVersion` is changed, the `weblogic.introspectVersion` label of each WebLogic Server pod is updated to the new `introspectVersion` value, either when the operator restarts the pod or when the operator determines that the pod does not need to be restarted. #### Failed introspection diff --git a/docs-source/content/userguide/managing-domains/domain-resource.md b/docs-source/content/userguide/managing-domains/domain-resource.md index 75a1d96e6fc..4734ce0aa2d 100644 --- a/docs-source/content/userguide/managing-domains/domain-resource.md +++ b/docs-source/content/userguide/managing-domains/domain-resource.md @@ -161,7 +161,7 @@ Elements related to domain [startup and shutdown]({{< relref "/userguide/managin * `replicas`: The default number of cluster member Managed Server instances to start for each WebLogic cluster in the domain configuration, unless `replicas` is specified for that cluster under the `clusters` field. For each cluster, the operator will sort cluster member Managed Server names from the WebLogic domain configuration by normalizing any numbers in the Managed Server name and then sorting alphabetically. This is done so that server names such as "managed-server10" come after "managed-server9". The operator will then start Managed Servers from the sorted list, up to the `replicas` count, unless specific Managed Servers are specified as starting in their entry under the `managedServers` field. In that case, the specified Managed Servers will be started and then additional cluster members will be started, up to the `replicas` count, by finding further cluster members in the sorted list that are not already started. If cluster members are started because of their entries under `managedServers`, then a cluster may have more cluster members running than its `replicas` count. Defaults to 0. * `maxClusterConcurrentStartup`: The maximum number of cluster member Managed Server instances that the operator will start in parallel for a given cluster, if `maxConcurrentStartup` is not specified for a specific cluster under the `clusters` field. A value of 0 means there is no configured limit. Defaults to 0. * `allowReplicasBelowMinDynClusterSize`: Whether to allow the number of running cluster member Managed Server instances to drop below the minimum dynamic cluster size configured in the WebLogic domain configuration, if this is not specified for a specific cluster under the `clusters` field. Defaults to true. -* `introspectVersion`: Changes to this field cause the operator to repeat its introspection of the WebLogic domain configuration (see [initiating introspection]({{< relref "/userguide/managing-domains/domain-lifecycle/introspection/_index.md#initiating-introspection" >}})). Repeating introspection is required for the operator to recognize changes to the domain configuration, such as adding a new WebLogic cluster or Managed Server instance, to regenerate configuration overrides, or to regenerate the WebLogic domain home when the `domainHomeSourceType` is FromModel. Introspection occurs automatically, without requiring change to this field, when servers are first started or restarted after a full domain shut down. For the FromModel `domainHomeSourceType`, introspection also occurs when a running server must be restarted because of changes to any of the fields [listed here]({{< relref "/userguide/managing-domains/domain-lifecycle/startup#fields-that-cause-servers-to-be-restarted" >}}). See also `overridesConfigurationStrategy`. +* `introspectVersion`: Changes to this field cause the operator to repeat its introspection of the WebLogic domain configuration (see [initiating introspection]({{< relref "/userguide/managing-domains/domain-lifecycle/introspection/_index.md#initiating-introspection" >}})). Repeating introspection is required for the operator to recognize changes to the domain configuration, such as adding a new WebLogic cluster or Managed Server instance, to regenerate configuration overrides, or to regenerate the WebLogic domain home when the `domainHomeSourceType` is FromModel. Introspection occurs automatically, without requiring change to this field, when servers are first started or restarted after a full domain shut down. For the FromModel `domainHomeSourceType`, introspection also occurs when a running server must be restarted because of changes to any of the fields [listed here]({{< relref "/userguide/managing-domains/domain-lifecycle/startup#fields-that-cause-servers-to-be-restarted" >}}). See also `overrideDistributionStrategy`. Elements related to specifying and overriding WebLogic domain configuration: diff --git a/operator/src/main/java/oracle/kubernetes/operator/helpers/PodStepContext.java b/operator/src/main/java/oracle/kubernetes/operator/helpers/PodStepContext.java index 505c9eba1de..c2c952d89e3 100644 --- a/operator/src/main/java/oracle/kubernetes/operator/helpers/PodStepContext.java +++ b/operator/src/main/java/oracle/kubernetes/operator/helpers/PodStepContext.java @@ -372,11 +372,11 @@ private Step updateCurrentPod(V1Pod currentPod, Step next) { protected Step updatePod(V1Pod currentPod, Step next) { JsonPatchBuilder patchBuilder = Json.createPatchBuilder(); - String baseName = "/metadata/labels/"; + String pathName = "/metadata/labels/" + INTROSPECTION_STATE_LABEL; if (!getPodLabels().containsKey(INTROSPECTION_STATE_LABEL)) { - patchBuilder.add(baseName + INTROSPECTION_STATE_LABEL, getDomain().getSpec().getIntrospectVersion()); + patchBuilder.add(pathName, getDomain().getSpec().getIntrospectVersion()); } else { - patchBuilder.replace(baseName + INTROSPECTION_STATE_LABEL, getDomain().getSpec().getIntrospectVersion()); + patchBuilder.replace(pathName, getDomain().getSpec().getIntrospectVersion()); } return new CallBuilder() diff --git a/operator/src/main/resources/Operator.properties b/operator/src/main/resources/Operator.properties index bc62312362b..f30dc3a9d4b 100644 --- a/operator/src/main/resources/Operator.properties +++ b/operator/src/main/resources/Operator.properties @@ -189,7 +189,7 @@ WLSKO-0176=Job {1} in namespace {0} failed, job details are {2} WLSKO-0177=Pod {0} in namespace {1} failed, the pod status is {2} WLSKO-0178=Patching administration server Pod labels with ''weblogic.introspectVersion'' {2} for WebLogic domain with UID: {0}. Administration server name: {1}. WLSKO-0179=Patching managed server Pod labels with ''weblogic.introspectVersion'' {2} for WebLogic domain with UID: {0}. Managed server name: {1}. -WLSKO-0180=Operator cannot start. 'Dedicated' namespace strategy selected, but the CRD is not installed +WLSKO-0180=Operator cannot start. Operator 'domainNamespaceSelectionStrategy' is set to 'Dedicated', but the Custom Resource Definition for ''domains.weblogic.oracle'' is not installed. # Domain status messages From 0dc1af7050c5e8b0a7311faf0f18940d455b3bcb Mon Sep 17 00:00:00 2001 From: Dongbo Xiao Date: Tue, 27 Oct 2020 12:16:16 -0400 Subject: [PATCH 11/17] cleanup --- .../userguide/managing-domains/domain-lifecycle/introspection.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs-source/content/userguide/managing-domains/domain-lifecycle/introspection.md b/docs-source/content/userguide/managing-domains/domain-lifecycle/introspection.md index 7257fb996bf..8b973cdb25f 100644 --- a/docs-source/content/userguide/managing-domains/domain-lifecycle/introspection.md +++ b/docs-source/content/userguide/managing-domains/domain-lifecycle/introspection.md @@ -49,7 +49,6 @@ Beginning with operator 3.1.0, if a domain resource's `spec.introspectVersion` i ``` Name: domain1-admin-server Namespace: domain1-ns -Priority: 0 Labels: weblogic.createdByOperator=true weblogic.domainName=domain1 weblogic.domainUID=domain1 From af1ad2e17636538236d43e842eb2e66b3691b420 Mon Sep 17 00:00:00 2001 From: Dongbo Xiao Date: Tue, 27 Oct 2020 14:10:06 -0400 Subject: [PATCH 12/17] add domainRestartVersion to the example --- .../userguide/managing-domains/domain-lifecycle/introspection.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs-source/content/userguide/managing-domains/domain-lifecycle/introspection.md b/docs-source/content/userguide/managing-domains/domain-lifecycle/introspection.md index 8b973cdb25f..46d1af838ab 100644 --- a/docs-source/content/userguide/managing-domains/domain-lifecycle/introspection.md +++ b/docs-source/content/userguide/managing-domains/domain-lifecycle/introspection.md @@ -51,6 +51,7 @@ Name: domain1-admin-server Namespace: domain1-ns Labels: weblogic.createdByOperator=true weblogic.domainName=domain1 + weblogic.domainRestartVersion=abcdef weblogic.domainUID=domain1 weblogic.introspectVersion=12345 weblogic.serverName=admin-server From a6f05b94cc67ed4af38ce7b4df245dce7231c9bf Mon Sep 17 00:00:00 2001 From: Dongbo Xiao Date: Tue, 27 Oct 2020 14:17:27 -0400 Subject: [PATCH 13/17] move the patch part into the existing patch step and remove log messages --- .../operator/helpers/PodHelper.java | 10 --- .../operator/helpers/PodStepContext.java | 67 ++++++------------- .../operator/logging/MessageKeys.java | 4 +- .../src/main/resources/Operator.properties | 4 +- .../operator/helpers/AdminPodHelperTest.java | 7 -- .../helpers/ManagedPodHelperTest.java | 6 -- .../operator/helpers/PodHelperTestBase.java | 20 +++--- 7 files changed, 33 insertions(+), 85 deletions(-) diff --git a/operator/src/main/java/oracle/kubernetes/operator/helpers/PodHelper.java b/operator/src/main/java/oracle/kubernetes/operator/helpers/PodHelper.java index 751181bcaeb..3bb72dc34e8 100644 --- a/operator/src/main/java/oracle/kubernetes/operator/helpers/PodHelper.java +++ b/operator/src/main/java/oracle/kubernetes/operator/helpers/PodHelper.java @@ -305,11 +305,6 @@ String getPodPatchedMessageKey() { return MessageKeys.ADMIN_POD_PATCHED; } - @Override - String getPodUpdatedMessageKey() { - return MessageKeys.ADMIN_POD_UPDATED; - } - @Override String getPodReplacedMessageKey() { return MessageKeys.ADMIN_POD_REPLACED; @@ -460,11 +455,6 @@ String getPodPatchedMessageKey() { return MessageKeys.MANAGED_POD_PATCHED; } - @Override - String getPodUpdatedMessageKey() { - return MessageKeys.MANAGED_POD_UPDATED; - } - @Override protected String getPodReplacedMessageKey() { return MessageKeys.MANAGED_POD_REPLACED; diff --git a/operator/src/main/java/oracle/kubernetes/operator/helpers/PodStepContext.java b/operator/src/main/java/oracle/kubernetes/operator/helpers/PodStepContext.java index c2c952d89e3..539cfd11aae 100644 --- a/operator/src/main/java/oracle/kubernetes/operator/helpers/PodStepContext.java +++ b/operator/src/main/java/oracle/kubernetes/operator/helpers/PodStepContext.java @@ -361,27 +361,18 @@ protected Step patchPod(V1Pod currentPod, Step next) { KubernetesUtils.addPatches( patchBuilder, "/metadata/annotations/", getAnnotations(currentPod), getPodAnnotations()); - return new CallBuilder() - .patchPodAsync(getPodName(), getNamespace(), getDomainUid(), - new V1Patch(patchBuilder.build().toString()), patchResponse(next)); - } - - private Step updateCurrentPod(V1Pod currentPod, Step next) { - return createProgressingStep(updatePod(currentPod, next)); - } - - protected Step updatePod(V1Pod currentPod, Step next) { - JsonPatchBuilder patchBuilder = Json.createPatchBuilder(); - String pathName = "/metadata/labels/" + INTROSPECTION_STATE_LABEL; - if (!getPodLabels().containsKey(INTROSPECTION_STATE_LABEL)) { - patchBuilder.add(pathName, getDomain().getSpec().getIntrospectVersion()); - } else { - patchBuilder.replace(pathName, getDomain().getSpec().getIntrospectVersion()); + if (introspectVersionChanged(currentPod)) { + String pathName = "/metadata/labels/" + INTROSPECTION_STATE_LABEL; + if (!getPodLabels().containsKey(INTROSPECTION_STATE_LABEL)) { + patchBuilder.add(pathName, getDomain().getSpec().getIntrospectVersion()); + } else { + patchBuilder.replace(pathName, getDomain().getSpec().getIntrospectVersion()); + } } return new CallBuilder() - .patchPodAsync(getPodName(), getNamespace(), getDomainUid(), - new V1Patch(patchBuilder.build().toString()), updateResponse(next)); + .patchPodAsync(getPodName(), getNamespace(), getDomainUid(), + new V1Patch(patchBuilder.build().toString()), patchResponse(next)); } private Map getLabels(V1Pod pod) { @@ -404,10 +395,6 @@ private void logPodPatched() { LOGGER.info(getPodPatchedMessageKey(), getDomainUid(), getServerName()); } - private void logPodUpdated() { - LOGGER.info(getPodUpdatedMessageKey(), getDomainUid(), getServerName(), getDomain().getIntrospectVersion()); - } - private void logPodReplaced() { LOGGER.info(getPodReplacedMessageKey(), getDomainUid(), getServerName()); } @@ -418,8 +405,6 @@ private void logPodReplaced() { abstract String getPodPatchedMessageKey(); - abstract String getPodUpdatedMessageKey(); - abstract String getPodReplacedMessageKey(); Step createCyclePodStep(Step next) { @@ -428,7 +413,19 @@ Step createCyclePodStep(Step next) { private boolean mustPatchPod(V1Pod currentPod) { return KubernetesUtils.isMissingValues(getLabels(currentPod), getPodLabels()) - || KubernetesUtils.isMissingValues(getAnnotations(currentPod), getPodAnnotations()); + || KubernetesUtils.isMissingValues(getAnnotations(currentPod), getPodAnnotations()) + || introspectVersionChanged(currentPod); + } + + private boolean introspectVersionChanged(V1Pod currentPod) { + return !Objects.equals(getPodIntrospectVersionLabel(currentPod), getDomain().getSpec().getIntrospectVersion()); + } + + private Object getPodIntrospectVersionLabel(V1Pod pod) { + return Optional.ofNullable(pod.getMetadata()) + .map(V1ObjectMeta::getLabels) + .map(labels -> labels.get(INTROSPECTION_STATE_LABEL)) + .orElse(null); } private boolean canUseCurrentPod(V1Pod currentPod) { @@ -465,10 +462,6 @@ private ResponseStep patchResponse(Step next) { return new PatchPodResponseStep(next); } - private ResponseStep updateResponse(Step next) { - return new UpdatePodResponseStep(next); - } - V1Pod createPodModel() { return withNonHashedElements(AnnotationHelper.withSha256Hash(createPodRecipe())); } @@ -879,9 +872,6 @@ public NextAction apply(Packet packet) { } else if (mustPatchPod(currentPod)) { return doNext(patchCurrentPod(currentPod, getNext()), packet); } else { - if (introspectVersionChanged(currentPod)) { - return doNext(updateCurrentPod(currentPod, getNext()), packet); - } logPodExists(); return doNext(packet); } @@ -1015,17 +1005,4 @@ protected V1Pod processResponse(CallResponse callResponse) { return newPod; } } - - private class UpdatePodResponseStep extends PatchPodResponseStep { - - UpdatePodResponseStep(Step next) { - super(next); - } - - @Override - public void logPodChanged() { - logPodUpdated(); - } - } - } diff --git a/operator/src/main/java/oracle/kubernetes/operator/logging/MessageKeys.java b/operator/src/main/java/oracle/kubernetes/operator/logging/MessageKeys.java index 170f0c45255..26e81545b6e 100644 --- a/operator/src/main/java/oracle/kubernetes/operator/logging/MessageKeys.java +++ b/operator/src/main/java/oracle/kubernetes/operator/logging/MessageKeys.java @@ -133,9 +133,7 @@ public class MessageKeys { public static final String INTROSPECTOR_JOB_FAILED = "WLSKO-0175"; public static final String INTROSPECTOR_JOB_FAILED_DETAIL = "WLSKO-0176"; public static final String INTROSPECTOR_POD_FAILED = "WLSKO-0177"; - public static final String ADMIN_POD_UPDATED = "WLSKO-0178"; - public static final String MANAGED_POD_UPDATED = "WLSKO-0179"; - public static final String CRD_NOT_INSTALLED = "WLSKO-0180"; + public static final String CRD_NOT_INSTALLED = "WLSKO-0178"; // domain status messages public static final String DUPLICATE_SERVER_NAME_FOUND = "WLSDO-0001"; diff --git a/operator/src/main/resources/Operator.properties b/operator/src/main/resources/Operator.properties index f30dc3a9d4b..4fe1edc2168 100644 --- a/operator/src/main/resources/Operator.properties +++ b/operator/src/main/resources/Operator.properties @@ -187,9 +187,7 @@ WLSKO-0175=Job {0} in namespace {1} failed with status {2}. Check log messages \ copied from the introspector pod {3} log for additional information. WLSKO-0176=Job {1} in namespace {0} failed, job details are {2} WLSKO-0177=Pod {0} in namespace {1} failed, the pod status is {2} -WLSKO-0178=Patching administration server Pod labels with ''weblogic.introspectVersion'' {2} for WebLogic domain with UID: {0}. Administration server name: {1}. -WLSKO-0179=Patching managed server Pod labels with ''weblogic.introspectVersion'' {2} for WebLogic domain with UID: {0}. Managed server name: {1}. -WLSKO-0180=Operator cannot start. Operator 'domainNamespaceSelectionStrategy' is set to 'Dedicated', but the Custom Resource Definition for ''domains.weblogic.oracle'' is not installed. +WLSKO-0178=Operator cannot start. Operator 'domainNamespaceSelectionStrategy' is set to 'Dedicated', but the Custom Resource Definition for ''domains.weblogic.oracle'' is not installed. # Domain status messages diff --git a/operator/src/test/java/oracle/kubernetes/operator/helpers/AdminPodHelperTest.java b/operator/src/test/java/oracle/kubernetes/operator/helpers/AdminPodHelperTest.java index abec921d14e..0d245127e21 100644 --- a/operator/src/test/java/oracle/kubernetes/operator/helpers/AdminPodHelperTest.java +++ b/operator/src/test/java/oracle/kubernetes/operator/helpers/AdminPodHelperTest.java @@ -37,7 +37,6 @@ import static oracle.kubernetes.operator.logging.MessageKeys.ADMIN_POD_EXISTS; import static oracle.kubernetes.operator.logging.MessageKeys.ADMIN_POD_PATCHED; import static oracle.kubernetes.operator.logging.MessageKeys.ADMIN_POD_REPLACED; -import static oracle.kubernetes.operator.logging.MessageKeys.ADMIN_POD_UPDATED; import static oracle.kubernetes.operator.logging.MessageKeys.DOMAIN_VALIDATION_FAILED; import static oracle.kubernetes.utils.LogMatcher.containsFine; import static oracle.kubernetes.utils.LogMatcher.containsInfo; @@ -101,12 +100,6 @@ String getReplacedMessageKey() { return ADMIN_POD_REPLACED; } - @Override - String getUpdatedMessageKey() { - return ADMIN_POD_UPDATED; - } - - @Override void setServerPort(int port) { getServerTopology().setAdminPort(port); diff --git a/operator/src/test/java/oracle/kubernetes/operator/helpers/ManagedPodHelperTest.java b/operator/src/test/java/oracle/kubernetes/operator/helpers/ManagedPodHelperTest.java index 3af98dcb801..ff434ddbaca 100644 --- a/operator/src/test/java/oracle/kubernetes/operator/helpers/ManagedPodHelperTest.java +++ b/operator/src/test/java/oracle/kubernetes/operator/helpers/ManagedPodHelperTest.java @@ -46,7 +46,6 @@ import static oracle.kubernetes.operator.logging.MessageKeys.MANAGED_POD_EXISTS; import static oracle.kubernetes.operator.logging.MessageKeys.MANAGED_POD_PATCHED; import static oracle.kubernetes.operator.logging.MessageKeys.MANAGED_POD_REPLACED; -import static oracle.kubernetes.operator.logging.MessageKeys.MANAGED_POD_UPDATED; import static oracle.kubernetes.utils.LogMatcher.containsFine; import static oracle.kubernetes.utils.LogMatcher.containsInfo; import static oracle.kubernetes.utils.LogMatcher.containsSevere; @@ -104,11 +103,6 @@ String getReplacedMessageKey() { return MANAGED_POD_REPLACED; } - @Override - String getUpdatedMessageKey() { - return MANAGED_POD_UPDATED; - } - @Override String getDomainValidationFailedKey() { return DOMAIN_VALIDATION_FAILED; diff --git a/operator/src/test/java/oracle/kubernetes/operator/helpers/PodHelperTestBase.java b/operator/src/test/java/oracle/kubernetes/operator/helpers/PodHelperTestBase.java index b5b0c4ebb8f..a9c6dd7911d 100644 --- a/operator/src/test/java/oracle/kubernetes/operator/helpers/PodHelperTestBase.java +++ b/operator/src/test/java/oracle/kubernetes/operator/helpers/PodHelperTestBase.java @@ -241,7 +241,6 @@ private String[] getMessageKeys() { getExistsMessageKey(), getPatchedMessageKey(), getReplacedMessageKey(), - getUpdatedMessageKey(), getDomainValidationFailedKey() }; } @@ -548,23 +547,24 @@ public void whenPodCreationFailsDueToQuotaExceeded_abortFiber() { // todo set property to indicate dynamic/on_restart copying protected abstract void verifyPodReplaced(); - protected void verifyPodUpdated() { + protected void verifyPodPatched() { testSupport.runSteps(getStepFactory(), terminalStep); assertThat(logRecords, not(containsFine(getExistsMessageKey()))); - assertThat(logRecords, containsInfo(getUpdatedMessageKey())); + assertThat(logRecords, containsInfo(getPatchedMessageKey())); } - protected void verifyPodNotUpdated() { + protected void verifyPodNotPatched() { testSupport.runSteps(getStepFactory(), terminalStep); assertThat(logRecords, containsFine(getExistsMessageKey())); - assertThat(logRecords, not(containsInfo(getUpdatedMessageKey()))); + assertThat(logRecords, not(containsInfo(getPatchedMessageKey()))); } protected void verifyPodNotReplaced() { testSupport.runSteps(getStepFactory(), terminalStep); + assertThat(logRecords, not(containsInfo(getReplacedMessageKey()))); assertThat(logRecords, containsFine(getExistsMessageKey())); } @@ -969,21 +969,21 @@ public void whenServerConfigurationAddsRestartVersion_replacePod() { } @Test - public void whenServerConfigurationAddsIntrospectionVersion_updatePod() { + public void whenServerConfigurationAddsIntrospectionVersion_patchPod() { initializeExistingPod(); configurator.withIntrospectVersion("123"); - verifyPodUpdated(); + verifyPodPatched(); } @Test - public void whenServerConfigurationIntrospectionVersionTheSame_dontUpdatePod() { + public void whenServerConfigurationIntrospectionVersionTheSame_dontPatchPod() { initializeExistingPodWithIntrospectVersion("123"); configurator.withIntrospectVersion("123"); - verifyPodNotUpdated(); + verifyPodNotPatched(); } @Test @@ -1052,8 +1052,6 @@ public void whenCompliantPodExists_logIt() { abstract String getReplacedMessageKey(); - abstract String getUpdatedMessageKey(); - abstract String getDomainValidationFailedKey(); abstract V1Pod createTestPodModel(); From d5516e66c657461d7035a231453c31fb4bb8fb06 Mon Sep 17 00:00:00 2001 From: Dongbo Xiao Date: Tue, 27 Oct 2020 14:23:22 -0400 Subject: [PATCH 14/17] minor doc edit --- .../content/userguide/managing-domains/domain-resource.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs-source/content/userguide/managing-domains/domain-resource.md b/docs-source/content/userguide/managing-domains/domain-resource.md index 4734ce0aa2d..f2b5b3c4867 100644 --- a/docs-source/content/userguide/managing-domains/domain-resource.md +++ b/docs-source/content/userguide/managing-domains/domain-resource.md @@ -161,7 +161,7 @@ Elements related to domain [startup and shutdown]({{< relref "/userguide/managin * `replicas`: The default number of cluster member Managed Server instances to start for each WebLogic cluster in the domain configuration, unless `replicas` is specified for that cluster under the `clusters` field. For each cluster, the operator will sort cluster member Managed Server names from the WebLogic domain configuration by normalizing any numbers in the Managed Server name and then sorting alphabetically. This is done so that server names such as "managed-server10" come after "managed-server9". The operator will then start Managed Servers from the sorted list, up to the `replicas` count, unless specific Managed Servers are specified as starting in their entry under the `managedServers` field. In that case, the specified Managed Servers will be started and then additional cluster members will be started, up to the `replicas` count, by finding further cluster members in the sorted list that are not already started. If cluster members are started because of their entries under `managedServers`, then a cluster may have more cluster members running than its `replicas` count. Defaults to 0. * `maxClusterConcurrentStartup`: The maximum number of cluster member Managed Server instances that the operator will start in parallel for a given cluster, if `maxConcurrentStartup` is not specified for a specific cluster under the `clusters` field. A value of 0 means there is no configured limit. Defaults to 0. * `allowReplicasBelowMinDynClusterSize`: Whether to allow the number of running cluster member Managed Server instances to drop below the minimum dynamic cluster size configured in the WebLogic domain configuration, if this is not specified for a specific cluster under the `clusters` field. Defaults to true. -* `introspectVersion`: Changes to this field cause the operator to repeat its introspection of the WebLogic domain configuration (see [initiating introspection]({{< relref "/userguide/managing-domains/domain-lifecycle/introspection/_index.md#initiating-introspection" >}})). Repeating introspection is required for the operator to recognize changes to the domain configuration, such as adding a new WebLogic cluster or Managed Server instance, to regenerate configuration overrides, or to regenerate the WebLogic domain home when the `domainHomeSourceType` is FromModel. Introspection occurs automatically, without requiring change to this field, when servers are first started or restarted after a full domain shut down. For the FromModel `domainHomeSourceType`, introspection also occurs when a running server must be restarted because of changes to any of the fields [listed here]({{< relref "/userguide/managing-domains/domain-lifecycle/startup#fields-that-cause-servers-to-be-restarted" >}}). See also `overrideDistributionStrategy`. +* `introspectVersion`: Changes to this field cause the operator to repeat its introspection of the WebLogic domain configuration (see [Initiating introspection]({{< relref "/userguide/managing-domains/domain-lifecycle/introspection/_index.md#initiating-introspection" >}})). Repeating introspection is required for the operator to recognize changes to the domain configuration, such as adding a new WebLogic cluster or Managed Server instance, to regenerate configuration overrides, or to regenerate the WebLogic domain home when the `domainHomeSourceType` is FromModel. Introspection occurs automatically, without requiring change to this field, when servers are first started or restarted after a full domain shut down. For the FromModel `domainHomeSourceType`, introspection also occurs when a running server must be restarted because of changes to any of the fields [listed here]({{< relref "/userguide/managing-domains/domain-lifecycle/startup#fields-that-cause-servers-to-be-restarted" >}}). See also `overrideDistributionStrategy`. Elements related to specifying and overriding WebLogic domain configuration: From f1d316c38a23d755aa6fc0d09ae629d4b3f6aa34 Mon Sep 17 00:00:00 2001 From: Dongbo Xiao Date: Tue, 27 Oct 2020 16:41:15 -0400 Subject: [PATCH 15/17] refactored a little --- .../operator/helpers/PodStepContext.java | 65 +++++++------------ 1 file changed, 22 insertions(+), 43 deletions(-) diff --git a/operator/src/main/java/oracle/kubernetes/operator/helpers/PodStepContext.java b/operator/src/main/java/oracle/kubernetes/operator/helpers/PodStepContext.java index 539cfd11aae..144ed80ce37 100644 --- a/operator/src/main/java/oracle/kubernetes/operator/helpers/PodStepContext.java +++ b/operator/src/main/java/oracle/kubernetes/operator/helpers/PodStepContext.java @@ -7,6 +7,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; @@ -88,6 +89,10 @@ public abstract class PodStepContext extends BasePodStepContext { scan = (WlsServerConfig) packet.get(ProcessingConstants.SERVER_SCAN); } + private static boolean isPatchableItem(Map.Entry entry) { + return isCustomerItem(entry) || entry.getKey().equals(INTROSPECTION_STATE_LABEL); + } + private static boolean isCustomerItem(Map.Entry entry) { return !entry.getKey().startsWith("weblogic."); } @@ -357,24 +362,24 @@ protected Step patchPod(V1Pod currentPod, Step next) { JsonPatchBuilder patchBuilder = Json.createPatchBuilder(); KubernetesUtils.addPatches( - patchBuilder, "/metadata/labels/", getLabels(currentPod), getPodLabels()); + patchBuilder, "/metadata/labels/", getLabels(currentPod), getNonHashedPodLabels()); KubernetesUtils.addPatches( patchBuilder, "/metadata/annotations/", getAnnotations(currentPod), getPodAnnotations()); - if (introspectVersionChanged(currentPod)) { - String pathName = "/metadata/labels/" + INTROSPECTION_STATE_LABEL; - if (!getPodLabels().containsKey(INTROSPECTION_STATE_LABEL)) { - patchBuilder.add(pathName, getDomain().getSpec().getIntrospectVersion()); - } else { - patchBuilder.replace(pathName, getDomain().getSpec().getIntrospectVersion()); - } - } - return new CallBuilder() .patchPodAsync(getPodName(), getNamespace(), getDomainUid(), new V1Patch(patchBuilder.build().toString()), patchResponse(next)); } + private Map getNonHashedPodLabels() { + Map result = new HashMap<>(getPodLabels()); + + Optional.ofNullable(getDomain().getSpec().getIntrospectVersion()) + .ifPresent(version -> result.put(INTROSPECTION_STATE_LABEL, version)); + + return result; + } + private Map getLabels(V1Pod pod) { return Optional.ofNullable(pod.getMetadata()).map(V1ObjectMeta::getLabels).orElseGet(Collections::emptyMap); } @@ -412,20 +417,8 @@ Step createCyclePodStep(Step next) { } private boolean mustPatchPod(V1Pod currentPod) { - return KubernetesUtils.isMissingValues(getLabels(currentPod), getPodLabels()) - || KubernetesUtils.isMissingValues(getAnnotations(currentPod), getPodAnnotations()) - || introspectVersionChanged(currentPod); - } - - private boolean introspectVersionChanged(V1Pod currentPod) { - return !Objects.equals(getPodIntrospectVersionLabel(currentPod), getDomain().getSpec().getIntrospectVersion()); - } - - private Object getPodIntrospectVersionLabel(V1Pod pod) { - return Optional.ofNullable(pod.getMetadata()) - .map(V1ObjectMeta::getLabels) - .map(labels -> labels.get(INTROSPECTION_STATE_LABEL)) - .orElse(null); + return KubernetesUtils.isMissingValues(getLabels(currentPod), getNonHashedPodLabels()) + || KubernetesUtils.isMissingValues(getAnnotations(currentPod), getPodAnnotations()); } private boolean canUseCurrentPod(V1Pod currentPod) { @@ -478,16 +471,13 @@ protected Map augmentSubVars(Map vars) { V1Pod withNonHashedElements(V1Pod pod) { V1ObjectMeta metadata = Objects.requireNonNull(pod.getMetadata()); // Adds labels and annotations to a pod, skipping any whose names begin with "weblogic." - getPodLabels().entrySet().stream() - .filter(PodStepContext::isCustomerItem) + getNonHashedPodLabels().entrySet().stream() + .filter(PodStepContext::isPatchableItem) .forEach(e -> metadata.putLabelsItem(e.getKey(), e.getValue())); getPodAnnotations().entrySet().stream() - .filter(PodStepContext::isCustomerItem) + .filter(PodStepContext::isPatchableItem) .forEach(e -> metadata.putAnnotationsItem(e.getKey(), e.getValue())); - Optional.ofNullable(getDomain().getSpec().getIntrospectVersion()) - .ifPresent(version -> metadata.putLabelsItem(INTROSPECTION_STATE_LABEL, version)); - setTerminationGracePeriod(pod); getContainer(pod).map(V1Container::getEnv).ifPresent(this::updateEnv); @@ -557,7 +547,7 @@ protected V1ObjectMeta createMetadata() { + getServerSpec().getDomainRestartVersion()); LOGGER.finest("PodStepContext.createMetaData domainIntrospectVersion from spec " + getDomain().getIntrospectVersion()); - + metadata .putLabelsItem(LabelConstants.DOMAINUID_LABEL, getDomainUid()) .putLabelsItem(LabelConstants.DOMAINNAME_LABEL, getDomainName()) @@ -855,7 +845,7 @@ public NextAction apply(Packet packet) { V1Pod currentPod = info.getServerPod(getServerName()); // reset introspect failure job count - if any - + Optional.ofNullable(packet.getSpi(DomainPresenceInfo.class)) .map(DomainPresenceInfo::getDomain) .map(Domain::getStatus) @@ -876,17 +866,6 @@ public NextAction apply(Packet packet) { return doNext(packet); } } - - private boolean introspectVersionChanged(V1Pod currentPod) { - return !Objects.equals(getPodIntrospectVersionLabel(currentPod), getDomain().getSpec().getIntrospectVersion()); - } - - private Object getPodIntrospectVersionLabel(V1Pod pod) { - return Optional.ofNullable(pod.getMetadata()) - .map(V1ObjectMeta::getLabels) - .map(labels -> labels.get(INTROSPECTION_STATE_LABEL)) - .orElse(null); - } } private abstract class BaseResponseStep extends ResponseStep { From ca7d8c0b3f9423e08945469b4e675d8af11be05b Mon Sep 17 00:00:00 2001 From: Ryan Eberhard Date: Tue, 27 Oct 2020 17:25:38 -0400 Subject: [PATCH 16/17] Correct overrideDistributionStrategy other places --- docs/domains/Domain.json | 2 +- docs/domains/Domain.md | 2 +- docs/domains/index.html | 2 +- kubernetes/crd/domain-crd.yaml | 2 +- kubernetes/crd/domain-v1beta1-crd.yaml | 2 +- .../oracle/kubernetes/weblogic/domain/model/DomainSpec.java | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/domains/Domain.json b/docs/domains/Domain.json index 7b5ca4339b8..b42f936bf3a 100644 --- a/docs/domains/Domain.json +++ b/docs/domains/Domain.json @@ -383,7 +383,7 @@ "type": "string" }, "introspectVersion": { - "description": "Changes to this field cause the operator to repeat its introspection of the WebLogic domain configuration. Repeating introspection is required for the operator to recognize changes to the domain configuration, such as adding a new WebLogic cluster or Managed Server instance, to regenerate configuration overrides, or to regenerate the WebLogic domain home when the `domainHomeSourceType` is FromModel. Introspection occurs automatically, without requiring change to this field, when servers are first started or restarted after a full domain shut down. For the FromModel `domainHomeSourceType`, introspection also occurs when a running server must be restarted because of changes to any of the fields listed here: https://oracle.github.io/weblogic-kubernetes-operator/userguide/managing-domains/domain-lifecycle/startup/#properties-that-cause-servers-to-be-restarted. See also `domains.spec.configuration.overridesConfigurationStrategy`.", + "description": "Changes to this field cause the operator to repeat its introspection of the WebLogic domain configuration. Repeating introspection is required for the operator to recognize changes to the domain configuration, such as adding a new WebLogic cluster or Managed Server instance, to regenerate configuration overrides, or to regenerate the WebLogic domain home when the `domainHomeSourceType` is FromModel. Introspection occurs automatically, without requiring change to this field, when servers are first started or restarted after a full domain shut down. For the FromModel `domainHomeSourceType`, introspection also occurs when a running server must be restarted because of changes to any of the fields listed here: https://oracle.github.io/weblogic-kubernetes-operator/userguide/managing-domains/domain-lifecycle/startup/#properties-that-cause-servers-to-be-restarted. See also `domains.spec.configuration.overrideDistributionStrategy`.", "type": "string" }, "dataHome": { diff --git a/docs/domains/Domain.md b/docs/domains/Domain.md index 796bd879f70..c29895b004a 100644 --- a/docs/domains/Domain.md +++ b/docs/domains/Domain.md @@ -30,7 +30,7 @@ The specification of the operation of the WebLogic domain. Required. | `imagePullPolicy` | string | The image pull policy for the WebLogic container image. Legal values are Always, Never, and IfNotPresent. Defaults to Always if image ends in :latest; IfNotPresent, otherwise. | | `imagePullSecrets` | array of [Local Object Reference](k8s1.13.5.md#local-object-reference) | A list of image pull Secrets for the WebLogic container image. | | `includeServerOutInPodLog` | Boolean | Specifies whether the server .out file will be included in the Pod's log. Defaults to true. | -| `introspectVersion` | string | Changes to this field cause the operator to repeat its introspection of the WebLogic domain configuration. Repeating introspection is required for the operator to recognize changes to the domain configuration, such as adding a new WebLogic cluster or Managed Server instance, to regenerate configuration overrides, or to regenerate the WebLogic domain home when the `domainHomeSourceType` is FromModel. Introspection occurs automatically, without requiring change to this field, when servers are first started or restarted after a full domain shut down. For the FromModel `domainHomeSourceType`, introspection also occurs when a running server must be restarted because of changes to any of the fields listed here: https://oracle.github.io/weblogic-kubernetes-operator/userguide/managing-domains/domain-lifecycle/startup/#properties-that-cause-servers-to-be-restarted. See also `domains.spec.configuration.overridesConfigurationStrategy`. | +| `introspectVersion` | string | Changes to this field cause the operator to repeat its introspection of the WebLogic domain configuration. Repeating introspection is required for the operator to recognize changes to the domain configuration, such as adding a new WebLogic cluster or Managed Server instance, to regenerate configuration overrides, or to regenerate the WebLogic domain home when the `domainHomeSourceType` is FromModel. Introspection occurs automatically, without requiring change to this field, when servers are first started or restarted after a full domain shut down. For the FromModel `domainHomeSourceType`, introspection also occurs when a running server must be restarted because of changes to any of the fields listed here: https://oracle.github.io/weblogic-kubernetes-operator/userguide/managing-domains/domain-lifecycle/startup/#properties-that-cause-servers-to-be-restarted. See also `domains.spec.configuration.overrideDistributionStrategy`. | | `logHome` | string | The directory in a server's container in which to store the domain, Node Manager, server logs, server *.out, introspector .out, and optionally HTTP access log files if `httpAccessLogInLogHome` is true. Ignored if `logHomeEnabled` is false. | | `logHomeEnabled` | Boolean | Specifies whether the log home folder is enabled. Defaults to true if `domainHomeSourceType` is PersistentVolume; false, otherwise. | | `managedServers` | array of [Managed Server](#managed-server) | Lifecycle options for individual Managed Servers, including Java options, environment variables, additional Pod content, and the ability to explicitly start, stop, or restart a named server instance. The `serverName` field of each entry must match a Managed Server that already exists in the WebLogic domain configuration or that matches a dynamic cluster member based on the server template. | diff --git a/docs/domains/index.html b/docs/domains/index.html index 77d6c54fce3..17ad086cd98 100644 --- a/docs/domains/index.html +++ b/docs/domains/index.html @@ -1304,7 +1304,7 @@ "type": "string" }, "introspectVersion": { - "description": "Changes to this field cause the operator to repeat its introspection of the WebLogic domain configuration. Repeating introspection is required for the operator to recognize changes to the domain configuration, such as adding a new WebLogic cluster or Managed Server instance, to regenerate configuration overrides, or to regenerate the WebLogic domain home when the `domainHomeSourceType` is FromModel. Introspection occurs automatically, without requiring change to this field, when servers are first started or restarted after a full domain shut down. For the FromModel `domainHomeSourceType`, introspection also occurs when a running server must be restarted because of changes to any of the fields listed here: https://oracle.github.io/weblogic-kubernetes-operator/userguide/managing-domains/domain-lifecycle/startup/#properties-that-cause-servers-to-be-restarted. See also `domains.spec.configuration.overridesConfigurationStrategy`.", + "description": "Changes to this field cause the operator to repeat its introspection of the WebLogic domain configuration. Repeating introspection is required for the operator to recognize changes to the domain configuration, such as adding a new WebLogic cluster or Managed Server instance, to regenerate configuration overrides, or to regenerate the WebLogic domain home when the `domainHomeSourceType` is FromModel. Introspection occurs automatically, without requiring change to this field, when servers are first started or restarted after a full domain shut down. For the FromModel `domainHomeSourceType`, introspection also occurs when a running server must be restarted because of changes to any of the fields listed here: https://oracle.github.io/weblogic-kubernetes-operator/userguide/managing-domains/domain-lifecycle/startup/#properties-that-cause-servers-to-be-restarted. See also `domains.spec.configuration.overrideDistributionStrategy`.", "type": "string" }, "dataHome": { diff --git a/kubernetes/crd/domain-crd.yaml b/kubernetes/crd/domain-crd.yaml index ce500aeb9a2..2fca37506d4 100644 --- a/kubernetes/crd/domain-crd.yaml +++ b/kubernetes/crd/domain-crd.yaml @@ -5253,7 +5253,7 @@ spec: full domain shut down. For the FromModel `domainHomeSourceType`, introspection also occurs when a running server must be restarted because of changes to any of the fields listed here: https://oracle.github.io/weblogic-kubernetes-operator/userguide/managing-domains/domain-lifecycle/startup/#properties-that-cause-servers-to-be-restarted. - See also `domains.spec.configuration.overridesConfigurationStrategy`.' + See also `domains.spec.configuration.overrideDistributionStrategy`.' dataHome: type: string description: An optional directory in a server's container for data diff --git a/kubernetes/crd/domain-v1beta1-crd.yaml b/kubernetes/crd/domain-v1beta1-crd.yaml index 42b5b007799..21079500ebb 100644 --- a/kubernetes/crd/domain-v1beta1-crd.yaml +++ b/kubernetes/crd/domain-v1beta1-crd.yaml @@ -5238,7 +5238,7 @@ spec: For the FromModel `domainHomeSourceType`, introspection also occurs when a running server must be restarted because of changes to any of the fields listed here: https://oracle.github.io/weblogic-kubernetes-operator/userguide/managing-domains/domain-lifecycle/startup/#properties-that-cause-servers-to-be-restarted. - See also `domains.spec.configuration.overridesConfigurationStrategy`.' + See also `domains.spec.configuration.overrideDistributionStrategy`.' dataHome: type: string description: An optional directory in a server's container for data diff --git a/operator/src/main/java/oracle/kubernetes/weblogic/domain/model/DomainSpec.java b/operator/src/main/java/oracle/kubernetes/weblogic/domain/model/DomainSpec.java index cc1e660ce44..a77dd860961 100644 --- a/operator/src/main/java/oracle/kubernetes/weblogic/domain/model/DomainSpec.java +++ b/operator/src/main/java/oracle/kubernetes/weblogic/domain/model/DomainSpec.java @@ -256,7 +256,7 @@ public class DomainSpec extends BaseConfiguration { + "server must be restarted because of changes to any of the fields listed here: " + "https://oracle.github.io/weblogic-kubernetes-operator/userguide/managing-domains/" + "domain-lifecycle/startup/#properties-that-cause-servers-to-be-restarted. " - + "See also `domains.spec.configuration.overridesConfigurationStrategy`.") + + "See also `domains.spec.configuration.overrideDistributionStrategy`.") private String introspectVersion; @Description("Models and overrides affecting the WebLogic domain configuration.") From e2bd8fa7ae7945988679e445d6b283089bd2fd46 Mon Sep 17 00:00:00 2001 From: Ryan Eberhard Date: Tue, 27 Oct 2020 17:40:17 -0400 Subject: [PATCH 17/17] Add correct the other misspelled field name --- docs/domains/Domain.json | 2 +- docs/domains/Domain.md | 2 +- docs/domains/index.html | 2 +- kubernetes/crd/domain-crd.yaml | 2 +- kubernetes/crd/domain-v1beta1-crd.yaml | 2 +- .../weblogic/domain/model/Configuration.java | 12 ++++++------ 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/docs/domains/Domain.json b/docs/domains/Domain.json index b42f936bf3a..94b49c95e3b 100644 --- a/docs/domains/Domain.json +++ b/docs/domains/Domain.json @@ -182,7 +182,7 @@ "type": "object", "properties": { "overrideDistributionStrategy": { - "description": "Determines how updated configuration overrides are distributed to already running WebLogic Server instances following introspection when the `domainHomeSourceType` is PersistentVolume or Image. Configuration overrides are generated during introspection from Secrets, the `overrideConfigMap` field, and WebLogic domain topology. Legal values are DYNAMIC, which means that the operator will distribute updated configuration overrides dynamically to running servers, and ON_RESTART, which means that servers will use updated configuration overrides only after the server\u0027s next restart. The selection of ON_RESTART will not cause servers to restart when there are updated configuration overrides available. See also `domains.spec.introspectVersion`. Defaults to DYNAMIC.", + "description": "Determines how updated configuration overrides are distributed to already running WebLogic Server instances following introspection when the `domainHomeSourceType` is PersistentVolume or Image. Configuration overrides are generated during introspection from Secrets, the `overridesConfigMap` field, and WebLogic domain topology. Legal values are DYNAMIC, which means that the operator will distribute updated configuration overrides dynamically to running servers, and ON_RESTART, which means that servers will use updated configuration overrides only after the server\u0027s next restart. The selection of ON_RESTART will not cause servers to restart when there are updated configuration overrides available. See also `domains.spec.introspectVersion`. Defaults to DYNAMIC.", "type": "string", "enum": [ "DYNAMIC", diff --git a/docs/domains/Domain.md b/docs/domains/Domain.md index c29895b004a..d6e703f0a82 100644 --- a/docs/domains/Domain.md +++ b/docs/domains/Domain.md @@ -95,7 +95,7 @@ The current status of the operation of the WebLogic domain. Updated automaticall | `istio` | [Istio](#istio) | The Istio service mesh integration settings. | | `model` | [Model](#model) | Model in image model files and properties. | | `opss` | [Opss](#opss) | Settings for OPSS security. | -| `overrideDistributionStrategy` | string | Determines how updated configuration overrides are distributed to already running WebLogic Server instances following introspection when the `domainHomeSourceType` is PersistentVolume or Image. Configuration overrides are generated during introspection from Secrets, the `overrideConfigMap` field, and WebLogic domain topology. Legal values are DYNAMIC, which means that the operator will distribute updated configuration overrides dynamically to running servers, and ON_RESTART, which means that servers will use updated configuration overrides only after the server's next restart. The selection of ON_RESTART will not cause servers to restart when there are updated configuration overrides available. See also `domains.spec.introspectVersion`. Defaults to DYNAMIC. | +| `overrideDistributionStrategy` | string | Determines how updated configuration overrides are distributed to already running WebLogic Server instances following introspection when the `domainHomeSourceType` is PersistentVolume or Image. Configuration overrides are generated during introspection from Secrets, the `overridesConfigMap` field, and WebLogic domain topology. Legal values are DYNAMIC, which means that the operator will distribute updated configuration overrides dynamically to running servers, and ON_RESTART, which means that servers will use updated configuration overrides only after the server's next restart. The selection of ON_RESTART will not cause servers to restart when there are updated configuration overrides available. See also `domains.spec.introspectVersion`. Defaults to DYNAMIC. | | `overridesConfigMap` | string | The name of the ConfigMap for WebLogic configuration overrides. If this field is specified, then the value of `spec.configOverrides` is ignored. | | `secrets` | array of string | A list of names of the Secrets for WebLogic configuration overrides or model. If this field is specified, then the value of `spec.configOverrideSecrets` is ignored. | diff --git a/docs/domains/index.html b/docs/domains/index.html index 17ad086cd98..f4f53269507 100644 --- a/docs/domains/index.html +++ b/docs/domains/index.html @@ -1103,7 +1103,7 @@ "type": "object", "properties": { "overrideDistributionStrategy": { - "description": "Determines how updated configuration overrides are distributed to already running WebLogic Server instances following introspection when the `domainHomeSourceType` is PersistentVolume or Image. Configuration overrides are generated during introspection from Secrets, the `overrideConfigMap` field, and WebLogic domain topology. Legal values are DYNAMIC, which means that the operator will distribute updated configuration overrides dynamically to running servers, and ON_RESTART, which means that servers will use updated configuration overrides only after the server\u0027s next restart. The selection of ON_RESTART will not cause servers to restart when there are updated configuration overrides available. See also `domains.spec.introspectVersion`. Defaults to DYNAMIC.", + "description": "Determines how updated configuration overrides are distributed to already running WebLogic Server instances following introspection when the `domainHomeSourceType` is PersistentVolume or Image. Configuration overrides are generated during introspection from Secrets, the `overridesConfigMap` field, and WebLogic domain topology. Legal values are DYNAMIC, which means that the operator will distribute updated configuration overrides dynamically to running servers, and ON_RESTART, which means that servers will use updated configuration overrides only after the server\u0027s next restart. The selection of ON_RESTART will not cause servers to restart when there are updated configuration overrides available. See also `domains.spec.introspectVersion`. Defaults to DYNAMIC.", "type": "string", "enum": [ "DYNAMIC", diff --git a/kubernetes/crd/domain-crd.yaml b/kubernetes/crd/domain-crd.yaml index 2fca37506d4..b028f5fd264 100644 --- a/kubernetes/crd/domain-crd.yaml +++ b/kubernetes/crd/domain-crd.yaml @@ -36,7 +36,7 @@ spec: distributed to already running WebLogic Server instances following introspection when the `domainHomeSourceType` is PersistentVolume or Image. Configuration overrides are generated during introspection - from Secrets, the `overrideConfigMap` field, and WebLogic domain + from Secrets, the `overridesConfigMap` field, and WebLogic domain topology. Legal values are DYNAMIC, which means that the operator will distribute updated configuration overrides dynamically to running servers, and ON_RESTART, which means that servers diff --git a/kubernetes/crd/domain-v1beta1-crd.yaml b/kubernetes/crd/domain-v1beta1-crd.yaml index 21079500ebb..eef26db2252 100644 --- a/kubernetes/crd/domain-v1beta1-crd.yaml +++ b/kubernetes/crd/domain-v1beta1-crd.yaml @@ -39,7 +39,7 @@ spec: distributed to already running WebLogic Server instances following introspection when the `domainHomeSourceType` is PersistentVolume or Image. Configuration overrides are generated during introspection - from Secrets, the `overrideConfigMap` field, and WebLogic domain + from Secrets, the `overridesConfigMap` field, and WebLogic domain topology. Legal values are DYNAMIC, which means that the operator will distribute updated configuration overrides dynamically to running servers, and ON_RESTART, which means that servers will diff --git a/operator/src/main/java/oracle/kubernetes/weblogic/domain/model/Configuration.java b/operator/src/main/java/oracle/kubernetes/weblogic/domain/model/Configuration.java index 0b35002a2ce..2e6cd16b056 100644 --- a/operator/src/main/java/oracle/kubernetes/weblogic/domain/model/Configuration.java +++ b/operator/src/main/java/oracle/kubernetes/weblogic/domain/model/Configuration.java @@ -36,12 +36,12 @@ public class Configuration { @Description( "Determines how updated configuration overrides are distributed to already running WebLogic Server instances " + "following introspection when the `domainHomeSourceType` is PersistentVolume or Image. Configuration overrides " - + "are generated during introspection from Secrets, the `overrideConfigMap` field, and WebLogic domain topology. " - + "Legal values are DYNAMIC, which means that the operator will distribute updated configuration overrides " - + "dynamically to running servers, and ON_RESTART, which means that servers will use updated configuration " - + "overrides only after the server's next restart. The selection of ON_RESTART will not cause servers to " - + "restart when there are updated configuration overrides available. See also `domains.spec.introspectVersion`. " - + "Defaults to DYNAMIC.") + + "are generated during introspection from Secrets, the `overridesConfigMap` field, and WebLogic domain " + + "topology. Legal values are DYNAMIC, which means that the operator will distribute updated configuration " + + "overrides dynamically to running servers, and ON_RESTART, which means that servers will use updated " + + "configuration overrides only after the server's next restart. The selection of ON_RESTART will not cause " + + "servers to restart when there are updated configuration overrides available. See also " + + "`domains.spec.introspectVersion`. Defaults to DYNAMIC.") private OverrideDistributionStrategy overrideDistributionStrategy; @Description("The Istio service mesh integration settings.")