diff --git a/cmd/cube/app/options/flags/apiserver.go b/cmd/cube/app/options/flags/apiserver.go index d884f7528..57d1bd825 100644 --- a/cmd/cube/app/options/flags/apiserver.go +++ b/cmd/cube/app/options/flags/apiserver.go @@ -41,6 +41,11 @@ func init() { Value: 7777, Destination: &CubeOpts.APIServerOpts.GenericPort, }, + &cli.BoolFlag{ + Name: "enable-swag", + Value: false, + Destination: &CubeOpts.APIServerOpts.SwagEnable, + }, &cli.StringFlag{ Name: "tls-cert", Destination: &CubeOpts.APIServerOpts.TlsCert, diff --git a/docs/changelog.md b/docs/changelog.md index 6e85c1135..28fa79946 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,3 +1,22 @@ +# v1.8.9 + +## BugFix +- Add switch for swag [#336](https://github.com/kubecube-io/KubeCube/pull/336) + +## Dependencies + +- hnc v1.0 +- nginx-ingress v0.46.0 +- helm 3.5 +- metrics-server v0.4.1 +- elasticsearch 7.8 +- kubecube-monitoring 15.4.8 +- thanos 3.18.0 +- logseer v1.0.0 +- logagent v1.0.0 +- kubecube-audit v1.2.0 +- kubecube-webconsole v1.2.4 + # v1.8.8 ## BugFix diff --git a/pkg/apiserver/apiserver.go b/pkg/apiserver/apiserver.go index a13011717..83cf8b5fd 100644 --- a/pkg/apiserver/apiserver.go +++ b/pkg/apiserver/apiserver.go @@ -140,9 +140,12 @@ func withSimpleServer(s *APIServer) *APIServer { router := gin.New() router.Use(gin.Recovery()) - // The url pointing to API definition - url := ginSwagger.URL("/swagger/doc.json") - router.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler, url)) + if s.SwagEnable { + // The url pointing to API definition + url := ginSwagger.URL("/swagger/doc.json") + router.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler, url)) + } + router.GET("/healthz", healthz.HealthyCheck) s.SimpleServer = &http.Server{ diff --git a/pkg/apiserver/config.go b/pkg/apiserver/config.go index cca84922f..31879e4fb 100644 --- a/pkg/apiserver/config.go +++ b/pkg/apiserver/config.go @@ -42,6 +42,7 @@ type HttpConfig struct { InsecurePort int `yaml:"insecurePort,omitempty"` SecurePort int `yaml:"securePort, omitempty"` GenericPort int `yaml:"genericPort,omitempty"` + SwagEnable bool `yaml:"swagEnable,omitempty"` TlsCert string `yaml:"tlsCert,omitempty"` TlsKey string `yaml:"tlsKey,omitempty"` CaCert string `yaml:"caCert,omitempty"`