- Fix Release() ref counting bug: avoid calling getRef() which increments
count, instead look up ref directly and clean up when count reaches zero
- Remove unpopulated CacheStatus struct and fields from types, deepcopy,
and CRD manifest since nothing writes to them
- Extract duplicated resolveAuth into shared pkg/gitauth package with
explicit key validation for missing "username"/"password" keys
- Fix GC() race condition by skipping paths with active in-process refs
- Remove misleading WorkspaceCacheMiss metric increment for in-memory
(non-cache) code paths
- Change push controller from shallow to full clones to avoid silent
failures when transactions reference historical commits
- Add tests for ref count cleanup, ref leak prevention, GC active ref
skipping, and gitauth key validation
https://claude.ai/code/session_01WJE6ozYXZMn1CD6d4vy8b6
Add pkg/workspace.Manager that provides Acquire/Release semantics for Git
repos. When GIT_CACHE_DIR is set and a GitRepository has spec.cache.enabled,
controllers use on-disk bare clones with incremental fetch; otherwise they
fall back to the existing in-memory clone behavior.
Key changes:
- New pkg/workspace package with Manager, Workspace, GC, Deepen, and
context-based injection (WithManager/GetManager)
- GitRepository API gains spec.cache (CacheConfig) and status.cache
(CacheStatus) with deepcopy and CRD schema updates
- Push, sync, and resolver reconcilers now use workspace.Acquire/Release
instead of inline memory.NewStorage + git.CloneContext
- Shallow clone by default; sync/resolver deepen as needed for merge-base
- New Prometheus metrics: workspace_acquire_duration_seconds,
workspace_cache_hit_total, workspace_cache_miss_total
- Deployment manifests include commented-out PVC configuration
- Comprehensive unit tests for workspace package (21 tests)
- E2E tests for cache-free and cache-enabled push flows
https://claude.ai/code/session_01NULGxaCLPMT1yDVEAsffc5
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
Build a complete Kubernetes control plane for Git operations using Knative's
pkg framework, go-git for in-memory Git operations, and ko for builds.
Architecture:
- 4 CRDs: GitRepository, GitBranch, GitPushTransaction, GitRepoSync
- Push controller: atomic Git push via go-git with CAS (compare-and-swap)
- Sync controller: two-way sync with in-memory merge base calculation
- Resolver controller: automated 3-way merge for conflicted syncs
- In-cluster Gitea server for backing storage
- Full RBAC, ko-based deployments, and code-gen scaffolding
Note: go.sum needs generation via `go mod tidy` in an environment with
full internet access (knative.dev/pkg v0.0.0-20250520014526-44579e9ce5ed).
https://claude.ai/code/session_01QfFzqKQUsxxBsiZUhuJ3pG