squakez commented on code in PR #6969:
URL: https://github.com/apache/camel-k/pull/6969#discussion_r4599183769
##########
pkg/cmd/operator/operator.go:
##########
@@ -251,6 +252,19 @@ func Run(healthPort, monitoringPort int32, leaderElection
bool, leaderElectionID
exitOnError(mgr.Start(ctx), "manager exited non-zero")
}
+func newMetricsServerOptions(monitoringPort int32, secureServing, authEnabled
bool, certDir string) metricsserver.Options {
+ options := metricsserver.Options{
+ BindAddress: ":" + strconv.Itoa(int(monitoringPort)),
+ SecureServing: secureServing,
+ CertDir: certDir,
+ }
+ if authEnabled {
+ options.FilterProvider =
filters.WithAuthenticationAndAuthorization
Review Comment:
It is an interesting approach but as we need to expand the RBAC with
potential sensitive API it may be better to avoid.
##########
docs/modules/ROOT/pages/observability/monitoring/operator.adoc:
##########
@@ -19,8 +19,56 @@ kubectl apply -k
github.com/apache/camel-k/install/base/config/prometheus?ref=v{
NOTE: change the ref value with the installation version tag you want to
install.
+The operator metrics endpoint uses HTTPS by default. The example `PodMonitor`
is configured to scrape HTTPS and to accept the self-signed certificate that
controller-runtime generates when no certificate is configured.
+
+For production, mount a TLS Secret containing `tls.crt` and `tls.key` into the
operator Pod and set `KAMEL_OPERATOR_METRICS_CERT_DIR` to the mount directory.
Update the `PodMonitor` `tlsConfig` to trust that certificate instead of
skipping certificate verification.
Review Comment:
If we want to implement the cert we need a more opinionated approach. For
example, we can introduce an env var where the user provide a secret containing
those keys. Therefore, we enable https ONLY if that env var is provided,
otherwise we fallback to http.
--
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]