Skip to content

Commit b24b660

Browse files
jshum2479rjeberhard
authored andcommitted
Fix the case that when a pod is not ready because of readiness probe permanent...
1 parent ec440e0 commit b24b660

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,8 @@ private WaitForPodReadyStep(String podName, Step next) {
277277
// A pod is ready if it is not being deleted and has the ready status.
278278
@Override
279279
protected boolean isReady(V1Pod result) {
280-
return result != null && !PodHelper.isDeleting(result) && PodHelper.isReady(result);
280+
return result != null && (!PodHelper.isDeleting(result) && (PodHelper.isReady(result)
281+
|| PodHelper.isWaitingToRoll(result)));
281282
}
282283

283284
// Pods should be processed if ready.

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,19 @@ public static boolean isReady(V1Pod pod) {
115115
return ready;
116116
}
117117

118+
/**
119+
* Is the pod waiting to roll.
120+
* @param pod pod
121+
* @return true if the pod is waiting to roll
122+
*/
123+
public static boolean isWaitingToRoll(V1Pod pod) {
124+
return Optional.ofNullable(pod)
125+
.map(V1Pod::getMetadata)
126+
.map(V1ObjectMeta::getLabels)
127+
.map(labels -> "true".equalsIgnoreCase(labels.get(LabelConstants.TO_BE_ROLLED_LABEL)))
128+
.orElse(false);
129+
}
130+
118131
static boolean hasReadyServer(V1Pod pod) {
119132
return Optional.ofNullable(pod).map(PodHelper::hasReadyStatus).orElse(false);
120133
}

0 commit comments

Comments
 (0)