upbound / universal-crossplane

Enterprise-grade @crossplane from @upbound
https://upbound.io/product/universal-crossplane
Apache License 2.0
124 stars 32 forks source link

Add metrics exporter for bootstrapper #360

Closed branden closed 1 year ago

branden commented 1 year ago

Description of your changes

This PR adds a command-line flag to boostrapper for setting its metrics port, and configures its controller-manager to host a metrics exporter at that port.

I have:

How has this code been tested

Apply the following values overrides:

diff --git a/cluster/local/config/universal-crossplane/value-overrides.yaml.tmpl b/cluster/local/config/universal-crossplane/value-overrides.yaml.tmpl
index e69de29..bf5b8a2 100644
--- a/cluster/local/config/universal-crossplane/value-overrides.yaml.tmpl
+++ b/cluster/local/config/universal-crossplane/value-overrides.yaml.tmpl
@@ -0,0 +1,10 @@
+billing:
+  awsMarketplace:
+    enabled: true
+
+bootstrapper:
+  config:
+    envVars:
+      AWS_ACCESS_KEY_ID: <REDACTED>
+      AWS_SECRET_ACCESS_KEY: <REDACTED>
+      AWS_DEFAULT_REGION: us-west-2

Run make build local-dev. Then port-forward to the bootstrapper's metrics port, and curl it:

branden@crateria managed-control-planes % k -n upbound-system port-forward pod/upbound-bootstrapper-76898f57c7-bc42w 8085:8085 2>&1 >/dev/null &
[1] 15261
branden@crateria managed-control-planes % curl -s localhost:8085/metrics | head
# HELP certwatcher_read_certificate_errors_total Total number of certificate read errors
# TYPE certwatcher_read_certificate_errors_total counter
certwatcher_read_certificate_errors_total 0
# HELP certwatcher_read_certificate_total Total number of certificate reads
# TYPE certwatcher_read_certificate_total counter
certwatcher_read_certificate_total 0
# HELP controller_runtime_active_workers Number of currently used workers per controller
# TYPE controller_runtime_active_workers gauge
controller_runtime_active_workers{controller="aws-marketplace"} 0
# HELP controller_runtime_max_concurrent_reconciles Maximum number of concurrent reconciles per controller
branden@crateria managed-control-planes % 
Upbound-CLA commented 1 year ago

CLA assistant check
All committers have signed the CLA.