Skip to content

Improve shared streams interfacesΒ #1472

@mateiidavid

Description

@mateiidavid

Would you like to work on this feature?

yes

What problem are you trying to solve?

We added experimental support for shared stream interfaces in PR #1449. Although the change is code complete, it has some rough edges.

Improvements

  • Introduce a new type to do writes against the store.

    • All writes on a store are handled through Writer<K>. There are two different types of writers: those that are backed by a channel (and can distribute events to listeners) and those that are not. We should differentiate between these two different contracts by introducing an appropriate type for a "shared" writer. This will allow us to avoid awkward public interface, like the subscribe() method
  • Return a concrete type that implements Stream from reflector().

    • It would be good to try and change the type returned by a reflector(). Because a writer can now broadcast events to listeners, it has to call into an async function when a watcher stream is threaded through it. To keep it simple, we are using the stream! macro, but it tends to obfuscate the implementation. It would be nicer to deal with a concrete type here (which in turn might make subscribing easier)
  • Shared streams Controller interfaces for relations (watches_shared_stream and owns_shared_stream)

    • We should extend for_shared_stream in such a way that Controllers may accept shared streams for owned objects.

Parts of this have already been mentioned as future work in #1080.

Describe the solution you'd like

N/A

Describe alternatives you've considered

N/A

Documentation, Adoption, Migration Strategy

No response

Target crate for feature

kube-runtime

Metadata

Metadata

Assignees

No one assigned

    Labels

    runtimecontroller runtime relatedunstablefeature that unstable feature gating

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions