1
0
Fork 0
mirror of https://github.com/imjasonh/git-k8s synced 2026-07-15 01:45:41 +00:00
git-k8s/config/deployments/sync-controller.yaml
Claude 1d7073009f
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
2026-03-17 14:32:02 +00:00

70 lines
2 KiB
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
name: sync-controller
namespace: git-system
labels:
app.kubernetes.io/name: git-k8s
app.kubernetes.io/component: sync-controller
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/component: sync-controller
template:
metadata:
labels:
app.kubernetes.io/name: git-k8s
app.kubernetes.io/component: sync-controller
spec:
serviceAccountName: git-k8s-controller
containers:
- name: controller
# ko will replace this with the actual registry image SHA.
image: ko://github.com/imjasonh/git-k8s/cmd/sync-controller
ports:
- name: health
containerPort: 8080
protocol: TCP
- name: metrics
containerPort: 9090
protocol: TCP
readinessProbe:
httpGet:
path: /readiness
port: 8080
initialDelaySeconds: 5
periodSeconds: 10
livenessProbe:
httpGet:
path: /health
port: 8080
initialDelaySeconds: 15
periodSeconds: 15
env:
- name: SYSTEM_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: CONFIG_LOGGING_NAME
value: config-logging
- name: CONFIG_OBSERVABILITY_NAME
value: config-observability
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 500m
memory: 256Mi
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
runAsNonRoot: true
capabilities:
drop:
- ALL