Skip to content

Commit 70f8582

Browse files
committed
Support domain status detection in both directions
1 parent 5ef0923 commit 70f8582

File tree

4 files changed

+9
-11
lines changed

4 files changed

+9
-11
lines changed

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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@
2525
import oracle.kubernetes.operator.calls.FailureStatusSource;
2626
import oracle.kubernetes.operator.calls.UnrecoverableErrorBuilder;
2727
import oracle.kubernetes.operator.helpers.CallBuilder;
28+
import oracle.kubernetes.operator.helpers.CrdHelper;
2829
import oracle.kubernetes.operator.helpers.DomainPresenceInfo;
2930
import oracle.kubernetes.operator.helpers.DomainPresenceInfo.ServerStartupInfo;
31+
import oracle.kubernetes.operator.helpers.KubernetesVersion;
3032
import oracle.kubernetes.operator.helpers.PodHelper;
3133
import oracle.kubernetes.operator.helpers.ResponseStep;
3234
import oracle.kubernetes.operator.logging.LoggingFacade;
@@ -274,13 +276,10 @@ public NextAction onSuccess(Packet packet, CallResponse<Domain> callResponse) {
274276
// If the 3.0.0 operator updated the CRD to use status endpoint while this operator is running
275277
// then these domain replace calls will succeed, but the proposed domain status will have been
276278
// ignored. Check if the status on the returned domain is expected
277-
if (!useDomainStatusEndpoint && !newStatus.equals(callResponse.getResult().getStatus())) {
278-
// TEST
279-
System.out.println("**** **** ****: Domain status update ignored; switching to status endpoint");
280-
281-
// FIXME: would be better to recheck CRD
282-
Main.useDomainStatusEndpoint.set(true);
283-
return doNext(createRetry(context, getNext()), packet);
279+
if (callResponse.getResult() == null || !newStatus.equals(callResponse.getResult().getStatus())) {
280+
LOGGER.info(MessageKeys.DOMAIN_STATUS_IGNORED);
281+
return doNext(CrdHelper.createDomainCrdStep(packet.getSpi(KubernetesVersion.class),
282+
createRetry(context, getNext())), packet);
284283
}
285284
/* END-2.6.0-ONLY */
286285
packet.getSpi(DomainPresenceInfo.class).setDomain(callResponse.getResult());

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -557,9 +557,7 @@ public NextAction onSuccess(
557557

558558
/* MARKER-2.6.0-ONLY */
559559
private void checkForStatusSubresource(V1beta1CustomResourceDefinition existingCrd) {
560-
if (existingCrd.getSpec().getSubresources().getStatus() != null) {
561-
Main.useDomainStatusEndpoint.set(true);
562-
}
560+
Main.useDomainStatusEndpoint.set(existingCrd.getSpec().getSubresources().getStatus() != null);
563561
}
564562
/* END-2.6.0-ONLY */
565563

operator/src/main/java/oracle/kubernetes/operator/logging/MessageKeys.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ public class MessageKeys {
1414
public static final String OPERATOR_SHUTTING_DOWN = "WLSKO-0005";
1515
public static final String EXCEPTION = "WLSKO-0006";
1616
public static final String CREATING_CRD = "WLSKO-0012";
17+
public static final String DOMAIN_STATUS_IGNORED = "WLSKO-0013";
1718
public static final String LISTING_DOMAINS = "WLSKO-0014";
1819
public static final String SECRET_NOT_FOUND = "WLSKO-0018";
1920
public static final String RETRIEVING_SECRET = "WLSKO-0019";

operator/src/main/resources/Operator.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ WLSKO-0009=Created Network Policy: {0}
1111
WLSKO-0010=Service Details: {0}
1212
WLSKO-0011=Creating Service in namespace {0} with details: {1}
1313
WLSKO-0012=Create Custom Resource Definition: {0}
14-
WLSKO-0013=
14+
WLSKO-0013=Domain status update ignored; rechecking CRD
1515
WLSKO-0014=Listing WebLogic Domains
1616
WLSKO-0015=WebLogic Domain information: {0}
1717
WLSKO-0016=There are {0} domains in namespace {1}

0 commit comments

Comments
 (0)