Closed tatehanawalt closed 8 months ago
This idea looks good :+1: Feel free to mention reviewers once you create PR(s) about this.
Awesome thanks @atoato88
I have opened a PR with this issue linked in the summary https://github.com/kubernetes-sigs/kubebuilder-declarative-pattern/pull/372
What would you like to be added:
kstatusAggregator
,kstatusAggregator.BuildStatus
extended to support aggregate status where a subset of resources are custom/unconventional, through user supplied GVK specific compute and abnormal conditions handler methods.Why is this needed:
kstatusAggregator.BuildStatus aggregates status over underlying resources, but does not support handling of custom/unconventional resources.
Users can implement their own BuildStatus method, but that requires users to implement an entire BuildStatus method. kstatusAggregator.BuildStatus can be minimally modified to support custom/unconventional resources without requiring users to implement an entirely custom BuildStatus method.
Example: Our operator creates resources, some of which are maintained by a 3rd party operator which does not appear to follow abnormal-true conventions. Additionally, errors of these 3rd party resources may be present in the resource status, without corresponding status conditions reflecting those errors.
How we achieved this in practice:
kstatusAggregator.BuildStatus
derives status for individual resources in calls to Compute for a given resource.Compute is an implementation of GetConditionsFn.
kstatusAggregator
can support custom/unconventional resources by allowing users to specify GVK specificGetConditionsFn
methods which would be called in place of Compute.This is akin to allowing users to define something like the legacyTypes map, where a handler method can be specified for specific GVKs per the user's requirements.
If no compute method is specified for a specific GVK string, the existing compute method is used in the same way it is currently called. This makes the proposed BuildStatus changes reverse compatible.
kstatusAggregator.BuildStatus
also uses a method to extract abnormal conditions of a given resource. In order forkstatusAggregator.BuildStatus
to support custom/unconventional resources, users must also be able (but not required) to specify a method to deriveAbnormalConditions
for a given GVK.BuildStatus could then be modified such that if a user has configured a GVK specific compute and/or abnormal conditions method, the gvk specific methods are called and the existing Compute and abnormal conditions methods are called otherwise.
For the compute method call, this looks like:
For the abnormal condition method call, this looks like:
GVK specific compute and abnormal conditions methods are then specified in the kstatusAggregator initialization.