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

What Is the Meaning of "Updating CRD OpenAPI spec because xxx changed" in the apiserver Log? #124611

Closed
kangzhiqin opened this issue Apr 29, 2024 · 6 comments
Labels
kind/support Categorizes issue or PR as a support question. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery.

Comments

@kangzhiqin
Copy link

kangzhiqin commented Apr 29, 2024

What would you like to be added?

The apiserver prints a crd update log every 5 minutes. What does this mean? What is the triggering process?

Why is this needed?

klog.V(2).Infof("Updating CRD OpenAPI spec because %s changed", name)

@kangzhiqin kangzhiqin added the kind/feature Categorizes issue or PR as related to a new feature. label Apr 29, 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 Apr 29, 2024
@k8s-ci-robot
Copy link
Contributor

This issue is currently awaiting triage.

If a SIG or subproject determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@neolit123
Copy link
Member

/sig api-machinery

@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 Apr 29, 2024
@HirazawaUi
Copy link
Contributor

/remove-kind feature
/kind support

@k8s-ci-robot k8s-ci-robot added kind/support Categorizes issue or PR as a support question. and removed kind/feature Categorizes issue or PR as related to a new feature. labels Apr 29, 2024
@kangzhiqin
Copy link
Author

The principle has been figured out. After the CRD is created, the APIServer updates the cached log records after the change.

@danijam
Copy link

danijam commented Jun 3, 2024

@kangzhiqin We are also seeing this also but still don't understand why... The CRDs haven't changed? Or at least not to my knowledge so confused why we see hundreds of log lines every 5 mins that strikes me as kube-apiserver doing lots of work with the OpenAPI Spec that it doesn't need too?

@kangzhiqin
Copy link
Author

@kangzhiqin We are also seeing this also but still don't understand why... The CRDs haven't changed? Or at least not to my knowledge so confused why we see hundreds of log lines every 5 mins that strikes me as kube-apiserver doing lots of work with the OpenAPI Spec that it doesn't need too?

When the CRD informer is created, the full synchronization mechanism is set to be performed every 5 minutes. The log is the evidence of full synchronization. I want you to focus on line 175 here.

apiGroupInfo.VersionedResourcesStorageMap[v1.SchemeGroupVersion.Version] = storage
}
if err := s.GenericAPIServer.InstallAPIGroup(&apiGroupInfo); err != nil {
return nil, err
}
crdClient, err := clientset.NewForConfig(s.GenericAPIServer.LoopbackClientConfig)
if err != nil {
// it's really bad that this is leaking here, but until we can fix the test (which I'm pretty sure isn't even testing what it wants to test),
// we need to be able to move forward
return nil, fmt.Errorf("failed to create clientset: %v", err)
}
s.Informers = externalinformers.NewSharedInformerFactory(crdClient, 5*time.Minute)
delegateHandler := delegationTarget.UnprotectedHandler()
if delegateHandler == nil {
delegateHandler = http.NotFoundHandler()
}
versionDiscoveryHandler := &versionDiscoveryHandler{
discovery: map[schema.GroupVersion]*discovery.APIVersionHandler{},
delegate: delegateHandler,
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/support Categorizes issue or PR as a support question. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery.
Projects
None yet
Development

No branches or pull requests

5 participants