Skip to content

Commit

Permalink
Rename installWebhook function
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Weiße <[email protected]>
  • Loading branch information
daniel-weisse committed Feb 1, 2024
1 parent 734b7b5 commit 5613a17
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions cli/internal/cmd/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion cli/internal/cmd/install_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
}
Expand Down

0 comments on commit 5613a17

Please sign in to comment.