Create a common method for processing reconciliation on generic KRShaped#1284
Create a common method for processing reconciliation on generic KRShaped#1284knative-prow-robot merged 31 commits intoknative:masterfrom
Conversation
Co-authored-by: Matt Moore <mattmoor@vmware.com>
|
/retest |
|
A general question about this PR: why would we want to force the Ready condition to Unknown instead of letting the user decide what to do with it in case of error? |
| } | ||
|
|
||
| func getDefaultConditionSet(resource duckv1.KRShaped) (apis.ConditionSet, error) { | ||
| switch resource.GetTopLevelConditionType() { |
There was a problem hiding this comment.
Why didn't we use the term Happy instead of TopLevel here? Not saying it's good or bad, but it's just the term condition sets use right now.
There was a problem hiding this comment.
Alright, glad that Scott could confirm 👍
| newStatus := resource.GetStatus() | ||
| if newStatus.ObservedGeneration != resource.GetObjectMeta().GetGeneration() { | ||
| // Reset ready to unknown. The reconciler is expected to overwrite this. | ||
| manager := condSet.Manage(newStatus) | ||
| manager.MarkUnknown( | ||
| manager.GetTopLevelCondition().Type, failedGenerationBump, "unsucessfully observed a new generation") | ||
| } |
There was a problem hiding this comment.
Don't we want to also call InitializeConditions here?
There was a problem hiding this comment.
My fear was that I don't necessarily want to clobber all the conditions and I believe they should have been initialized in the admission webhook at this point?
There was a problem hiding this comment.
Controllers call that method usually, webhooks only initialize the spec if I'm not mistaken (not every type has an admission webhook, for some third-party types the OpenAPI schema present in the CRD is sufficient).
I'm OK leaving that as it is, I was just curious what you thought about it.
There was a problem hiding this comment.
This is also not a complete condition set (we don't make any assumptions about the dependant sub-conditions here)
There was a problem hiding this comment.
hmm maybe we will want the full conditionset so that we can do this and at some point have the preprocessing do all the init stuff. I may reconsider this as another PR?
|
/lgtm |
|
This is great, nice work. I think this will blend well with our controllers and let us drop some easily forgotten copy/paste logic from the current reconcilers. 👏 /lgtm |
Co-authored-by: Victor Agababov <vagababov@gmail.com>
Co-authored-by: Victor Agababov <vagababov@gmail.com>
mattmoor
left a comment
There was a problem hiding this comment.
Produced via:
gofmt -s -w $(find -path './vendor' -prune -o -path './third_party' -prune -o -type f -name '*.go' -print)
mattmoor
left a comment
There was a problem hiding this comment.
Produced via:
gofmt -s -w $(find -path './vendor' -prune -o -path './third_party' -prune -o -type f -name '*.go' -print)
Co-authored-by: Matt Moore <mattmoor@vmware.com>
|
The following is the coverage report on the affected files.
|
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: grantr, n3wscott, vagababov, 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 |
Issue #1226
This is not yet invoked, the next PR will integrate this with genreconciler.