Skip to content

Conversation

@artemsa223
Copy link
Contributor

@artemsa223 artemsa223 commented Aug 27, 2025

  • Added detailed status messages for all reconciliation stages
  • Implemented proper error handling for missing InferenceServices
  • Added Available and Degraded condition types
  • Enhanced progress tracking with component-level status
  • Added Kubernetes event recording for better observability
  • Fixed issue where missing InferenceServices showed as 'not ready' instead of error

Summary by Sourcery

Enhance GuardrailsOrchestrator status reporting by adding detailed status and reason messages, new Available/Degraded conditions, granular phase tracking, custom error handling for missing InferenceServices, and Kubernetes event recording for better observability.

New Features:

  • Record Kubernetes events for reconciliation stages and component lifecycle events

Bug Fixes:

  • Ensure missing InferenceServices surface as a blocking error instead of appearing as ‘not ready’

Enhancements:

  • Introduce Available and Degraded condition types with helper functions for status tracking
  • Expand reconciliation phases (Failed, Unknown) and enrich status reasons and messages for each component and overall progress
  • Improve progress tracking with component-level readiness checks and aggregated progress messages
  • Implement custom NoInferenceServicesError and integrate detailed error handling into the reconciliation logic

- Added detailed status messages for all reconciliation stages
- Implemented proper error handling for missing InferenceServices
- Added Available and Degraded condition types
- Enhanced progress tracking with component-level status
- Added Kubernetes event recording for better observability
- Fixed issue where missing InferenceServices showed as 'not ready' instead of error
@openshift-ci-robot
Copy link
Collaborator

openshift-ci-robot commented Aug 27, 2025

@artemsa223: This pull request references RHOAIENG-20123 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the epic to target the "4.20.0" version, but no target version was set.

In response to this:

  • Added detailed status messages for all reconciliation stages
  • Implemented proper error handling for missing InferenceServices
  • Added Available and Degraded condition types
  • Enhanced progress tracking with component-level status
  • Added Kubernetes event recording for better observability
  • Fixed issue where missing InferenceServices showed as 'not ready' instead of error

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci
Copy link

openshift-ci bot commented Aug 27, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Aug 27, 2025

Reviewer's Guide

This PR enriches the GuardrailsOrchestrator status reporting by introducing new condition types and helper methods, supplying detailed messages for each reconciliation stage, refining error handling for missing or failing components, and injecting Kubernetes events for observability.

Sequence diagram for enhanced GuardrailsOrchestrator reconciliation and status reporting

sequenceDiagram
    participant Controller
    participant K8sAPI
    participant Recorder
    participant Status
    Controller->>Status: SetProgressingCondition (Initializing)
    Controller->>Recorder: Event: Initializing
    Controller->>K8sAPI: Get ServiceAccount
    alt ServiceAccount not found
        Controller->>K8sAPI: Create ServiceAccount
        Controller->>Status: SetDegradedCondition (ServiceAccountCreationFailed)
        Controller->>Recorder: Event: ServiceAccountCreated
    end
    Controller->>K8sAPI: Get ConfigMap
    alt ConfigMap not found
        Controller->>Status: SetDegradedCondition (ConfigMapNotFound)
        Controller->>Recorder: Event: ConfigMapNotFound
    end
    Controller->>K8sAPI: Get Deployment
    alt Deployment not found
        Controller->>K8sAPI: Create Deployment
        Controller->>Status: SetDegradedCondition (DeploymentCreationFailed)
        Controller->>Recorder: Event: DeploymentCreated
    end
    Controller->>K8sAPI: Get Service
    alt Service not found
        Controller->>K8sAPI: Create Service
        Controller->>Status: SetDegradedCondition (ServiceCreationFailed)
        Controller->>Recorder: Event: ServiceCreated
    end
    Controller->>K8sAPI: Get Routes
    alt Route not found
        Controller->>K8sAPI: Create Route
        Controller->>Status: SetDegradedCondition (RouteCreationFailed)
        Controller->>Recorder: Event: RouteCreated
    end
    Controller->>Status: reconcileStatuses (component-level)
    alt All components ready
        Status->>Status: SetAvailableCondition (true)
        Status->>Status: SetDegradedCondition (false)
        Status->>Recorder: Event: Ready
    else Missing InferenceService
        Status->>Status: SetAvailableCondition (false)
        Status->>Status: SetDegradedCondition (true)
        Status->>Recorder: Event: Failed
    else Any component failed
        Status->>Status: SetAvailableCondition (false)
        Status->>Status: SetDegradedCondition (true)
        Status->>Recorder: Event: Failed
    else Progressing
        Status->>Status: SetAvailableCondition (false)
        Status->>Status: SetDegradedCondition (false)
    end
Loading

Entity relationship diagram for GuardrailsOrchestrator status conditions

erDiagram
    GUARDRAILS_ORCHESTRATOR ||--o{ CONDITION : has
    CONDITION {
        string Type
        string Status
        string Reason
        string Message
    }
    GUARDRAILS_ORCHESTRATOR {
        string Name
        string Namespace
        string Phase
    }
Loading

Class diagram for updated GuardrailsOrchestrator status conditions and error handling

classDiagram
    class GuardrailsOrchestratorReconciler {
        +updateStatus(ctx, orig, updateFn)
        +reconcileStatuses(ctx, orchestrator)
        +checkGeneratorPresent(ctx, namespace)
    }
    class NoInferenceServicesError {
        +Namespace: string
        +Error() string
    }
    class Condition {
        +Type: ConditionType
        +Status: ConditionStatus
        +Reason: string
        +Message: string
    }
    class ConditionType {
        <<enumeration>>
        ReconcileComplete
        Progressing
        Available
        Degraded
    }
    class ConditionStatus {
        <<enumeration>>
        True
        False
    }
    GuardrailsOrchestratorReconciler --> NoInferenceServicesError
    GuardrailsOrchestratorReconciler --> Condition
    Condition --> ConditionType
    Condition --> ConditionStatus
Loading

File-Level Changes

Change Details Files
Extended status model: new condition types, phases, messages and helper functions
  • Added ConditionAvailable, ConditionDegraded, PhaseFailed and PhaseUnknown
  • Defined detailed Reconcile and component-specific message constants
  • Implemented SetAvailableCondition and SetDegradedCondition methods
controllers/gorch/status.go
Overhauled reconcileStatuses logic for granular state tracking and error handling
  • Refined InferenceService, Deployment, and Route checks with tailored error branches
  • Set Complete, Available, Degraded and Progressing conditions based on component states
  • Added specialized handling and requeue logic for missing InferenceServices
controllers/gorch/status.go
Enhanced Reconcile workflow with event recording and stepwise status updates
  • Recorded Kubernetes events at init, resource creation and finalization
  • Updated status updates to reflect progress and degraded states on resource creation failures
controllers/gorch/guardrailsorchestrator_controller.go
Improved InferenceService readiness detection with dedicated error type
  • Introduced NoInferenceServicesError for missing services
  • Adjusted checkGeneratorPresent to validate Ready condition on InferenceService items
controllers/gorch/inferenceservices.go

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@openshift-merge-robot
Copy link
Collaborator

PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@openshift-ci
Copy link

openshift-ci bot commented Aug 27, 2025

Hi @artemsa223. Thanks for your PR.

I'm waiting for a trustyai-explainability member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@openshift-ci-robot
Copy link
Collaborator

openshift-ci-robot commented Aug 27, 2025

@artemsa223: This pull request references RHOAIENG-20123 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the epic to target the "4.20.0" version, but no target version was set.

In response to this:

  • Added detailed status messages for all reconciliation stages
  • Implemented proper error handling for missing InferenceServices
  • Added Available and Degraded condition types
  • Enhanced progress tracking with component-level status
  • Added Kubernetes event recording for better observability
  • Fixed issue where missing InferenceServices showed as 'not ready' instead of error

Summary by Sourcery

Enhance GuardrailsOrchestrator status reporting by adding detailed status and reason messages, new Available/Degraded conditions, granular phase tracking, custom error handling for missing InferenceServices, and Kubernetes event recording for better observability.

New Features:

  • Record Kubernetes events for reconciliation stages and component lifecycle events

Bug Fixes:

  • Ensure missing InferenceServices surface as a blocking error instead of appearing as ‘not ready’

Enhancements:

  • Introduce Available and Degraded condition types with helper functions for status tracking
  • Expand reconciliation phases (Failed, Unknown) and enrich status reasons and messages for each component and overall progress
  • Improve progress tracking with component-level readiness checks and aggregated progress messages
  • Implement custom NoInferenceServicesError and integrate detailed error handling into the reconciliation logic

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there - I've reviewed your changes - here's some feedback:

  • The reconcileStatuses function is quite large and covers multiple concerns; consider extracting component-specific status logic into smaller helper functions to improve readability and maintainability.
  • Comparing err.Error() to literal strings (e.g., "not ready") is brittle—introduce sentinel error types or constants to represent known error conditions instead of string matching.
  • Calls to updateStatus often ignore the returned error (orchestrator, _ = r.updateStatus…); make sure to handle or log these errors so status updates don’t fail silently.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The reconcileStatuses function is quite large and covers multiple concerns; consider extracting component-specific status logic into smaller helper functions to improve readability and maintainability.
- Comparing err.Error() to literal strings (e.g., "not ready") is brittle—introduce sentinel error types or constants to represent known error conditions instead of string matching.
- Calls to updateStatus often ignore the returned error (`orchestrator, _ = r.updateStatus…`); make sure to handle or log these errors so status updates don’t fail silently.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@christinaexyou christinaexyou self-assigned this Aug 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants