Update ApiServerSource#1175
Conversation
|
/cc @nachocano |
|
Follow-up to add event registry types. |
|
/assign @lionelvillard |
|
@n3wscott: GitHub didn't allow me to assign the following users: lionelvillard. Note that only knative members and repo collaborators can be assigned and that issues/PRs can only have 10 assignees at the same time. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
I have a working branch, need to properly set up the source and add some UTs. |
|
/assign @vaikas-google |
|
knative/eventing-contrib#404 removes the old k8s source. |
|
|
||
| // This is really bad. | ||
| gvr, _ := meta.UnsafeGuessKindToResource(gvk) | ||
| gvr, _ := meta.UnsafeGuessKindToResource(schema.GroupVersionKind{Kind: kind, Group: gv.Group, Version: gv.Version}) |
There was a problem hiding this comment.
re, the comment above, is there a TODO here?
| go func() { | ||
| err = a.Start(stopCh) | ||
| }() | ||
| time.Sleep(1 * time.Millisecond) |
There was a problem hiding this comment.
is this just to make sure we yield the processor? Perhaps use runtime.GoSched() instead?
There was a problem hiding this comment.
it turns out the test does not work, I am not sure how to get the cache to do it's thing so I am going to skip the test with a TODO for now.
| if len(a.controlledGVRs) > 0 { | ||
| object := obj.(*unstructured.Unstructured) | ||
| gvk := object.GroupVersionKind() | ||
| // This is really bad. |
There was a problem hiding this comment.
it is the tragedy of kubernetes.
| // Mode is the mode the receive adapter controller runs under: Ref or Resource. | ||
| // `Ref` sends only the reference to the resource. | ||
| // `Resource` send the full resource. | ||
| Mode string `json:"mode,omitempty"` |
There was a problem hiding this comment.
Shouldn't this be validated somewhere?
There was a problem hiding this comment.
it defaults to ref if set to a random thing, see the Trash test.
There was a problem hiding this comment.
Yes, but it would be better if we could validate it when the resource is created.
There was a problem hiding this comment.
Ah got it. How about we do a followup to wire in the event sources into the webhook and implement the validatable stuff?
| ListFunc: asUnstructuredLister(a.k8s.Resource(gvrc.GVR).Namespace(a.namespace).List), | ||
| WatchFunc: asUnstructuredWatcher(a.k8s.Resource(gvrc.GVR).Namespace(a.namespace).Watch), | ||
| } | ||
| informer = cache.NewSharedIndexInformer(lw, &unstructured.Unstructured{}, resyncPeriod, cache.Indexers{ |
There was a problem hiding this comment.
@n3wscott have you considered getting rid of the informer altogether and use only Reflector?
There was a problem hiding this comment.
This is a great idea. Thanks! Worked it in and updated.
There was a problem hiding this comment.
My understanding is that the informer will remove some possible duplicate information and give some serialization for us, but mayhaps for what we're doing here it's fine.
|
The following is the coverage report on pkg/.
|
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: n3wscott, vaikas-google 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 |
|
Leaving lgtm to @lionelvillard since he too had some comments about it so don't want to merge underneath... |
|
it's working for me. /lgtm |
|
@lionelvillard: changing LGTM is restricted to assignees, and only knative/eventing repo collaborators may be assigned issues. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
let me try, apparently your lgtm didn't make it... /lgtm |
* working through using the informer directly. * getting closer.: * working. * cleanup. * Working with controller flag. * add todo. * newline. * fix the test. * fix format. * adding tests for event generation. * Adding tests for ref and resource adapter event emitters. * add adapter tests. * trying to fix the tests but the cache is not playing with the fakes nicely. * update lock. * Use cache reflector. * fix race.
Proposed Changes
Release Note