Skip to content

Commit 55e6769

Browse files
fix: resolve E2E integration test failure
Comment kustomize code to pass certs for the metric server for tests with packagemanifest Signed-off-by: Camila Macedo <7708031+camilamacedo86@users.noreply.github.com>
1 parent 948fe86 commit 55e6769

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/integration/suite_test.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import (
2929

3030
"github.com/operator-framework/operator-sdk/internal/testutils"
3131
"github.com/operator-framework/operator-sdk/internal/util/projutil"
32+
kbutil "sigs.k8s.io/kubebuilder/v4/pkg/plugin/util"
3233
)
3334

3435
// TestIntegration tests operator-sdk projects with OLM.
@@ -73,6 +74,20 @@ var _ = BeforeSuite(func() {
7374
By("installing prometheus-operator")
7475
Expect(tc.InstallPrometheusOperManager()).To(Succeed())
7576

77+
// Previously, we used kube-rbac-proxy, which generated TLS certificates on the fly —
78+
// a practice not recommended and also deprecated on it due this reason.
79+
//
80+
// Newer versions of the scaffolding support passing real certificates to the metrics server
81+
// using cert-manager. However, the `packagemanifests` command does not support this capability.
82+
// Since `packagemanifests` is deprecated and will be removed in the future, we are choosing
83+
// not to implement support for cert-manager in this context.
84+
//
85+
// Therefore, for testing purposes — specifically when using `packagemanifests` — we are
86+
// disabling the metrics server with cert-manager.
87+
By("Disabling metrics with certs - no supported by packagemanifests")
88+
// nolint: errcheck
89+
kbutil.CommentCode(filepath.Join(tc.Dir, "config", "default", "kustomization.yaml"), targetMetricsCertFragment, "#")
90+
7691
By("building the manager image")
7792
Expect(tc.Make("docker-build", "IMG="+tc.ImageName)).To(Succeed())
7893

@@ -109,6 +124,10 @@ var _ = BeforeSuite(func() {
109124
Expect(err).NotTo(HaveOccurred())
110125
})
111126

127+
const targetMetricsCertFragment = `- path: cert_metrics_manager_patch.yaml
128+
target:
129+
kind: Deployment`
130+
112131
var _ = AfterSuite(func() {
113132
By("uninstalling OLM")
114133
tc.UninstallOLM()

0 commit comments

Comments
 (0)