Reduce load on the Kubernetes API server and reduce the peak memory use of the cert-manager components by enabling the use of the WatchList (Streaming Lists) feature#7175
Conversation
|
@wallrj we are now using the v0.31.0 client-go libraries. |
|
/kind bug |
cd44551 to
75f28b0
Compare
| // features are wired to the existing --feature-gates flag just as all other features | ||
| // are. Further, client-go features automatically support the existing mechanisms for | ||
| // feature enablement metrics and test overrides. | ||
| ca := &clientAdapter{utilfeature.DefaultMutableFeatureGate} |
There was a problem hiding this comment.
Maybe we should add this to cainjector and the webhook too?
Signed-off-by: Richard Wall <richard.wall@venafi.com>
75f28b0 to
9ed80cf
Compare
wallrj
left a comment
There was a problem hiding this comment.
There are currently two client-go features:
-
InformerResourceVersion: Related to Storage Version Migration. See kubernetes/kubernetes#123344 -
WatchListClient: Related to streaming list feature. See kubernetes/kubernetes#122791
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: inteon The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
| # | ||
| # - https://kind.sigs.k8s.io/docs/user/configuration/#feature-gates | ||
| # - https://kubernetes.io/docs/reference/using-api/api-concepts/#streaming-lists | ||
| WatchList: true |
There was a problem hiding this comment.
This broke the K8S 1.25 and 1.26 E2E tests because the WatchList feature was added in 1.27.
We've decided to remove support for 1.25 and 1.26 in cert-manager 1.16.
See:
There was a problem hiding this comment.
*not test, we might still support those versions
|
/kind feature |
Allow cert-manager users to enable the
WatchListClientfeature in client-go, so that they can experiment with the feature and evaluate its effect on the memory usage of the components.They will also have to enable the
WatchListfeature of their Kubernetes API server.Copying the technique and copying some of the code used by the kube-controller-manager. See:
The following comment from a K8S contributor says:
Fixes: #3748
Background
Release Note
Testing
Memory reduction in a Kind cluster
I deployed cert-manager from master and from this branch in a Kind cluster with 100MiB Secret resources.
Measured the peak memory usage of all controller, cainjector, webhook using the
VmHWMfile in/proc/*/status.See https://gist.github.com/wallrj/f15ad450f1b3effb107db5e6a01bf03f
Log messages
With
--feature-gates=ClientWatchList=trueand--v 6you'll see the WATCH requests with the following query string parameters:resourceVersionMatch=NotOlderThansendInitialEvents=trueCommand Line Flags
You'll see the following new features among the feature flags help output.
Testing cert-manager 1.15
I took the 1.15 binaries and enabled the client watch list feature using the old
ENABLE_CLIENT_GO_WATCH_LIST_ALPHAenvironment variable.With 100MiB of Secrets