Skip to content

Commit

Permalink
Merge branch 'fix-readinessfailed-and-notrolling-update-main' into 'm…
Browse files Browse the repository at this point in the history
…ain'

The is a forward port from 4.2 when the readiness probe has a permanent...

See merge request weblogic-cloud/weblogic-kubernetes-operator!4866
  • Loading branch information
rjeberhard committed Nov 13, 2024
2 parents b40342d + 49768bf commit e132eec
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,19 @@ public static boolean isReady(V1Pod pod) {
return ready;
}

/**
* Is the pod waiting to roll.
* @param pod pod
* @return true if the pod is waiting to roll
*/
public static boolean isWaitingToRoll(V1Pod pod) {
return Optional.ofNullable(pod)
.map(V1Pod::getMetadata)
.map(V1ObjectMeta::getAnnotations)
.map(labels -> "true".equalsIgnoreCase(labels.get(LabelConstants.TO_BE_ROLLED_LABEL)))
.orElse(false);
}

static boolean hasReadyServer(V1Pod pod) {
return Optional.ofNullable(pod).map(PodHelper::hasReadyStatus).orElse(false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,9 @@ static class ManagedPodReadyStep extends Step {
WlsDomainConfig domainTopology =
(WlsDomainConfig) packet.get(ProcessingConstants.DOMAIN_TOPOLOGY);
V1Pod managedPod = info.getServerPod(serverName);

if (managedPod == null || (!isPodReady(managedPod) && !isPodMarkedForShutdown(managedPod))) {
boolean isWaitingToRoll = PodHelper.isWaitingToRoll(managedPod);
if (managedPod == null || (!isPodReady(managedPod) && !isPodMarkedForShutdown(managedPod)
&& !isWaitingToRoll)) {
// requeue to wait for managed pod to be ready
return doRequeue(packet);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public static Step createShutdownManagedServerStep(Step next, String serverName,
V1Service service = getDomainPresenceInfo(packet).getServerService(serverName);

String now = OffsetDateTime.now().toString();
if (service == null || !PodHelper.isReady(pod) || PodHelper.isFailed(pod)) {
if (service == null || !PodHelper.isReady(pod) || PodHelper.isFailed(pod) || PodHelper.isWaitingToRoll(pod)) {
return doNext(PodHelper.annotatePodAsNeedingToShutdown(pod, now, getNext()), packet);
}
return doNext(
Expand Down

0 comments on commit e132eec

Please sign in to comment.