Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lcostea/basic-gitops-operator
https://github.com/lcostea/basic-gitops-operator
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/lcostea/basic-gitops-operator
- Owner: lcostea
- Created: 2021-08-06T08:02:12.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-08-10T18:47:19.000Z (over 3 years ago)
- Last Synced: 2024-06-19T16:38:25.890Z (6 months ago)
- Language: Go
- Size: 20.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# basic-gitops-operator
Step 1:
We made a new repo under github with the resources we want to create in our kubernetes cluster:
https://github.com/lcostea/basic-gitops-configIt contains a namespace `redis` and a deployment for 1 or more redis containers to create in the `redis` namespace.
Step 2:
We create a simple application that clones the repo and then applies it to the cluster it runs into and it keeps doing that in a loop at every 30 seconds.
Initialising our application using go modules:`go mod init github.com/lcostea/basic-gitops-operator`
Create a new `main.go` fileStep 3:
For working with git repos: cloning them intially and keeping them in sync we are going to use this library:
https://github.com/go-git/go-git which is probably the main go client for working with git.
And this library is also used by ArgoCD, though sometimes, probably for speed, they use the git client directly, invoking it from go code.
For our needs of cloning and pull a git repo this is more than enough.Step 4:
We are not going to call the Kubernetes API because that will complicate things a lot, but instead we will call the `kubectl apply` binary from our go code to apply the folder contents where we pulled the gitops repo.
Step 5:
Create the loop for calling the git sync and manifests apply every 30 seconds.