This simple Go program acts as a basic GitOps operator. It continually synchronizes a specified Git repository to a local path and then applies Kubernetes manifests from that repository.
- Automatic syncing of a given Git repository.
- Application of Kubernetes manifests using
kubectl
. - Logging of sync and apply operations.
- Efficient error handling and reporting.
- Go (at least version 1.15)
kubectl
installed and configured with appropriate cluster access.github.com/go-git/go-git/v5
Go package.
-
Clone this repository: git clone https://github.com/yourusername/basic-gitops-operator.git cd basic-gitops-operator
-
Install the required Go packages: go get -v
-
Build the program: go build
This will generate an executable named basic-gitops-operator
(or basic-gitops-operator.exe
on Windows).
-
Run the program: ./basic-gitops-operator
-
By default, the program will sync the repository at
https://github.com/richinex/basic-gitops-operator.git
every 5 seconds and apply the manifests found in thebasic-gitops-operator-config
directory. Modify the source code if you need to sync a different repository or adjust the interval. -
Monitor the logs for information on syncing and applying operations. Errors, if any, will also be reported here.