Include GetTopLevelConditionType for KRShaped#1298
Include GetTopLevelConditionType for KRShaped#1298knative-prow-robot merged 2 commits intoknative:masterfrom
Conversation
| func (t *KResource) GetHappyConditionType() apis.ConditionType { | ||
| // Note: KResources are unmarshalled from existing resources. This will only work properly for resources that | ||
| // have already been initialized to their type. | ||
| if cond := t.Status.GetCondition(apis.ConditionSucceeded); cond != nil { |
There was a problem hiding this comment.
this will not work for un-initialized resources, the condition set will be an empty list.
There was a problem hiding this comment.
sorry I did not see the final impl, this will work but it wil also require all downstreams to update
There was a problem hiding this comment.
I have that included as a comment. The idea is that each API shape reports its type and gets initialized. KResource is a generic struct we unmarshal to, but not something that directly manages init.
|
The following is the coverage report on the affected files.
|
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: n3wscott, whaught The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
|
||
| GetStatus() *Status | ||
|
|
||
| GetTopLevelConditionType() apis.ConditionType |
There was a problem hiding this comment.
Too late, but I'm curious why we didn't stick to the current naming here (Happy instead of TopLevel).
Issue #1226
At the moment each implementer either makes a LivingConditionSet manager or a BatchConditionSet manager within each resource. However this allows for polymorphic logic since each type will report its own happy condition.
Longer term we could simplify by just having GetConditionSet(resource) and the manager can figure out what the condition ought to be. This will make it easier to share common logic.