mirror of
https://github.com/imjasonh/git-k8s
synced 2026-07-11 16:09:40 +00:00
Add repo-watcher-controller for polling remote Git refs
Introduces a fourth controller that watches GitRepository resources and polls their remotes via git ls-remote on a configurable per-repo interval (spec.pollInterval, defaulting to 30s). It auto-creates, updates, and deletes GitBranch CRDs to reflect the actual state of the remote, enabling fast detection of external pushes to trigger downstream sync. Key changes: - Add PollInterval field to GitRepositorySpec - New pkg/reconciler/repowatcher with controller and reconciler - New cmd/repo-watcher-controller binary - CRD manifest updated for pollInterval - Deployment manifest for the new controller - Unit tests for ref filtering, naming, and poll interval logic - CLAUDE.md updated with new controller docs and Go module workaround https://claude.ai/code/session_01P7xfBqARU5DFS8QJ4uDPVj
This commit is contained in:
parent
4e9968a725
commit
ee281430b6
9 changed files with 552 additions and 2 deletions
|
|
@ -29,6 +29,12 @@ type GitRepositorySpec struct {
|
|||
// Auth contains authentication configuration for the repository.
|
||||
// +optional
|
||||
Auth *GitAuth `json:"auth,omitempty"`
|
||||
|
||||
// PollInterval is how often to poll the remote for ref changes.
|
||||
// Specified as a duration string (e.g., "5s", "30s", "1m").
|
||||
// If unset, the controller's default poll interval is used.
|
||||
// +optional
|
||||
PollInterval *metav1.Duration `json:"pollInterval,omitempty"`
|
||||
}
|
||||
|
||||
// GitAuth contains authentication details for accessing a Git repository.
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
package v1alpha1
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
|
|
@ -79,6 +80,11 @@ func (in *GitRepositorySpec) DeepCopyInto(out *GitRepositorySpec) {
|
|||
*out = new(GitAuth)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.PollInterval != nil {
|
||||
in, out := &in.PollInterval, &out.PollInterval
|
||||
*out = new(metav1.Duration)
|
||||
**out = **in
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GitRepositorySpec.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue