From e56abbdc81c211124a9da356e73967ebaaeb95c3 Mon Sep 17 00:00:00 2001 From: niusmallnan Date: Fri, 22 Jul 2022 15:39:00 +0800 Subject: [PATCH] K-EXPLORER: support --insecure-skip-tls-verify like kubectl --- pkg/server/cli/clicontext.go | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/pkg/server/cli/clicontext.go b/pkg/server/cli/clicontext.go index ec098bf..e468b69 100644 --- a/pkg/server/cli/clicontext.go +++ b/pkg/server/cli/clicontext.go @@ -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)...)