K-EXPLORER: support --insecure-skip-tls-verify like kubectl

This commit is contained in:
niusmallnan 2022-07-22 15:39:00 +08:00
parent 62d6de019d
commit e56abbdc81

View File

@ -14,11 +14,12 @@ import (
)
type Config struct {
KubeConfig string
Context string
HTTPSListenPort int
HTTPListenPort int
UIPath string
KubeConfig string
Context string
HTTPSListenPort int
HTTPListenPort int
UIPath string
InsecureSkipTLSVerify bool
WebhookConfig authcli.WebhookConfig
}
@ -42,6 +43,13 @@ func (c *Config) ToServer(ctx context.Context) (*server.Server, error) {
}
restConfig.RateLimiter = ratelimit.None
// K-EXPLORER
restConfig.Insecure = c.InsecureSkipTLSVerify
if restConfig.Insecure {
restConfig.CAData = nil
restConfig.CAFile = ""
}
if c.WebhookConfig.WebhookAuthentication {
auth, err = c.WebhookConfig.WebhookMiddleware()
if err != nil {
@ -84,6 +92,10 @@ func Flags(config *Config) []cli.Flag {
Value: 9080,
Destination: &config.HTTPListenPort,
},
cli.BoolFlag{
Name: "insecure-skip-tls-verify",
Destination: &config.InsecureSkipTLSVerify,
},
}
return append(flags, authcli.Flags(&config.WebhookConfig)...)