-
Notifications
You must be signed in to change notification settings - Fork 68
Home
Welcome to the cf-k8s-controllers wiki!
We want to avoid name collisions between our CRDs and those of other tools (e.g. kpack Builds). To avoid these collisions, we plan to prefix all of our CRDs with "CF". We should also set up short names for these resources. For example, CFBuild may have the alias "cfb".
kubebuilder uses the controller-runtime package for interactions with the k8s API, and this maintains a cache of k8s resources to reduce the number of API calls. Due to this cache, the resources returned by the client may be stale. For example, if you create or update a resource and then immediately Get it, the result may not reflect the change you just made. To address this problem the client methods that mutate objects will update the resource object passed to them to the latest state. Use this version instead of getting from the client.
Example:
controllerutil.CreateOrUpdate(ctx, r.Client, actualEiriniLRP, eiriniLRPMutateFunction(actualEiriniLRP, &desiredEiriniLRP))
// Do this
guid := actualEiriniLRP.UID
// Don't do this
r.Get(ctx, namespacedLRPName, staleLRP)
guid = staleLRP.UID