diff --git a/docs/controllers/relations.md b/docs/controllers/relations.md index 20681798..0fccf883 100644 --- a/docs/controllers/relations.md +++ b/docs/controllers/relations.md @@ -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`" + + 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" diff --git a/includes/links.md b/includes/links.md index 75185307..0a3728ea 100644 --- a/includes/links.md +++ b/includes/links.md @@ -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