From ac40b0f0f0b5023f49bbafbd1558a90160d912a0 Mon Sep 17 00:00:00 2001 From: huiwq1990 Date: Thu, 9 Nov 2023 19:22:14 +0800 Subject: [PATCH] support openapi v2 for compatibility lower kubernete versions Signed-off-by: huiwq1990 --- cmd/apiserver/app/options/options.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/apiserver/app/options/options.go b/cmd/apiserver/app/options/options.go index 6c9d6a1c9..875f43566 100644 --- a/cmd/apiserver/app/options/options.go +++ b/cmd/apiserver/app/options/options.go @@ -100,6 +100,10 @@ func (o *ClusterPediaServerOptions) Config() (*apiserver.Config, error) { genericConfig := genericapiserver.NewRecommendedConfig(apiserver.Codecs) + genericConfig.OpenAPIConfig = genericapiserver.DefaultOpenAPIConfig(generatedopenapi.GetOpenAPIDefinitions, openapinamer.NewDefinitionNamer(apiserver.Scheme)) + genericConfig.OpenAPIConfig.Info.Title = "clusterpedia apiserver" + genericConfig.OpenAPIConfig.Info.Version = "" + genericConfig.OpenAPIV3Config = genericapiserver.DefaultOpenAPIV3Config(generatedopenapi.GetOpenAPIDefinitions, openapinamer.NewDefinitionNamer(apiserver.Scheme)) genericConfig.OpenAPIV3Config.Info.Title = "clusterpedia apiserver" genericConfig.OpenAPIV3Config.Info.Version = ""