Description
Is your feature request related to a problem? Please describe.
Currently, the StatusAnalyzer
in the component-operator-runtime
interprets the status conditions of a Kubernetes resource and returns a status. However, it does not provide additional context such as a reason or message that explains how the status was determined. This lack of information can be frustrating when trying to understand the status of a resource.
Describe the solution you'd like
I would like the StatusAnalyzer
to return additional information, such as a reason or message, when computing the status of a resource. This could be achieved by having the StatusAnalyzer
return the condition it used to interpret the status or by rendering an object with a structure that includes a message: string
and reason: string
.
Describe alternatives you've considered
An alternative solution could be to manually extract and interpret the conditions from the resource status, but this approach would be less efficient and more error-prone.
Additional context
The current implementation of the StatusAnalyzer
is as follows:
statusAnalyzer := componentruntimestatus.NewStatusAnalyzer(reflect.TypeOf(r).Name())
status, err := statusAnalyzer.ComputeStatus(observedResource)
if err != nil {
return errors.Wrap(err, "error computing status")
}
resource.Status.SetCondition(MyCondition{
Type: MyStatus,
Status: status.String(),
// it would be nice to render the reason and/or message as well
Reason: status.context?.reason,
Message: status.context?.message
})
This enhancement would provide more clarity and context when analyzing the status of Kubernetes resources.