Skip to content
This repository was archived by the owner on Apr 17, 2025. It is now read-only.

Commit ac97676

Browse files
committed
revert changes to integration test setup
1 parent 7f11826 commit ac97676

File tree

1 file changed

+0
-40
lines changed

1 file changed

+0
-40
lines changed

internal/integtest/setup.go

-40
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,14 @@ import (
2323

2424
. "github.com/onsi/ginkgo/v2" //lint:ignore ST1001 Ignoring this for now
2525
. "github.com/onsi/gomega" //lint:ignore ST1001 Ignoring this for now
26-
apiadmissionregistrationv1 "k8s.io/api/admissionregistration/v1"
2726
corev1 "k8s.io/api/core/v1"
2827
apiextensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
29-
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
3028
"k8s.io/client-go/kubernetes/scheme"
31-
"k8s.io/utils/pointer"
3229
ctrl "sigs.k8s.io/controller-runtime"
3330
"sigs.k8s.io/controller-runtime/pkg/client"
3431
"sigs.k8s.io/controller-runtime/pkg/envtest"
3532
logf "sigs.k8s.io/controller-runtime/pkg/log"
3633
"sigs.k8s.io/controller-runtime/pkg/log/zap"
37-
"sigs.k8s.io/controller-runtime/pkg/webhook"
38-
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
39-
"sigs.k8s.io/hierarchical-namespaces/internal/objects"
40-
"sigs.k8s.io/hierarchical-namespaces/internal/webhooks"
4134

4235
// +kubebuilder:scaffold:imports
4336

@@ -76,28 +69,8 @@ func HNCBeforeSuite() {
7669
SetDefaultEventuallyTimeout(time.Second * 4)
7770

7871
By("configuring test environment")
79-
sideEffectClassNone := apiadmissionregistrationv1.SideEffectClassNone
8072
testEnv = &envtest.Environment{
8173
CRDDirectoryPaths: []string{filepath.Join("..", "..", "config", "crd", "bases")},
82-
WebhookInstallOptions: envtest.WebhookInstallOptions{
83-
ValidatingWebhooks: []*apiadmissionregistrationv1.ValidatingWebhookConfiguration{{
84-
ObjectMeta: metav1.ObjectMeta{
85-
Name: webhooks.ValidatingWebhookConfigurationName,
86-
},
87-
Webhooks: []apiadmissionregistrationv1.ValidatingWebhook{{
88-
Name: webhooks.ObjectsWebhookName,
89-
AdmissionReviewVersions: []string{"v1"},
90-
SideEffects: &sideEffectClassNone,
91-
ClientConfig: apiadmissionregistrationv1.WebhookClientConfig{
92-
Service: &apiadmissionregistrationv1.ServiceReference{
93-
Namespace: "system",
94-
Name: "webhook-service",
95-
Path: pointer.String(objects.ServingPath),
96-
},
97-
},
98-
}},
99-
}},
100-
},
10174
}
10275

10376
By("starting test environment")
@@ -121,20 +94,13 @@ func HNCBeforeSuite() {
12194
// CF: https://github.com/microsoft/azure-databricks-operator/blob/0f722a710fea06b86ecdccd9455336ca712bf775/controllers/suite_test.go
12295

12396
By("creating manager")
124-
webhookInstallOptions := &testEnv.WebhookInstallOptions
12597
k8sManager, err := ctrl.NewManager(cfg, ctrl.Options{
12698
NewClient: config.NewClient(false),
12799
MetricsBindAddress: "0", // disable metrics serving since 'go test' runs multiple suites in parallel processes
128100
Scheme: scheme.Scheme,
129-
Host: webhookInstallOptions.LocalServingHost,
130-
Port: webhookInstallOptions.LocalServingPort,
131-
CertDir: webhookInstallOptions.LocalServingCertDir,
132101
})
133102
Expect(err).ToNot(HaveOccurred())
134103

135-
// Register a dummy webhook since the test control plane is to test reconcilers
136-
k8sManager.GetWebhookServer().Register(objects.ServingPath, &webhook.Admission{Handler: &allowAllHandler{}})
137-
138104
By("creating reconcilers")
139105
opts := setup.Options{
140106
MaxReconciles: 100,
@@ -159,12 +125,6 @@ func HNCBeforeSuite() {
159125
}()
160126
}
161127

162-
type allowAllHandler struct{}
163-
164-
func (a allowAllHandler) Handle(_ context.Context, _ admission.Request) admission.Response {
165-
return webhooks.Allow("All requests are allowed by allowAllHandler")
166-
}
167-
168128
func HNCAfterSuite() {
169129
if k8sManagerCancelFn != nil {
170130
k8sManagerCancelFn()

0 commit comments

Comments
 (0)