This repository contains sample k8s-ops-box Custom Resources for testing GitOps functionality.
.
├── clusters/ # RemoteCluster CRs
│ ├── dev-cluster.yaml
│ └── staging-cluster.yaml
├── roles/ # OpsBoxRole CRs
│ ├── developer-role.yaml
│ └── viewer-role.yaml
├── subjects/ # OpsBoxSubject CRs
│ └── team-group.yaml
├── rbac-definitions/ # RBACDefinition CRs (with targetCluster)
│ ├── dev-rbac.yaml
│ ├── minikube-local-rbac.yaml
│ └── staging-rbac.yaml
├── cron-definitions/ # CronDefinition CRs (with targetCluster)
│ ├── minikube-backup.yaml
│ └── python-health-check.yaml
├── git-definitions/ # GitDefinition CRs
│ ├── demo-app-source.yaml
│ ├── test-ado-gitops.yaml
│ └── test-gitops-local.yaml
└── projects-examples/ # Example projects with Helm charts
├── demo-app-01/ # Demo app with umbrella chart structure
│ └── helm/ # Helm chart with frontend and backend subcharts
└── demo-app-02/ # Another demo app (placeholder)
dev-cluster-gitops- Development clusterstaging-cluster-gitops- Staging cluster
gitops-developer- Developer role with create/update on dev clustergitops-viewer- Read-only role across all clusters
gitops-team- Team group
dev-rbac- RBAC configuration for dev clusterminikube-local-rbac- RBAC configuration for local minikubestaging-rbac- RBAC configuration for staging cluster
minikube-backup- Bash job that runs every 15 minutes (backup simulation)python-health-check- Python health check job every 10 minutes
demo-app-source- Git source for demo applicationtest-ado-gitops- Azure DevOps Git integration testtest-gitops-local- Local Git integration test
demo-app-01- Demo application with Helm chart using umbrella structure- Frontend component with Nginx
- Backend component with Node.js
demo-app-02- Placeholder for another demo application
Create a GitDefinition CR pointing to this repository:
apiVersion: ops-box.io/v1
kind: GitDefinition
metadata:
name: test-gitops-repo
namespace: ops-box
spec:
repository:
url: <path-to-this-repo>
branches:
- name: master
paths:
- path: "clusters/*.yaml"
kind: RemoteCluster
- path: "roles/*.yaml"
kind: OpsBoxRole
- path: "subjects/*.yaml"
kind: OpsBoxSubject
- path: "rbac-definitions/*.yaml"
kind: RBACDefinition
targetCluster: "minikube-local" # Required for RBACDefinition
- path: "cron-definitions/*.yaml"
kind: CronDefinition
targetCluster: "minikube-local" # Required for CronDefinition
pollIntervalSeconds: 300
syncPolicy:
automated:
enabled: true
prune: true
selfHeal: trueThe CC-Operator will:
- Clone this repository
- Parse YAML files matching the patterns
- Extract
targetClusterfrom path config for RBACDefinition/CronDefinition - Apply CRs via BFF-API to the specified cluster
- Publish sync events
- Auto-prune orphaned resources (if enabled)
- Auto-heal drifted resources (if enabled)
- These CRs require
targetClusterin the GitDefinition path configuration - The
targetClusterfield tells the git_handler which cluster to deploy to - Example:
targetCluster: "minikube-local"→ deployed to/api/v1/cron-definitions/minikube-local/{name}
All synced resources will have these annotations:
ops-box.io/git-managed: "true"- Marks resource as Git-managedops-box.io/git-source: <git-def-name>- Source GitDefinition nameops-box.io/git-branch: <branch>- Git branchops-box.io/git-path: <path>- Relative path in repoops-box.io/last-synced: <timestamp>- Last sync timestamp