squakez commented on code in PR #6985:
URL: https://github.com/apache/camel-k/pull/6985#discussion_r4663116640
##########
e2e/advanced/operator_metrics_test.go:
##########
@@ -47,14 +47,32 @@ import (
func TestMetrics(t *testing.T) {
t.Parallel()
+ testMetrics(t, false)
+}
+
+func TestMetricsHTTPS(t *testing.T) {
+ t.Parallel()
+ testMetrics(t, true)
+}
+// testMetrics checks the operator /metrics endpoint. When secure is true the
+// operator serves metrics over HTTPS with a self-signed certificate generated
+// by controller-runtime. The API server proxy does not verify the certificate
+// of the backend it connects to, so the endpoint can still be scraped through
+// the pods proxy using the https scheme.
+func testMetrics(t *testing.T, secure bool) {
WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
// Install Camel K with the log debug enabled
- InstallOperatorWithConf(t, ctx, g, ns, "", false,
- map[string]string{
- "LOG_LEVEL": "debug",
- },
- )
+ operatorConf := map[string]string{
+ "LOG_LEVEL": "debug",
+ }
+ if secure {
+ // A non-empty METRICS_CERT_DIR enables HTTPS on the
metrics endpoint.
+ // controller-runtime generates a self-signed
certificate when the
Review Comment:
> // controller-runtime generates a self-signed certificate when the
I don't think this is true. The feature requires that, before installation,
the user takes care to generate and pass the certificate properly (either real
or self signed). Ideally, we can include the generation of the certificate in
the same test and alter the kustomization script in order to mount the
certificate from the secret.
As an alternative, the github workflow can take care of generating the
certificate, and here we can just create the secret and mount it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]