Skip to content

Commit

Permalink
Add switch for swag (#336)
Browse files Browse the repository at this point in the history
* feat: adapt remove hnc

* add swag switch

* add v1.8.9 changelog
  • Loading branch information
weilaaa authored Sep 8, 2023
1 parent c29ea97 commit 5120418
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 3 deletions.
5 changes: 5 additions & 0 deletions cmd/cube/app/options/flags/apiserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
19 changes: 19 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
9 changes: 6 additions & 3 deletions pkg/apiserver/apiserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
1 change: 1 addition & 0 deletions pkg/apiserver/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down

0 comments on commit 5120418

Please sign in to comment.