-
Notifications
You must be signed in to change notification settings - Fork 598
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
[Experimental] KReference.Group
to avoid being explicit on the APIVersion
#5086
Comments
it sounds like a limitation in the first place... but I am not sure if ignoring the version is a good idea... b/c they shapes could be completely different (e.g. /cc @vaikas |
But the shape ain't nothing to do with the fact that I'm referring to A or B or C, right? |
Yeah, the shape is different so you need to know which version of the resource you're getting so you can patch the right resource. Also, knowing the version is important to set up the informers, etc. otherwise you're going to have racy time. |
Can't we discover that while fetching the resource? And isn't the |
Yes, that's why the label on the resource indicated which duck it conforms to. I don't quite understand what the storage has to do with it, but yes, there can only be one storage version for a given CRD. |
And that's exactly my point. When the user gives us:
The duck controller can discover from kube what is the storage version of E.g. in this case, the controller finds out |
This is going to be a tough one to fix since the reference shape is foundational to a lot of our apis. |
Please check out the #5131 |
#5131 looks good to me. The PR does something only if the version is missing the in the subscription ref. I don't think this would require us to change any other code to adapt the code here. |
I honestly don't wanna dig in the semver magic 😄 I also think is more "correct" to use the storage version because:
|
An #5131 is breaking the contract we have with the resources. The subscription should just go ready false and an operator should fix it. No need for magic here. |
Can you share details on what you mean with "an operator should fix it" ? |
Looping in eventing wg leads @lionelvillard @grantr @vaikas @devguyio how should we move this one forward? Is this a good candidate as experimental feature (since it's a behavioural change of a field?) |
FWIW, this is cleaner UX |
My concerns with this feature are technical. The k8s API requires a version identifier to access a resource, so we have to deduce what the version is, and there may be situations in which the version cannot be deduced or the deduction is incorrect. If the technical difficulties can be worked out, then I agree this change would result in an improved UX. The current behavior must always be supported. IMO allowing the Practically, I'm concerned that adding this fundamental experiment to eventing core now will disrupt the 1.0 spec and conformance work, which for now is a Knative-wide priority. I suggest working out the technical details and UX in an experimental feature of an alternate broker implementation rather than eventing core itself. |
@slinkydeveloper Thanks for nudging us and making sure this gets eyeballs, and our apologies for taking so long to find the time to make sure we bring our concerns out in a researched manner. TL;DR:
@n3wscott and I just spent a bunch of time going through the deep bowels of the codes and the helpers and what various parsers that k8s ecosystem (including dynamic clients expect, etc. etc. etc.). Just to make sure we're all on the same page and we have concrete examples, bear with this lengthy note and revisiting some basic concepts :) APIVersion has a very specific and well understood meaning (just like @grantr points out above) but unfortunately also has legacy issues (for example) Service looks like this in ObjectReference: However Broker looks like this: And Deployment looks like this: So, given these, and if for example you use a standard way to parse these (like this one below) this would then mean that we'd have to special case around the special case due to k8s 'core' special handling.
(I'm sure the TODO will be removed any day now ;) ) Also as part of the learnings with duck types and their usage in anger has lead to. We (and sounds like @grantr) feel the best way forward is probably to not overload the semantic meaning of APIVersion, but to add This still leaves the problem of how do we get the Version, and we can use the logic in this PR to do that for the time being and see how that goes. But in the future it would be better to utilize some of the And as @aliok points out we do have the annotation to tell us the duck shape once it's fetched but the discovery would allow us to not rely on the annotations, but will work fine until discovery lands in all it's fullness. |
I personally don't see how there could be any difficulties in that sense, because whatever version the user pushed, the version living in the server is only one. And as you pointed out, we have the annotation to get the duck type version, hence from my understanding this seems to me an orthogonal problem, not related to this particular issue, but due the fact that k8s allows storing a CR only with a specific version. At the end of the day, this issue is exploiting this particular aspect of CRDs design. But I'm happy to be proven wrong and I'm open to analyze situations where this version resolution breaks.
+1
Agree, making sure the user expectation is correct is definitely a good point. I like the idea of having a specific field for it.
This is not possible without modifying the core apis, because brokers/channel implementations relies on core apis anyway. In some cases, vendors relies even on core controllers, like the subscription controller. Even if we move it forward as an experimental feature, we need to modify the core anyway.
Yep in my PR I exactly copied that logic and adapted it 😄. ProposalOk given this feedback, I propose one of the two following course of action:
OR:
Personally I prefer the first approach, less cloned code and, even if the type is in |
Re: |
Yet another issue with api version here: knative-extensions/eventing-kafka#624 |
I refactored the issue as experimental feature, including an implementation plan. Unless there are any particular objections, I'm going to move forward with the initial implementation and the inclusion process (check the issue description for more details). |
KReference.Group
to avoid being explicit on the APIVersion
The implementation PRs for the inclusion are ready to review:
I'm working on the doc PR right now. |
I see what you mean, that shouldn't be a problem because, unless you use
I can give it a spin with eventing-kafka-broker, which uses that kreference code (importing trigger spec) but doesn't require CRD RBAC |
@vaikas all E2E tests work properly here, so I think we're good: https://prow.knative.dev/view/gs/knative-prow/pr-logs/pull/knative-sandbox_eventing-kafka-broker/965/pull-knative-sandbox-eventing-kafka-broker-integration-tests/1400799445372637184 |
Ok cool! Thanks for checking :) |
The feature it's been approved and merged for the inclusion! |
/unassign slinkydeveloper |
This issue is stale because it has been open for 90 days with no |
Description
I propose to add a new field to
KReference
, calledGroup
. For example, in order to refer to aKafkaChannel
, more than using this one:The user will be able to just use this:
This approach brings the following benefits:
When the api version is needed, an algorithm can just retrieve the latest for the provided api group and kind and then query the api server using such version.
Background
This came out while working on the KafkaChannel v1alpha1 removal: knative-extensions/eventing-kafka#426 (comment). This upgrade ended up being quite painful and we even got it wrong with brokers knative-extensions/eventing-kafka#624.
Not tieing to the api version seems to me logically more correct, because the api version is a detail of the resource. With the reference system we have today, every time we need to remove an old api, we'll have to ask users to accept some downtime to fix the api version manually, or we need to end up with hacks like https://github.com/knative/eventing/pull/5085/files#diff-74513e8fb938944cdb1b786c568c843a282eecd46ba5440a4374763245e2ffeaR30. Both are in my opinion unacceptable.
Exit Criteria
Users are now able to use references without explicitly define the api version, but just using the api group.
Experimental flag name:
kreference-group
Experimental feature stages plan
Below the proposed plan for the feature stages (this list implicitly includes the requirements defined in the process)
KReference
theGroup
field and implement the logic to resolve the api version. My idea is to add a method likeKReference.Resolve(crdLister)
that overwrites, if needed, theKReference.APIVersion
field with the served CRD version (similar to Subscription Channel ref without api version #5131): Add KReference.Group field and ResolveGroup function pkg#2127Group
field inside theSubscription.Spec.Subscriber
, adding thex-preserve-unknown-fields
to the CRD and the required code to implement it: ImplementKReference.Group
resolution forSubscriber.Ref
#5440KReference.Group
field in every place we use this type:KReference.Group
inSubscription.Spec.Channel
#5520Group
field more thanAPIVersion
Affected WG
Prior discussions
The text was updated successfully, but these errors were encountered: