Added enable function to schemas. This allows filtering of schemas
which is a required part of feature flagging in rancher. Added
addFeature functions to controller template for adding handlers that
can be disabled if their associated feature is disabled.
Problem: Cluster scoped gc was taking significantly longer to complete
than before 7387aa5. This was due to a large number of list calls and
the time needed to iterate over them.
Solution: Instead of requesting every type than Rancher uses, a
seperate map appended to when a cluster scoped handler
is created. The full map of all GroupVersionResources is kept as a
fallback for the use case where user controllers may exist on another
host other than the current leader.
Problem: Cluster scoped handlers were not being cleaned up without
manually writing garbage collection functions.
Solution: All cluster scoped handlers will be recorded in a global map
in a generic format so that they can be removed by a generic function.
Now, identifies and assigns namespaces. Prior, the
backend listed items belongng to all namespaces in
all projects no matter what because they were not
being tracked. This led to longer request times
for projects that contained a fraction of total
resources. Now, rancher can filter project
resource requests; times are improved and
largely dependent on resource amount for the given
project.
There is now a recognized option for opting out of pagination.
Prior, passing a limit of -1 would set the pagination limit to
the default, 1000. Now, a value of -1 will set the pagination
limit to the max, likely resulting in a non paginated response.
In the old code, `resp` defined at line 215 will be rewrite at line 241. So that the `resp` after `defer` at both line 219 and 245 will operate the same one. And the other on leaks.
This change makes it so that schemas can be replaced when they already exist.
This is to support the ability for kontainer drivers to update their dynamic
schemas.
Issue:
https://github.com/rancher/rancher/issues/17712
Problem:
If you set a resource's labels to a global/shared map variable,
norman will modify that map by adding a label. In race conditions,
this can cause a concurrent map read/write panic.
Solution:
Copy the map in norman before modifying it.
The defaul http server logs panics to the server's log handler.
That goes to debug level and thus panics are not seen when running
rancher at a normal log level.
This fixes the problem by catching the panic at the top level norman
http handler and logging them as errors there.