-
Notifications
You must be signed in to change notification settings - Fork 111
Support status subresource and ObservedGeneration. #26
Comments
What about comparing the |
The |
Another requirement for the design of this feature came up while talking to @danisla, and it applies both to CRDs and built-in resources that have If the hook response tries to set something in
Historically, there was not much point to choosing option 2 because updating status on your child objects was considered an anti-pattern, as your changes would generally be clobbered by the child object's own controller anyway. However, there are now new patterns developing, such as Pod Ready++, where it does make sense to update the status of a child object. |
@enisoc Thanks for the summary. For resolving this issue, I prefer option 1 (Pod Ready++ is not GA yet). |
Now that we have support for /status in both CRD and the dynamic client, we should use /status whenever it's available.
As of k8s 1.10, /status for CRD is behind an alpha feature gate, and is also optional on a per-CRD basis. If we neglect to use /status when it's available, our status update will be silently ignored. If we try to use /status when it's not available, our status update will fail. We should be able to tell whether /status is available for a given resource by looking at discovery, without requiring the user to configure anything on the Metacontroller side (they'll just enable /status in the CRD itself).
We should also set
status.observedGeneration
now that CRD is capable of incrementingmetadata.generation
(if the /status subresource is enabled for that CRD).https://github.com/kstmp/metacontroller/blob/8c2b6730d8db89c5eba31bf180ebd9fbe93b3a5c/controller/composite/controller.go#L256-L271
Lastly, for controllers that support ObservedGeneration, we can consider an optimization to avoid syncing if the controller object is updated, but the spec hasn't changed (ObservedGeneration = Generation). For example, we currently might trigger a sync as a result of updating our own status.
The text was updated successfully, but these errors were encountered: