Skip to content

Conversation

Copy link

Copilot AI commented Dec 7, 2025

Implements standardized condition reporting for all Custom Resources to enable status observability via kstatus.

Changes

API Types

  • Added Conditions []metav1.Condition to all status structs (HarborConnection, Project, Registry, User, Member)
  • Conditions follow Kubernetes API conventions with standard types: Ready, Reconciling, Stalled

Controllers

  • All reconcilers now set conditions at key points:
    • Ready=False + Stalled=True on connection failures, invalid specs
    • Reconciling=True during create/update/adopt operations
    • Ready=True + Reconciling=False + Stalled=False on successful reconciliation
  • Common reasons: ReconcileSuccess, ReconcileError, Creating, Updating, ConnectionFailed, InvalidSpec

Helpers

  • New internal/controller/conditions.go with SetCondition, GetCondition, RemoveCondition
  • Convenience functions: SetReadyCondition, SetReconcilingCondition, SetStalledCondition
  • Handles timestamp updates only on status transitions

Example

After reconciliation, resources expose standard conditions:

status:
  harborProjectID: 123
  conditions:
  - type: Ready
    status: "True"
    reason: ReconcileSuccess
    message: "Project reconciled successfully"
    lastTransitionTime: "2025-12-07T15:00:00Z"
  - type: Reconciling
    status: "False"
    reason: ReconcileSuccess
    message: "Reconciliation complete"
    lastTransitionTime: "2025-12-07T15:00:00Z"
  - type: Stalled
    status: "False"
    reason: ReconcileSuccess
    message: ""
    lastTransitionTime: "2025-12-07T15:00:00Z"

Enables status queries via kubectl get <resource> -o jsonpath='{.status.conditions}' and compatibility with kstatus-aware tooling.

Original prompt

This section details on the original issue you should resolve

<issue_title>Update CR status with conditions</issue_title>
<issue_description>https://github.com/kubernetes-sigs/cli-utils/tree/master/pkg/kstatus</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Update CR status with conditions Add kstatus-compatible conditions to CR status fields Dec 7, 2025
Copilot AI requested a review from rkthtrifork December 7, 2025 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update CR status with conditions

2 participants