Skip to content
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

Support source.Kind for unstructured objects #17

Closed
pwittrock opened this issue Jun 11, 2018 · 8 comments · Fixed by #101
Closed

Support source.Kind for unstructured objects #17

pwittrock opened this issue Jun 11, 2018 · 8 comments · Fixed by #101

Comments

@pwittrock
Copy link
Contributor

We should be able to watch for objects against unstructured objects from source.Kind.

  • Make the client work
  • Make the cache work
  • Make watch work
@shawn-hurley
Copy link

I am interested in helping with this issue. I was wondering if you had thoughts on how to handle this already or if a design doc or something similar has been created?

@pwittrock
Copy link
Contributor Author

@shawn-hurley Not yet, though I think the interface shouldn't change, it should just accept unstructured objects. Would you be willing to put together a 1-2 page doc on the topic before getting started?

From a high level:

  • The client commands and controller.Watch / source. Kind should accept unstructured objects (they already do)
    • Unstructured objects must have the GVK specified in the object
    • client / source should work with the unstructured object the way they would with other runtime.Objects

One question is whether the cache should be shared between unstructured and hard-coded objects for the same GVK. As long as it is consistent and predictable I think either way is good.

@pwittrock
Copy link
Contributor Author

@shawn-hurley FWIW, this might already work. I think the first task is to try it and see if it works or not, then dig in deeper.

@shawn-hurley
Copy link

@pwittrock I think that it would work with a single unstructured type, but if you used two then the client-cache: https://github.com/kubernetes-sigs/controller-runtime/blob/master/pkg/client/client_cache.go#L79-L84 will overwrite the GVK for one fo the types.

Am I correct in that reading of the code?

I will work on getting an example to test this theory as well.

Thanks!

@DirectXMan12
Copy link
Contributor

aah, yeah, we probably would need a key that's like TypeOf(obj) unless IsUnstructured(obj) else SpecialUnstructuredKeyWithKind.

@DirectXMan12
Copy link
Contributor

or have a separate map for unstructured objects.

@shawn-hurley
Copy link

@pwittrock @DirectXMan12 I am working on getting an example of using two different unstructured types to test this theory out and to have something to test with.

Which would you prefer the second map if the type is Unstructured or some other mechanism? I would think that two maps might make it more clear?

@DirectXMan12
Copy link
Contributor

Two maps is probably clearer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants