Wire the provider health monitor into the manager, with gauges

--provider-check-interval (1m; 0 = off, else at least 10s) and
--provider-check-timeout (15s) are validated before the providers config
loads. Checkers are collected from the unwrapped providers in config
order, so checks never count as provider requests. Three scrape-time
gauges per {provider,target} read the monitor's snapshot: up, check
duration and check timestamp. The e2e suite waits for the kubernetes
ProviderHealth to turn Ready and asserts its gauge in the scrape.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-11 20:23:55 +00:00
co-authored by Claude Opus 5
parent 88a15ecdb5
commit 9a3ee963a0
6 changed files with 215 additions and 3 deletions
+16
View File
@@ -173,6 +173,20 @@ var _ = Describe("Manager", Ordered, func() {
Eventually(verifyControllerUp).Should(Succeed())
})
// Runs before the metrics spec on purpose: once a ProviderHealth is
// Ready, the first round of checks is done and its gauges exist.
It("should publish provider health", func() {
By("waiting for the kubernetes provider's ProviderHealth to report Ready")
verifyProviderReady := func(g Gomega) {
cmd := exec.Command("kubectl", "get", "providerhealth", "kubernetes",
"-o", `jsonpath={.status.conditions[?(@.type=="Ready")].status}`)
output, err := utils.Run(cmd)
g.Expect(err).NotTo(HaveOccurred())
g.Expect(output).To(Equal("True"), "kubernetes provider not Ready")
}
Eventually(verifyProviderReady).Should(Succeed())
})
It("should ensure the metrics endpoint is serving metrics", func() {
By("creating a ClusterRoleBinding for the service account to allow access to metrics")
cmd := exec.Command("kubectl", "create", "clusterrolebinding", metricsRoleBindingName,
@@ -264,6 +278,8 @@ var _ = Describe("Manager", Ordered, func() {
g.Expect(err).NotTo(HaveOccurred(), "Failed to retrieve logs from curl pod")
g.Expect(metricsOutput).NotTo(BeEmpty())
g.Expect(metricsOutput).To(ContainSubstring("< HTTP/1.1 200 OK"))
g.Expect(metricsOutput).To(ContainSubstring(
`proxy_operator_provider_target_up{provider="kubernetes",target="apiserver"} 1`))
}
Eventually(verifyMetricsAvailable, 2*time.Minute).Should(Succeed())
})