Class RmIspStatusReporter

java.lang.Object
io.confluent.rm.kafka.v1.RmIspStatusReporter
All Implemented Interfaces:
RmStatusReporter<com.io.confluent.rm.switchover.v1.InternalSwitchoverPair>

public class RmIspStatusReporter extends Object implements RmStatusReporter<com.io.confluent.rm.switchover.v1.InternalSwitchoverPair>
Status reporter for managing InternalSwitchoverPair resource lifecycle.

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
    Constructor
    Description
    Creates a new RmIspStatusReporter.
  • Method Summary

    Modifier and Type
    Method
    Description
    CompletableFuture<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 latest resourceVersion.
    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.InternalSwitchoverPair
    setObservedGeneration(com.io.confluent.rm.switchover.v1.InternalSwitchoverPair internalSwitchoverPair)
    Updates the observed generation in the status field to match spec.generation

    Methods inherited from class Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • RmIspStatusReporter

      public RmIspStatusReporter(RmClient client)
      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: RmStatusReporter
      Sets the status condition for the resource.
      Specified by:
      reportStatus in interface RmStatusReporter<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: RmStatusReporter
      Re-reads the resource from RM by its identity (name + scopes), returning the currently persisted copy with the latest resourceVersion. 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:
      getLatest in interface RmStatusReporter<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: RmStatusReporter
      Adds 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 resource argument, 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 a resourceVersion conflict.

      Specified by:
      addFinalizer in interface RmStatusReporter<com.io.confluent.rm.switchover.v1.InternalSwitchoverPair>
      Parameters:
      internalSwitchoverPair - The resource to update; must reflect current RM state
      finalizer - 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: RmStatusReporter
      Removes 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 resource argument, 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 a resourceVersion conflict.

      Specified by:
      deleteFinalizer in interface RmStatusReporter<com.io.confluent.rm.switchover.v1.InternalSwitchoverPair>
      Parameters:
      internalSwitchoverPair - The resource to update; must reflect current RM state
      finalizer - 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: RmStatusReporter
      Updates the observed generation in the status field to match spec.generation
      Specified by:
      setObservedGeneration in interface RmStatusReporter<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