Skip to content

Commit c6879b9

Browse files
committed
feat: set the SGStream as completed when running with a Deployment
1 parent 97e5681 commit c6879b9

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

stackgres-k8s/src/stream/src/main/java/io/stackgres/stream/jobs/StreamLauncher.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ public void launchStream(String streamName, String namespace) {
153153
.invoke(() -> {
154154
LOGGER.info("Operation completed for SGStream {}", streamName);
155155
if (Optional.ofNullable(stream.getSpec().getMaxRetries()).orElse(-1) < 0) {
156+
updateToCompletedConditions(streamName, namespace);
156157
LOGGER.info("SGStream completed, waiting for user to delete the SGStream");
157158
while (true) {
158159
Unchecked.runnable(() -> Thread.sleep(1000)).run();
@@ -197,6 +198,10 @@ private void updateToTimeoutConditions(String streamName, String namespace) {
197198
updateToConditions(streamName, namespace, getTimeoutConditions());
198199
}
199200

201+
private void updateToCompletedConditions(String streamName, String namespace) {
202+
updateToConditions(streamName, namespace, getCompletedConditions());
203+
}
204+
200205
public List<Condition> getStartingConditions() {
201206
final List<Condition> conditions = List.of(
202207
StreamStatusCondition.STREAM_RUNNING.getCondition(),
@@ -227,4 +232,14 @@ public List<Condition> getTimeoutConditions() {
227232
return conditions;
228233
}
229234

235+
public List<Condition> getCompletedConditions() {
236+
final List<Condition> conditions = List.of(
237+
StreamStatusCondition.STREAM_FALSE_RUNNING.getCondition(),
238+
StreamStatusCondition.STREAM_COMPLETED.getCondition(),
239+
StreamStatusCondition.STREAM_FALSE_FAILED.getCondition()
240+
);
241+
Condition.setTransitionTimes(conditions);
242+
return conditions;
243+
}
244+
230245
}

0 commit comments

Comments
 (0)