Closed yuwenma closed 1 year ago
cc @justinsb
Per offline discussion with @justinsb and kstatus author @mortent, this PR is simplified to reflect the current status as a single condition with type "ready" and status true/false
. The status true
means all the manifests are reconciled, and false
means the manifests are in progress (or in bad situation but k-d-p cannot determine whether it can be self-healed and reconciled later ).
Example for case "some manifests are InProgress or Terminating"
kind: MyCR
...
status:
conditions:
- lastTransitionTime: "2023-02-23T09:07:38Z"
message: |
apps/v1, Kind=StatefulSet/mycr/mycr-application-controller:Ready: 0/1
reason: AbnormalTrueConditions
status: "False"
type: Ready
healthy: false
phase: InProgress
Example for case "All manifests are reconciled"
kind: MyCR
...
status:
conditions:
- lastTransitionTime: "2023-02-23T09:17:57Z"
message: all manifests are reconciled.
reason: Normal
status: "True"
type: Ready
healthy: false
phase: Current
Some nits, looks really good. I think / hope if you rebase the tests will be much less flaky
Two small things that we should fix, but this looks good and I am happy for you to fix those things in a separate PR if that is easier. So
/approve /lgtm
/hold
You should cancel the hold yourself if you agree and want to address the issues in a follow-on PR, but if you want to push a fix into this PR that works too.
/hold cancel
/approve /lgtm
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: justinsb, yuwenma
The full list of commands accepted by this bot can be found here.
The pull request process is described here
This PR is based on https://github.com/kubernetes-sigs/kubebuilder-declarative-pattern/pull/272 which needs to go in first.
Description
This PR adds a
status.conditions
according to the API convention "typical status properties" and the kstatus abnormal-true conditionsThe conditions logic is described as below:
All manifest
.status.conditions
are augmented via kstatus to normalize its "type" asStalled
(kstatus abnormal-true),Reconciling
(kstatus abnormal-true) or normal . These augmented conditions works together with the manifests' aggregated status. They will determine thedeclarativeObject
present condition.The
declarativeObject
condition falls into 3 categoriesdeclarativeObject
will be inCurrent
phase, with a singleReady
condition.Terminating
orInProgress
, thedeclarativeObject
condition will beReconciling
. It will update existingReconciling
conditions and reset theStalled
conditions.declarativeObject
condition will be "Stalled". ifdeclarativeObject
already has "stalled" condition, the existing condition will be updated with the presentMessage
,Reason
(required) andLastTransitionTime
, whereMessage
are pulled from the manifests conditions.Examples
Example for case "All manifests are reconciled"
Example for case "some manifests are InProgress or Terminating"
Example for case "known error (AppliedFailed)"
Alternatives
Because conditions themselves should not be state machines, we don't really need to capture all manifests' conditions in one. But we can have each manifest's present abnormal-true condition to represent a
declarativeObject
condition, as shown below.The downside is that the
declarativeObject
itself's condition then can no longer be computed or augmented by kstatus correctly (it can no longer map the legacy type/status to k8s resources since the resource now isMyCR
).