-
-
Notifications
You must be signed in to change notification settings - Fork 326
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
Align event Recorder with Controller #812
Comments
A reason that we use If we change our inteface to use |
I'm not saying we should lose features. Anything that |
This covers step 1 and 2 of kube-rs#812, allowing `ObjectRef` objects to be used for emitting events to a `Recorder`.
This covers step 1 and 2 of kube-rs#812, allowing `ObjectRef` objects to be used for emitting events to a `Recorder`. Signed-off-by: Teo Klestrup Röijezon <[email protected]>
Trying to summarise to see if there's anything here we should do. We can create and convert (and conversions carry uids):
however we cannot easily convert between an alignment; fully aligning these is not super practical, since they have different use cases:
We could maybe make the recorder (et al) take an I suggest we do the following two things:
|
It's far from standardized though (#1310 (reply in thread) has a very incomplete list). I'm also not convinced that there is such a thing as a universal valid My current thought process would be something like this: struct LocalObjectRef<K> {
name: String,
dt: &K::UnversionedDynType,
}
struct ClusterObjectRef<K> {
name: String,
namespace: K::Namespace,
dt: &K::UnversionedDynType,
}
struct ResolvedObjectRef<K> {
name: String,
namespace: K::Namespace,
dt: &K::DynType,
}
impl<K> LocalObjectRef<K> {
fn in_namespace(self, ns: impl Into<String>) -> ClusterObjectRef<K>;
fn in_namespace_of<K2>(self, obj: &K2) -> ClusterObjectRef<K> where K2: Resource<Scope = K::Scope>;
}
impl ClusterObjectRef<DynamicObject> {
fn with_version(self, version: impl Into<String>) -> ResolvedObjectRef<DynamicObject>;
fn with_recommended_version(self, discovery: &Discovery) -> Result<ResolvedObjectRef<DynamicObject>>;
// return Some if K's API group and kind match self.dt
// probably need to either take `self` by ref or return the COR in the error case...
fn try_match_type<K>(self) -> Option<ResolvedObjectRef<K>>;
}
impl<K> ClusterObjectRef<K> where K: Resource<DynamicType = ()> {
// not a fan of having to do this explicitly tbh..
fn with_typed_version(self) -> ResolvedObjectRef<K>;
} |
Would you like to work on this feature?
yes
What problem are you trying to solve?
Currently,
Controller.run()
returnsObjectRef<K>
objects, whileRecorder
takesObjectReference
s. These mostly fulfil the same purpose, but are currently incompatible. In particular, the type fields ofObjectRef<K>
are hidden from the user, andObjectRef<K>
does not track UIDs. On the other hand,ObjectRef<K>
provides nicer string formatting, is slightly more efficient, and offers optional type safety.Describe the solution you'd like
ObjectRef
ObjectRef<K>
intoObjectReference
Recorder
takeObjectRef<K>
rather thanObjectReference
Describe alternatives you've considered
We could also standardize on
ObjectReference
, but I'm not sure the drawbacks there are worth it.Documentation, Adoption, Migration Strategy
Should object UIDs participate in
ObjectRef
equality? I'm inclined to say no for backwards compatibility reasons, but that would be inconsistent withObjectReference
.Perhaps a middle ground would be to say that they participate in equality IFF
uid.is_some()
on both sides, but that also feels like a bit of a footgun...Target crate for feature
kube-runtime
The text was updated successfully, but these errors were encountered: