mirror of
https://github.com/imjasonh/git-k8s
synced 2026-07-10 23:51:58 +00:00
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
103 lines
3 KiB
YAML
103 lines
3 KiB
YAML
apiVersion: apiextensions.k8s.io/v1
|
|
kind: CustomResourceDefinition
|
|
metadata:
|
|
name: gitpushtransactions.git.k8s.io
|
|
spec:
|
|
group: git.k8s.io
|
|
names:
|
|
kind: GitPushTransaction
|
|
listKind: GitPushTransactionList
|
|
plural: gitpushtransactions
|
|
singular: gitpushtransaction
|
|
shortNames:
|
|
- gitpush
|
|
categories:
|
|
- git
|
|
scope: Namespaced
|
|
versions:
|
|
- name: v1alpha1
|
|
served: true
|
|
storage: true
|
|
subresources:
|
|
status: {}
|
|
schema:
|
|
openAPIV3Schema:
|
|
type: object
|
|
properties:
|
|
spec:
|
|
type: object
|
|
required:
|
|
- repositoryRef
|
|
- refSpecs
|
|
properties:
|
|
repositoryRef:
|
|
type: string
|
|
description: Name of the target GitRepository resource.
|
|
atomic:
|
|
type: boolean
|
|
description: Whether the push should be atomic.
|
|
default: true
|
|
refSpecs:
|
|
type: array
|
|
minItems: 1
|
|
items:
|
|
type: object
|
|
required:
|
|
- source
|
|
- destination
|
|
properties:
|
|
source:
|
|
type: string
|
|
description: Local ref (commit SHA or branch name).
|
|
destination:
|
|
type: string
|
|
description: Remote ref to update.
|
|
expectedOldCommit:
|
|
type: string
|
|
description: Expected current commit SHA for CAS.
|
|
status:
|
|
type: object
|
|
properties:
|
|
conditions:
|
|
type: array
|
|
items:
|
|
type: object
|
|
properties:
|
|
type:
|
|
type: string
|
|
status:
|
|
type: string
|
|
lastTransitionTime:
|
|
type: string
|
|
format: date-time
|
|
reason:
|
|
type: string
|
|
message:
|
|
type: string
|
|
phase:
|
|
type: string
|
|
enum:
|
|
- Pending
|
|
- InProgress
|
|
- Succeeded
|
|
- Failed
|
|
resultCommit:
|
|
type: string
|
|
startTime:
|
|
type: string
|
|
format: date-time
|
|
completionTime:
|
|
type: string
|
|
format: date-time
|
|
message:
|
|
type: string
|
|
additionalPrinterColumns:
|
|
- name: Repository
|
|
type: string
|
|
jsonPath: .spec.repositoryRef
|
|
- name: Phase
|
|
type: string
|
|
jsonPath: .status.phase
|
|
- name: Age
|
|
type: date
|
|
jsonPath: .metadata.creationTimestamp
|