From 38fda344bbd83e3728f50e99f34f8072a506fb98 Mon Sep 17 00:00:00 2001 From: Hisar Balik Date: Thu, 19 Dec 2024 19:08:37 +0100 Subject: [PATCH] revert removed telemetry override e2e test --- test/e2e/overrides_test.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test/e2e/overrides_test.go b/test/e2e/overrides_test.go index e6719c294..febbc1e6a 100644 --- a/test/e2e/overrides_test.go +++ b/test/e2e/overrides_test.go @@ -9,6 +9,7 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + admissionregistrationv1 "k8s.io/api/admissionregistration/v1" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/types" "sigs.k8s.io/controller-runtime/pkg/client" @@ -71,6 +72,23 @@ var _ = Describe(suite.ID(), Label(suite.LabelTelemetry), Ordered, func() { }, periodic.ConsistentlyTimeout, periodic.DefaultInterval).Should(Succeed()) } + assertTelemetryReconciliationDisabled := func(ctx context.Context, k8sClient client.Client, webhookName string) { + key := types.NamespacedName{ + Name: webhookName, + } + var validatingWebhookConfiguration admissionregistrationv1.ValidatingWebhookConfiguration + Expect(k8sClient.Get(ctx, key, &validatingWebhookConfiguration)).To(Succeed()) + + validatingWebhookConfiguration.Webhooks[0].ClientConfig.CABundle = []byte{} + Expect(k8sClient.Update(ctx, &validatingWebhookConfiguration)).To(Succeed()) + + // The deleted CA bundle should not be restored, since the reconciliation is disabled by the overrides configmap + Consistently(func(g Gomega) { + g.Expect(k8sClient.Get(ctx, key, &validatingWebhookConfiguration)).To(Succeed()) + g.Expect(validatingWebhookConfiguration.Webhooks[0].ClientConfig.CABundle).To(BeEmpty()) + }, periodic.ConsistentlyTimeout, periodic.DefaultInterval).Should(Succeed()) + } + BeforeAll(func() { now = time.Now().UTC() k8sObjects := makeResources() @@ -171,5 +189,9 @@ var _ = Describe(suite.ID(), Label(suite.LabelTelemetry), Ordered, func() { It("Should disable the reconciliation of the tracepipeline", func() { assertPipelineReconciliationDisabled(ctx, k8sClient, kitkyma.TraceGatewayConfigMap, appNameLabelKey) }) + + It("Should disable the reconciliation of the telemetry CR", func() { + assertTelemetryReconciliationDisabled(ctx, k8sClient, kitkyma.ValidatingWebhookName) + }) }) })