Class RmIspStatusReporter
- All Implemented Interfaces:
RmStatusReporter<com.io.confluent.rm.switchover.v1.InternalSwitchoverPair>
Handles status updates, finalizer management, and observed generation tracking for ISP resources consumed by Kafka brokers.
Example usage:
RmIspStatusReporter reporter = new RmIspStatusReporter(rmClient);
// When processing a new spec generation, update observedGeneration first before reporting status
isp = reporter.setObservedGeneration(isp);
// Then report status conditions
Condition condition = Condition.newBuilder()
.setType("ResourceValidationComplete")
.setStatus(Condition.Status.True)
.setReason("ValidationPassed")
.setMessage("All validations passed")
.build();
reporter.reportStatus(isp, condition)
.thenAccept(updated -> {
log.info("Status updated for ISP: {}", updated.getMetadata().getName());
});
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCompletableFuture<com.io.confluent.rm.switchover.v1.InternalSwitchoverPair> addFinalizer(com.io.confluent.rm.switchover.v1.InternalSwitchoverPair internalSwitchoverPair, String finalizer) Adds a finalizer to the resource's metadata.CompletableFuture<com.io.confluent.rm.switchover.v1.InternalSwitchoverPair> deleteFinalizer(com.io.confluent.rm.switchover.v1.InternalSwitchoverPair internalSwitchoverPair, String finalizer) Removes a finalizer from the resource's metadata, allowing deletion to proceed once all finalizers have been removed.CompletableFuture<com.io.confluent.rm.switchover.v1.InternalSwitchoverPair> getLatest(com.io.confluent.rm.switchover.v1.InternalSwitchoverPair internalSwitchoverPair) Re-reads the resource from RM by its identity (name + scopes), returning the currently persisted copy with the latestresourceVersion.CompletableFuture<com.io.confluent.rm.switchover.v1.InternalSwitchoverPair> reportStatus(com.io.confluent.rm.switchover.v1.InternalSwitchoverPair internalSwitchoverPair, io.confluent.resourcemanager.protobuf.apis.meta.v1.Condition condition) Sets the status condition for the resource.com.io.confluent.rm.switchover.v1.InternalSwitchoverPairsetObservedGeneration(com.io.confluent.rm.switchover.v1.InternalSwitchoverPair internalSwitchoverPair) Updates the observed generation in the status field to match spec.generation
-
Constructor Details
-
RmIspStatusReporter
Creates a new RmIspStatusReporter.- Parameters:
client- The RM client for update operations
-
-
Method Details
-
reportStatus
public CompletableFuture<com.io.confluent.rm.switchover.v1.InternalSwitchoverPair> reportStatus(com.io.confluent.rm.switchover.v1.InternalSwitchoverPair internalSwitchoverPair, io.confluent.resourcemanager.protobuf.apis.meta.v1.Condition condition) Description copied from interface:RmStatusReporterSets the status condition for the resource.- Specified by:
reportStatusin interfaceRmStatusReporter<com.io.confluent.rm.switchover.v1.InternalSwitchoverPair>- Parameters:
internalSwitchoverPair- The resource to update (observedGeneration is not updated - this must be set by the application beforehand)condition- The condition that consists of type, status, reason, message, and lastTransitionTime- Returns:
- CompletableFuture with the updated resource
-
getLatest
public CompletableFuture<com.io.confluent.rm.switchover.v1.InternalSwitchoverPair> getLatest(com.io.confluent.rm.switchover.v1.InternalSwitchoverPair internalSwitchoverPair) Description copied from interface:RmStatusReporterRe-reads the resource from RM by its identity (name + scopes), returning the currently persisted copy with the latestresourceVersion. Use this before a status update to perform a read-modify-write and avoid optimistic-concurrency conflicts when other writers may have advanced the resource since it was last read.- Specified by:
getLatestin interfaceRmStatusReporter<com.io.confluent.rm.switchover.v1.InternalSwitchoverPair>- Parameters:
internalSwitchoverPair- The resource whose identity to read; its contents other than identity are ignored- Returns:
- CompletableFuture with the current resource, completing exceptionally if it no longer exists
-
addFinalizer
public CompletableFuture<com.io.confluent.rm.switchover.v1.InternalSwitchoverPair> addFinalizer(com.io.confluent.rm.switchover.v1.InternalSwitchoverPair internalSwitchoverPair, String finalizer) Description copied from interface:RmStatusReporterAdds a finalizer to the resource's metadata. If the finalizer is already present on the supplied resource, the resource is left unchanged and no update is issued to RM.Note: The decision to skip the update is made against the finalizer list of the
resourceargument, not against current RM state. If a stale resource is passed whose finalizer list has diverged from RM, the returned future may report success without the finalizer actually being persisted. The caller is responsible to read current state, modify, then update, and retry on aresourceVersionconflict.- Specified by:
addFinalizerin interfaceRmStatusReporter<com.io.confluent.rm.switchover.v1.InternalSwitchoverPair>- Parameters:
internalSwitchoverPair- The resource to update; must reflect current RM statefinalizer- The finalizer to add- Returns:
- CompletableFuture with the updated resource
-
deleteFinalizer
public CompletableFuture<com.io.confluent.rm.switchover.v1.InternalSwitchoverPair> deleteFinalizer(com.io.confluent.rm.switchover.v1.InternalSwitchoverPair internalSwitchoverPair, String finalizer) Description copied from interface:RmStatusReporterRemoves a finalizer from the resource's metadata, allowing deletion to proceed once all finalizers have been removed. If the finalizer is not present on the supplied resource, the resource is left unchanged and no update is issued to RM.Note: The decision to skip the update is made against the finalizer list of the
resourceargument, not against current RM state. If a stale resource is passed whose finalizer list has diverged from RM, the returned future may report success without the finalizer actually being removed. The caller is responsible to read current state, modify, then update, and retry on aresourceVersionconflict.- Specified by:
deleteFinalizerin interfaceRmStatusReporter<com.io.confluent.rm.switchover.v1.InternalSwitchoverPair>- Parameters:
internalSwitchoverPair- The resource to update; must reflect current RM statefinalizer- The finalizer to remove- Returns:
- CompletableFuture with the updated resource
-
setObservedGeneration
public com.io.confluent.rm.switchover.v1.InternalSwitchoverPair setObservedGeneration(com.io.confluent.rm.switchover.v1.InternalSwitchoverPair internalSwitchoverPair) Description copied from interface:RmStatusReporterUpdates the observed generation in the status field to match spec.generation- Specified by:
setObservedGenerationin interfaceRmStatusReporter<com.io.confluent.rm.switchover.v1.InternalSwitchoverPair>- Parameters:
internalSwitchoverPair- The resource to update (observedGeneration set to spec.generation)- Returns:
- The updated resource with observedGeneration set
-