kubernetes / kubernetes

Production-Grade Container Scheduling and Management
https://kubernetes.io
Apache License 2.0
111.43k stars 39.75k forks source link

Adding an OpenAPI Configuration Switch #122039

Open 113xiaoji opened 1 year ago

113xiaoji commented 1 year ago

What would you like to be added?

I'd like to add a configuration switch to disable open api v2 and open api v3.

for example , expose SkipOpenAPIInstallation config .

Why is this needed?

In our highly minimalistic usage scenario, it's feasible to trim down non-core functionalities. Analysis via pprof of the apiserver stack revealed that openAPIAggregationController and openAPIV3AggregationController are consuming a significant amount of memory. Removing related code didn't impact the basic functions, and memory usage was reduced by over 400MB+. Research indicates these controllers handle OpenAPI V2/V3 documentation from various API services, including extensions and custom resources, merging them into a unified OpenAPI V2/V3 specification and document. My question is about the specific role of openapi. If I'm indifferent to the absence or outdated nature of OpenAPI documentation, is it viable to eliminate the openapi related code?

neolit123 commented 1 year ago

/sig api-machinery

jiahuif commented 1 year ago

/assign @Jefftree Could you take a look? Thank you. /triage accepted

Jefftree commented 1 year ago

We are aware of the high memory consumption by OpenAPI and have made quite a bit of effort in the last couple of releases to reduce it eg: https://github.com/kubernetes/kubernetes/pull/118212, https://github.com/kubernetes/kubernetes/pull/118808, https://github.com/kubernetes/kubernetes/pull/118204.

OpenAPI V3 is a GA feature with some dependencies that may break if it is disabled (eg: server side apply, CEL, etc) so we do not support disabling it at the moment. However, the 400MB number does seem quite high, can I ask for how many additional resources (CRDs, aggregated apiservers) your cluster is supporting?

k8s-triage-robot commented 2 days ago

This issue has not been updated in over 1 year, and should be re-triaged.

You can:

For more details on the triage process, see https://www.kubernetes.dev/docs/guide/issue-triage/

/remove-triage accepted