Skip to content

Commit

Permalink
Fix default webhook port in test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
afritzler committed Oct 30, 2024
1 parent 350bd4b commit ba3d8a4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions internal/controller/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import (
"testing"
"time"

"sigs.k8s.io/controller-runtime/pkg/webhook"

"k8s.io/utils/ptr"
"sigs.k8s.io/controller-runtime/pkg/config"

Expand Down Expand Up @@ -123,13 +125,19 @@ func SetupTest() *corev1.Namespace {
Expect(k8sClient.Create(ctx, ns)).To(Succeed(), "failed to create test namespace")
DeferCleanup(k8sClient.Delete, ns)

webhookInstallOptions := &testEnv.WebhookInstallOptions
k8sManager, err := ctrl.NewManager(cfg, ctrl.Options{
Scheme: scheme.Scheme,
Controller: config.Controller{
// need to skip unique controller name validation
// since all tests need a dedicated controller
SkipNameValidation: ptr.To(true),
},
WebhookServer: webhook.NewServer(webhook.Options{
Host: webhookInstallOptions.LocalServingHost,
Port: 8082,
CertDir: webhookInstallOptions.LocalServingCertDir,
}),
})
Expect(err).ToNot(HaveOccurred())

Expand Down

0 comments on commit ba3d8a4

Please sign in to comment.