crossplane-contrib/provider-kubernetes

Implement extracted state cache to avoid SSA dry run calls

Closed this issue · 1 comments

What problem are you facing?

#246 introduces support for SSA (server side apply) as an alpha feature. It includes a workaround for kubernetes/kubernetes#115563 which utilizes a dry run request to decide whether the resources is in the desired state or not. This will be executed in each reconciliation, in the Observe method.

How could Crossplane help solve your problem?

We could avoid that dry run request by implementing a cache holding extracted state for a given desired state (e.g. spec.forProvidder.manifest), very roughly:

  1. Get the object from controller runtime cache.
  2. Extract state using applymetav1.UnstructuredExtractor.
  3. Get the cached extracted state for the current desired state (spec.forProvidder.manifest).
  4. If they differ, object is not up to date.
  5. Apply again, extract state and update the cache.

#246 was extended to address extracted state cache and merged.