-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use Knative's {Type}StatusFields Pattern #1590
Comments
I'm having some difficulty understanding what we're doing that's causing a problem for you. It sounds like you want to embed
And the inclusion of the (In general I have no problem rearranging how this type is defined, so long as it doesn't break compatibility, I'm just having difficulty understanding what's wrong with how it's described now) |
You are correct that I'm wanting to do this. Its less of a compilation problem and more that it seems misleading (to me at least). With Knative's pattern, it's clear what fields will be filled in. However if I embed the |
@imjasonh I'm working on a PR for this now. Do you think it would make more sense for v1alpha2 or beta? |
Splits up the status types into two structs: * XXXStatus * XXXStatusFields This first inlines both knative's duck status type and the XXXStatusFields. The second stores all the fields that were originially in XXXStatus. This is advantageous as downstream users can now embed a the XXXStatusFields if their CRDs manage a Tekton object. This pattern is demonstrated in Knative (e.g., Serving). Moving to this pattern does not change the JSON/YAML structure in anyway, however it does change how status objects have to be instantiated in Go. fixes tektoncd#1590
Splits up the status types into two structs: * XXXStatus * XXXStatusFields This first inlines both knative's duck status type and the XXXStatusFields. The second stores all the fields that were originially in XXXStatus. This is advantageous as downstream users can now embed a the XXXStatusFields if their CRDs manage a Tekton object. This pattern is demonstrated in Knative (e.g., Serving). Moving to this pattern does not change the JSON/YAML structure in anyway, however it does change how status objects have to be instantiated in Go. fixes tektoncd#1590
How much of a breaking change is it to customers who only see YAML? Can you give me an idea of the before/after for especially the YAML diff, and then less so the Go struct diff? |
Nevermind just saw the PR |
Splits up the status types into two structs: * XXXStatus * XXXStatusFields This first inlines both knative's duck status type and the XXXStatusFields. The second stores all the fields that were originially in XXXStatus. This is advantageous as downstream users can now embed a the XXXStatusFields if their CRDs manage a Tekton object. This pattern is demonstrated in Knative (e.g., Serving). Moving to this pattern does not change the JSON/YAML structure in anyway, however it does change how status objects have to be instantiated in Go. fixes tektoncd#1590
/kind feature |
Splits up the status types into two structs: * XXXStatus * XXXStatusFields This first inlines both knative's duck status type and the XXXStatusFields. The second stores all the fields that were originially in XXXStatus. This is advantageous as downstream users can now embed a the XXXStatusFields if their CRDs manage a Tekton object. This pattern is demonstrated in Knative (e.g., Serving). Moving to this pattern does not change the JSON/YAML structure in anyway, however it does change how status objects have to be instantiated in Go. fixes tektoncd#1590
Splits up the status types into two structs: * XXXStatus * XXXStatusFields This first inlines both knative's duck status type and the XXXStatusFields. The second stores all the fields that were originially in XXXStatus. This is advantageous as downstream users can now embed a the XXXStatusFields if their CRDs manage a Tekton object. This pattern is demonstrated in Knative (e.g., Serving). Moving to this pattern does not change the JSON/YAML structure in anyway, however it does change how status objects have to be instantiated in Go. fixes #1590
Expected Behavior
I would like to be able to embed Tekton's Status in my own CRD (e.g., for a TaskRun).
Actual Behavior
I have to recreate Tekton's Status type because I can't embed it due to the included
duck.Status
.Additional Info
Knative-Serving solves this by creating a new Type that doesn't embed the
knative.dev/pkg/apis/duck/v1beta1.Status
.An example of it is their
ServiceStatus
Notice that it embeds both the
ConfigurationStatusFields
and theRouteStatusFields
.I would be happy to contribute towards this if this is something we want to do.
The text was updated successfully, but these errors were encountered: