From dc4ecb6b91a5322003b1ff554919362793c9c4db Mon Sep 17 00:00:00 2001 From: Erin Call Date: Fri, 20 Dec 2019 16:09:57 -0800 Subject: [PATCH 1/2] Allow an empty Certificate setting [#29] I just plain misunderstood how kubernetes CAs worked! --- internal/run/initkube.go | 3 --- internal/run/initkube_test.go | 7 ------- 2 files changed, 10 deletions(-) diff --git a/internal/run/initkube.go b/internal/run/initkube.go index 4af29af..a341dca 100644 --- a/internal/run/initkube.go +++ b/internal/run/initkube.go @@ -50,9 +50,6 @@ func (i *InitKube) Prepare(cfg Config) error { if i.Token == "" { return errors.New("token is needed to deploy") } - if i.Certificate == "" && !i.SkipTLSVerify { - return errors.New("certificate is needed to deploy") - } if i.ServiceAccount == "" { i.ServiceAccount = "helm" diff --git a/internal/run/initkube_test.go b/internal/run/initkube_test.go index fb32b15..09dc4df 100644 --- a/internal/run/initkube_test.go +++ b/internal/run/initkube_test.go @@ -134,13 +134,6 @@ func (suite *InitKubeTestSuite) TestPrepareRequiredConfig() { init.APIServer = "Sysadmin" init.Token = "" suite.Error(init.Prepare(cfg), "Token should be required.") - - init.Token = "Aspire virtual currency" - init.Certificate = "" - suite.Error(init.Prepare(cfg), "Certificate should be required.") - - init.SkipTLSVerify = true - suite.NoError(init.Prepare(cfg), "Certificate should not be required if SkipTLSVerify is true") } func (suite *InitKubeTestSuite) TestPrepareDefaultsServiceAccount() { From 044caebafd48ea6c8ad44c232f69e7d7fa0ecf17 Mon Sep 17 00:00:00 2001 From: Erin Call Date: Fri, 20 Dec 2019 16:14:17 -0800 Subject: [PATCH 2/2] Omit empty CA data from the kubeconfig [#29] --- kubeconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kubeconfig b/kubeconfig index c7b2025..92ec2c7 100644 --- a/kubeconfig +++ b/kubeconfig @@ -3,7 +3,7 @@ clusters: - cluster: {{- if eq .SkipTLSVerify true }} insecure-skip-tls-verify: true -{{- else }} +{{- else if .Certificate }} certificate-authority-data: {{ .Certificate }} {{- end}} server: {{ .APIServer }}