Skip to content

Commit 1b950d0

Browse files
committed
Wait for other server ready on cluster rolling
1 parent faa47c1 commit 1b950d0

File tree

7 files changed

+164
-193
lines changed

7 files changed

+164
-193
lines changed

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

Lines changed: 9 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@
3636
import oracle.kubernetes.operator.logging.MessageKeys;
3737
import oracle.kubernetes.operator.steps.DefaultResponseStep;
3838
import oracle.kubernetes.operator.wlsconfig.WlsDomainConfig;
39-
import oracle.kubernetes.operator.work.Fiber;
40-
import oracle.kubernetes.operator.work.Fiber.CompletionCallback;
4139
import oracle.kubernetes.operator.work.NextAction;
4240
import oracle.kubernetes.operator.work.Packet;
4341
import oracle.kubernetes.operator.work.Step;
@@ -265,47 +263,15 @@ private Collection<String> getServerNames() {
265263
* @return Step
266264
*/
267265
public static Step createProgressingStep(String reason, boolean isPreserveAvailable, Step next) {
268-
return new ProgressingHookStep(reason, isPreserveAvailable, next);
269-
}
270-
271-
private static class ProgressingHookStep extends Step {
272-
private final String reason;
273-
private final boolean isPreserveAvailable;
274-
275-
private ProgressingHookStep(String reason, boolean isPreserveAvailable, Step next) {
276-
super(next);
277-
this.reason = reason;
278-
this.isPreserveAvailable = isPreserveAvailable;
279-
}
280-
281-
@Override
282-
public NextAction apply(Packet packet) {
283-
Fiber f = Fiber.current().createChildFiber();
284-
Packet p = new Packet();
285-
p.getComponents().putAll(packet.getComponents());
286-
f.start(
287-
new ProgressingStep(reason, isPreserveAvailable),
288-
p,
289-
new CompletionCallback() {
290-
@Override
291-
public void onCompletion(Packet packet) {}
292-
293-
@Override
294-
public void onThrowable(Packet packet, Throwable throwable) {
295-
LOGGER.severe(MessageKeys.EXCEPTION, throwable);
296-
}
297-
});
298-
299-
return doNext(packet);
300-
}
266+
return new ProgressingStep(reason, isPreserveAvailable, next);
301267
}
302268

303269
private static class ProgressingStep extends Step {
304270
private final String reason;
305271
private final boolean isPreserveAvailable;
306272

307-
private ProgressingStep(String reason, boolean isPreserveAvailable) {
308-
super(null);
273+
private ProgressingStep(String reason, boolean isPreserveAvailable, Step next) {
274+
super(next);
309275
this.reason = reason;
310276
this.isPreserveAvailable = isPreserveAvailable;
311277
}
@@ -376,44 +342,14 @@ public NextAction apply(Packet packet) {
376342
* @return Step
377343
*/
378344
public static Step createAvailableStep(String reason, Step next) {
379-
return new AvailableHookStep(reason, next);
380-
}
381-
382-
private static class AvailableHookStep extends Step {
383-
private final String reason;
384-
385-
private AvailableHookStep(String reason, Step next) {
386-
super(next);
387-
this.reason = reason;
388-
}
389-
390-
@Override
391-
public NextAction apply(Packet packet) {
392-
Fiber f = Fiber.current().createChildFiber();
393-
Packet p = new Packet();
394-
p.getComponents().putAll(packet.getComponents());
395-
f.start(
396-
new AvailableStep(reason),
397-
p,
398-
new CompletionCallback() {
399-
@Override
400-
public void onCompletion(Packet packet) {}
401-
402-
@Override
403-
public void onThrowable(Packet packet, Throwable throwable) {
404-
LOGGER.severe(MessageKeys.EXCEPTION, throwable);
405-
}
406-
});
407-
408-
return doNext(packet);
409-
}
345+
return new AvailableStep(reason, next);
410346
}
411347

412348
private static class AvailableStep extends Step {
413349
private final String reason;
414350

415-
private AvailableStep(String reason) {
416-
super(null);
351+
private AvailableStep(String reason, Step next) {
352+
super(next);
417353
this.reason = reason;
418354
}
419355

@@ -499,44 +435,14 @@ public NextAction onSuccess(Packet packet, CallResponse<Domain> callResponse) {
499435
* @return Step
500436
*/
501437
static Step createFailedStep(Throwable throwable, Step next) {
502-
return new FailedHookStep(throwable, next);
503-
}
504-
505-
private static class FailedHookStep extends Step {
506-
private final Throwable throwable;
507-
508-
private FailedHookStep(Throwable throwable, Step next) {
509-
super(next);
510-
this.throwable = throwable;
511-
}
512-
513-
@Override
514-
public NextAction apply(Packet packet) {
515-
Fiber f = Fiber.current().createChildFiber();
516-
Packet p = new Packet();
517-
p.getComponents().putAll(packet.getComponents());
518-
f.start(
519-
new FailedStep(throwable),
520-
p,
521-
new CompletionCallback() {
522-
@Override
523-
public void onCompletion(Packet packet) {}
524-
525-
@Override
526-
public void onThrowable(Packet packet, Throwable throwable) {
527-
LOGGER.severe(MessageKeys.EXCEPTION, throwable);
528-
}
529-
});
530-
531-
return doNext(packet);
532-
}
438+
return new FailedStep(throwable, next);
533439
}
534440

535441
private static class FailedStep extends Step {
536442
private final Throwable throwable;
537443

538-
private FailedStep(Throwable throwable) {
539-
super(null);
444+
private FailedStep(Throwable throwable, Step next) {
445+
super(next);
540446
this.throwable = throwable;
541447
}
542448

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,13 @@ public WatchI<V1Pod> initiateWatch(WatchBuilder watchBuilder) throws ApiExceptio
8787
public void receivedResponse(Watch.Response<V1Pod> item) {
8888
LOGGER.entering();
8989

90+
listener.receivedResponse(item);
91+
9092
switch (item.type) {
9193
case "ADDED":
9294
case "MODIFIED":
9395
V1Pod pod = item.object;
94-
Boolean isReady = PodHelper.isReady(pod);
96+
Boolean isReady = !PodHelper.isDeleting(pod) && PodHelper.isReady(pod);
9597
String podName = pod.getMetadata().getName();
9698
if (isReady) {
9799
OnReady ready = readyCallbackRegistrations.remove(podName);
@@ -105,8 +107,6 @@ public void receivedResponse(Watch.Response<V1Pod> item) {
105107
default:
106108
}
107109

108-
listener.receivedResponse(item);
109-
110110
LOGGER.exiting();
111111
}
112112

@@ -131,7 +131,7 @@ private WaitForPodReadyStep(V1Pod pod, Step next) {
131131

132132
@Override
133133
public NextAction apply(Packet packet) {
134-
if (PodHelper.getReadyStatus(pod)) {
134+
if (!PodHelper.isDeleting(pod) && PodHelper.getReadyStatus(pod)) {
135135
return doNext(packet);
136136
}
137137

@@ -180,7 +180,9 @@ public NextAction onSuccess(
180180
V1Pod result,
181181
int statusCode,
182182
Map<String, List<String>> responseHeaders) {
183-
if (result != null && PodHelper.getReadyStatus(result)) {
183+
if (result != null
184+
&& !PodHelper.isDeleting(result)
185+
&& PodHelper.getReadyStatus(result)) {
184186
if (didResume.compareAndSet(false, true)) {
185187
readyCallbackRegistrations.remove(metadata.getName(), ready);
186188
fiber.resume(packet);

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -473,8 +473,7 @@ public NextAction onSuccess(Packet packet, CallResponse<V1Pod> callResponse) {
473473
setRecordedPod(newPod);
474474
}
475475

476-
PodAwaiterStepFactory pw = PodHelper.getPodAwaiterStepFactory(packet);
477-
return doNext(pw.waitForReady(newPod, next), packet);
476+
return doNext(next, packet);
478477
}
479478
}
480479

@@ -504,8 +503,7 @@ public NextAction onSuccess(Packet packet, CallResponse<V1Pod> callResponse) {
504503
setRecordedPod(newPod);
505504
}
506505

507-
PodAwaiterStepFactory pw = PodHelper.getPodAwaiterStepFactory(packet);
508-
return doNext(pw.waitForReady(newPod, next), packet);
506+
return doNext(next, packet);
509507
}
510508
}
511509

0 commit comments

Comments
 (0)