mirror of
https://github.com/imjasonh/git-k8s
synced 2026-07-16 12:33:02 +00:00
Add Prometheus metrics, health probes, Git timeouts, and unit tests
Critical production-readiness improvements: - Prometheus metrics: reconcile count/latency per controller, Git operation duration (clone/push/ls-remote) via pkg/metrics with /metrics on :9090 - Health probes: leverage Knative's built-in health server on :8080, add readiness/liveness probes to all four deployment manifests - Git operation timeouts: 5-minute context deadline on all git.CloneContext and PushContext calls to prevent indefinite blocking on large repos - Unit tests: new ReconcileKind-level tests for push (pending→failed on missing repo, auth error paths), sync (branch-not-found, LastSyncTime), resolver (missing repo, partial hashes, empty phase), and repowatcher (ls-remote errors, empty remote, unchanged branches) https://claude.ai/code/session_01PaXbaSqhVEqj97kpY4v6rt
This commit is contained in:
parent
2b2b4ce80a
commit
1d7073009f
27 changed files with 1015 additions and 21 deletions
|
|
@ -2,10 +2,15 @@ package main
|
|||
|
||||
import (
|
||||
"knative.dev/pkg/injection/sharedmain"
|
||||
"knative.dev/pkg/signals"
|
||||
|
||||
"github.com/imjasonh/git-k8s/pkg/health"
|
||||
_ "github.com/imjasonh/git-k8s/pkg/metrics" // register Prometheus metrics
|
||||
"github.com/imjasonh/git-k8s/pkg/reconciler/push"
|
||||
)
|
||||
|
||||
func main() {
|
||||
sharedmain.Main("push-controller", push.NewController)
|
||||
ctx := signals.NewContext()
|
||||
go health.ServeMetrics(ctx, ":9090") //nolint:errcheck
|
||||
sharedmain.MainWithContext(ctx, "push-controller", push.NewController)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue