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

Point out how to ObjectRef in relations #45

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/controllers/relations.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ Controller::new(main, watcher::Config::default())

In this case we are extracing an object reference from the spec of our object. Regardless of how you get the information, your mapper must return an iterator of [ObjectRef] for the root object(s) that must be reconciled as a result of the change.

!!! note "Creating an `ObjectRef<K>`"

An [ObjectRef] is a generic variant of [ObjectReference] that carries associated type information via generics. The internal controller reflectors use this to save memory by avoiding to type out repeat information.
To construct one from an object, see the [ObjectRef methods](https://docs.rs/kube/latest/kube/runtime/reflector/struct.ObjectRef.html#implementations). To construct one from an [ObjectReference], see ???

As a theoretical example; every [HPA](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/) object bundles a scale ref to the workload, so you could use this to build a Controller for `Deployment` using HPA as a watched object.

!!! note "Streams Variant"
Expand Down
1 change: 1 addition & 0 deletions includes/links.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
[Controller::run]: https://docs.rs/kube/latest/kube/runtime/struct.Controller.html#method.run
[ReconcileReason]: https://docs.rs/kube/latest/kube/runtime/controller/enum.ReconcileReason.html
[ObjectRef]: https://docs.rs/kube/latest/kube/runtime/reflector/struct.ObjectRef.html
[ObjectReference]: https://docs.rs/k8s-openapi/latest/k8s_openapi/api/core/v1/struct.ObjectReference.html
[applier]: https://docs.rs/kube/latest/kube/runtime/fn.applier.html
[Api]: https://docs.rs/kube/latest/kube/struct.Api.html
[Client]: https://docs.rs/kube/latest/kube/struct.Client.html
Expand Down