Weave GitOps has a key concept which is the "GitOps Automation". This is the configuration that defines the flow that happens when an update happens in Git. This flow reconciles the workload into the target.
The GitOps Automation configuration consists of two types of configuration:
Fundamentally, GitOps is connecting
targets by automatically deploying the app into the target.
Weave GitOps supports three places to store this configuration:
- In the same repository as your workload definition (e.g. in the same repository containing your k8s YAMLs)
- In a separate repository that can cover different applications.
- Only configured into the cluster (not stored)
The default behaviour is #1, which is to store the GitOps Automation configuration in the same repository as your workload YAMLs are stored. This is the best option for a team that manages their own app and infrastructure and wants a simple, easy deployment of Weave GitOps.
Option 2 is designed for scenarios where there are multiple applications managed by a single team (maybe a platform ops team or a team that owns more than one app).
Option 3 is a basic approach that is useful if you are just learning about GitOps and don't want to be able to change the automation flow.
.wego folder contains the following structure:
.├── apps│ └── appname│ └── app.yaml└── targets └── clustername └── appname └── appname-gitops-runtime.yaml
app.yaml looks like this:
apiVersion: wego.weave.works/v1alpha1kind: Applicationmetadata: name: nginxspec: path: ./ url: ssh://email@example.com/org/nginx.git
It defines the name of the application and the git url location of the repository.
This file defines the flux runtime flow to deploy the application into a specific target. For example, by default this uses the flux kustomize support to deploy your application manifests into the cluster. Other options include managing helm charts.
---apiVersion: kustomize.toolkit.fluxcd.io/v1beta1kind: Kustomizationmetadata: name: nginx-fork-dot namespace: wego-systemspec: interval: 5m0s path: ./ prune: true sourceRef: kind: GitRepository name: nginx-fork validation: client