Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

when apiserver cache is not ready, the List request with resourceVersion=0 fetch data from the apiserver cache #124818

Open
olderTaoist opened this issue May 11, 2024 · 2 comments
Labels
kind/feature Categorizes issue or PR as related to a new feature. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@olderTaoist
Copy link
Contributor

What would you like to be added?

when apiserver cache is not ready, the List request with resourceVersion=0 fetch data from the apiserver cache, don't directly obtain from etcd.

staging/src/k8s.io/apiserver/pkg/storage/cacher/cacher.go

func (c *Cacher) GetList(ctx context.Context, key string, opts storage.ListOptions, listObj runtime.Object) error {
	recursive := opts.Recursive
	resourceVersion := opts.ResourceVersion
	pred := opts.Predicate
	if shouldDelegateList(opts) {
		return c.storage.GetList(ctx, key, opts, listObj)
	}

	listRV, err := c.versioner.ParseResourceVersion(resourceVersion)
	if err != nil {
		return err
	}
	if listRV == 0 && !c.ready.check() {
		// If Cacher is not yet initialized and we don't require any specific
		// minimal resource version, simply forward the request to storage.
		return c.storage.GetList(ctx, key, opts, listObj)
	}
}

Why is this needed?

In our cluster, the number of some resources like pods are very large(300k+), the number of node is 7k+. the apiserver cache sometime accumulating lag, the kubelet List request of get pod directly obtain from etcd. It consumes lots of cpu & memory that's not expected. i want List request to fetch data from the apiserver cache like ConsistentListFromCache feature gate

@olderTaoist olderTaoist added the kind/feature Categorizes issue or PR as related to a new feature. label May 11, 2024
@k8s-ci-robot k8s-ci-robot added needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels May 11, 2024
@olderTaoist
Copy link
Contributor Author

/sig api-machinery
/cc @wojtek-t @serathius

@k8s-ci-robot k8s-ci-robot added sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels May 11, 2024
@cici37
Copy link
Contributor

cici37 commented May 30, 2024

/triage accepted
Might have a little duplicated context with #124724

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

No branches or pull requests

3 participants