Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,9 @@
import io.javaoperatorsdk.operator.api.reconciler.Context;
import io.javaoperatorsdk.operator.api.reconciler.dependent.DependentResource;

/**
* A condition implementation meant to be used as a delete post-condition on Kubernetes dependent
/* A condition implementation meant to be used as a delete post-condition on Kubernetes dependent
* resources to prevent the workflow from proceeding until the associated resource is actually
* deleted from the server (or, at least, doesn't have any finalizers anymore). This is needed in
* cases where a cleaning process depends on resources being actually removed from the server
* because, by default, workflows simply request the deletion but do NOT wait for the resources to
* be actually deleted.
* deleted from the server.
*/
public class KubernetesResourceDeletedCondition implements Condition<HasMetadata, HasMetadata> {

Expand All @@ -20,10 +16,6 @@ public boolean isMet(
HasMetadata primary,
Context<HasMetadata> context) {
var optionalResource = dependentResource.getSecondaryResource(primary, context);
if (optionalResource.isEmpty()) {
return true;
} else {
return optionalResource.orElseThrow().getMetadata().getFinalizers().isEmpty();
}
return optionalResource.isEmpty();
}
}