From 5613a1739d56be852abff78f7e2ebbed71c60ed2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Wei=C3=9Fe?= Date: Thu, 1 Feb 2024 13:53:56 +0100 Subject: [PATCH] Rename installWebhook function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Daniel Weiße --- cli/internal/cmd/install.go | 7 ++++--- cli/internal/cmd/install_test.go | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cli/internal/cmd/install.go b/cli/internal/cmd/install.go index c6d23078..1a562a80 100644 --- a/cli/internal/cmd/install.go +++ b/cli/internal/cmd/install.go @@ -107,7 +107,7 @@ func cliInstall(cmd *cobra.Command, helmClient *helm.Client, kubeClient kubernet var webhookSettings []string if !flags.disableInjection { - webhookSettings, err = installWebhook(cmd, kubeClient, cmChecker, namespace) + webhookSettings, err = installWebhookCerts(cmd, kubeClient, cmChecker, namespace) if err != nil { return errorAndCleanup(cmd.Context(), fmt.Errorf("installing webhook certs: %w", err), kubeClient, namespace) } @@ -139,8 +139,9 @@ func cliInstall(cmd *cobra.Command, helmClient *helm.Client, kubeClient kubernet return nil } -// installWebhook enables a mutating admission webhook to allow automatic injection of values into pods. -func installWebhook(cmd *cobra.Command, kubeClient kubernetes.Interface, cmChecker cmapichecker.Interface, namespace string) ([]string, error) { +// installWebhookCerts sets up TLS certificates and keys required by MarbleRun's mutating admission webhook. +// Depending on the cluster, either a certificate issued by cert-manager or a self-created certificate using the Kubernetes API is used. +func installWebhookCerts(cmd *cobra.Command, kubeClient kubernetes.Interface, cmChecker cmapichecker.Interface, namespace string) ([]string, error) { cmd.Print("Setting up MarbleRun Webhook") if err := cmChecker.Check(cmd.Context()); err == nil { diff --git a/cli/internal/cmd/install_test.go b/cli/internal/cmd/install_test.go index 5be84263..462e6b50 100644 --- a/cli/internal/cmd/install_test.go +++ b/cli/internal/cmd/install_test.go @@ -159,7 +159,7 @@ func TestInstallWebhook(t *testing.T) { var out bytes.Buffer cmd.SetOut(&out) - testValues, err := installWebhook(cmd, tc.kubeClient, tc.cmChecker, helm.Namespace) + testValues, err := installWebhookCerts(cmd, tc.kubeClient, tc.cmChecker, helm.Namespace) tc.assert(t, testValues, err) }) }