During the cache storage refactoring, all of the cache metrics
that were recorded via the backend.Reporter that wrapped the
cache backend were lost. This attempts to restore the metrics
as close to the original meaning as possible, though due to the
changes some labels are different and batch metrics don't apply.
The biggest change is in the top requests metrics which has
historically been based on the backend.Key, but since that
the cache no longer deals with backends, the metric is now labeled
by the resource kind. All existing dashboards and tctl top should
still work as expected.
The store now takes a clone function and uses it to clone all
resources within calls to put. This ensures that there are no races
caused by any modifications of the resource by the event stream.
This also allowed the clone function to be removed from the
genericGetter and genericLister as they can now leverage the store
clone function.
All header transforms now populate the kind and version based on
the information in the ResourceHeader instead of hardcoding the
currently known values.
All indexes derived from the resource name are specified
using `Resource.GetName` instead of defining a function in line
that called r.GetName(). The one caveat being this only works
for types that are behind an interface and none of the RFD 153
style resources.
The clone function of all non-gogo proto resources were switched
from utils.CloneProtoMsg to proto.CloneOf. The clone utility is
only required to prevent panics when cloning gogo proto resources.
All remaining local resource caches have been removed.
All unused legacy executors have been removed.
Moves integrations, access monitoring rules, and plugin static
credentials to the new cache collection scheme that was introduced
in #52210. No additional functionality changes have been made here.
This should be a purely mechanical translation to the new internal
caching machinery.
Introduces an alternate to the legacyCollections and
genericCollection that relies on caching resource in memory. The
new collection[T] takes inspiration from the legacy collection types
but aims to both simplify and break reliance on using the local
storage services.
The two collection mechanisms will and can coexist until all types
are converted to the new mechanism. This includes an initial
conversion of static tokens, users, and cert authorities to prove
out the effectivenss of the strategy.
Additionally, during the conversion process some refactoring will
be done to try to better organize and reduce the size of cache.go.
In this PR all of the code specific to static tokens was moved
out of cache.go and legacy_collections.go and into static_tokens.go.
This will allow separating concerns and making it much easier to
identify where specific content lives.