# Collection of patterns, examples and resources for GitOps process design, GitOps repository structures, etc


## **cloudogu/gitops-patterns**

## Intro

This repo collects some patterns (AKA strategies, models, approaches, best practices, etc.) about GitOps process design (AKA GitOps repository structures, etc.) as well as links to talks, articles and example repos.

It originated in [schnatterer's talk](https://cloudogu.github.io/gitops-talks/2023-03-mastering-gitops/#/) about the "perfect" GitOps process, our experience in [consulting](https://cloudogu.com/en/consulting/?mtm_campaign=gitops-playground&mtm_kwd=consulting&mtm_source=github&mtm_medium=link), and our [GitOps trainings for both Flux and ArgoCD](https://platform.cloudogu.com/en/trainings/gitops-continuous-operations/?mtm_campaign=gitops-playground&mtm_kwd=training&mtm_source=github&mtm_medium=link).

You can read more about the patterns in [this series of articles](https://github.com/cloudogu/gitops-patterns#articles).

[![Discuss it on myCloudogu](https://camo.githubusercontent.com/8917b70c8dee66c8ecf42ab529ca4ca9112ab5874508845710dfe0780ffc6760/68747470733a2f2f7374617469632e636c6f75646f67752e636f6d2f7374617469632f696d616765732f646973637573732d69742e706e67 align="left")](https://community.cloudogu.com/c/gitops/23)

PRs welcome!

## Contents

* [Articles](https://github.com/cloudogu/gitops-patterns#articles)
    
* [Pattern categories](https://github.com/cloudogu/gitops-patterns#pattern-categories)
    
* [GitOps Patterns](https://github.com/cloudogu/gitops-patterns#gitops-patterns)
    
    * [Operator deployment](https://github.com/cloudogu/gitops-patterns#operator-deployment)
        
        * [Hub and Spoke](https://github.com/cloudogu/gitops-patterns#hub-and-spoke)
            
        * [Instance per Cluster](https://github.com/cloudogu/gitops-patterns#instance-per-cluster)
            
        * [Instance per Namspace](https://github.com/cloudogu/gitops-patterns#instance-per-namespace)
            
        * [Split-Instance](https://github.com/cloudogu/gitops-patterns#split-instance)
            
    * [Repository structure](https://github.com/cloudogu/gitops-patterns#repository-structure)
        
        * [Monorepo](https://github.com/cloudogu/gitops-patterns#monorepo)
            
        * [Repo per Team](https://github.com/cloudogu/gitops-patterns#repo-per-team)
            
        * [Repo per Application](https://github.com/cloudogu/gitops-patterns#repo-per-app) (can be implemented via [Repo Separation](https://github.com/cloudogu/gitops-patterns#repo-separation), [Config Replication](https://github.com/cloudogu/gitops-patterns#config-replication), [Repo Pointer](https://github.com/cloudogu/gitops-patterns#repo-pointer) or [Config Split](https://github.com/cloudogu/gitops-patterns#config-split))
            
        * [Repo per Environment](https://github.com/cloudogu/gitops-patterns#repo-per-env)
            
    * [Promotion](https://github.com/cloudogu/gitops-patterns#promotion)
        
        * [Environments](https://github.com/cloudogu/gitops-patterns#environments)
            
            * [Folder/Directory per environment](https://github.com/cloudogu/gitops-patterns#folder-per-env)
                
            * [Repo per environment](https://github.com/cloudogu/gitops-patterns#repo-per-env)
                
            * [Branch per environment](https://github.com/cloudogu/gitops-patterns#branch-per-env)
                
            * [Preview environments](https://github.com/cloudogu/gitops-patterns#preview-env)
                
        * [Implementation](https://github.com/cloudogu/gitops-patterns#implementation)
            
            * [Configuration Management](https://github.com/cloudogu/gitops-patterns#config-management), includes [Rendered Manifests](https://github.com/cloudogu/gitops-patterns#rendered-manifests) and [Umbrella Chart](https://github.com/cloudogu/gitops-patterns#umbrella-chart)
                
            * [Global Environments vs Environment per App](https://github.com/cloudogu/gitops-patterns#global-vs-env-per-app)
                
            * [Config update](https://github.com/cloudogu/gitops-patterns#config-update)
                
    * [Wiring](https://github.com/cloudogu/gitops-patterns#wiring)
        
        * [Bootstrapping](https://github.com/cloudogu/gitops-patterns#bootstrapping)
            
        * [Linking](https://github.com/cloudogu/gitops-patterns#linking), includes [Nesting](https://github.com/cloudogu/gitops-patterns#nesting) (e.g. [App of Apps](https://github.com/cloudogu/gitops-patterns#app-of-apps)), [Templating](https://github.com/cloudogu/gitops-patterns#templating)
            
* [Public GitOps Repo Examples](https://github.com/cloudogu/gitops-patterns#public-gitops-repo-examples)
    
    * [GitOps Playground](https://github.com/cloudogu/gitops-patterns#gitops-playground)
        
    * [ArgoCD autopilot](https://github.com/cloudogu/gitops-patterns#argocd-autopilot)
        
    * [Flux Monorepo](https://github.com/cloudogu/gitops-patterns#flux-monorepo)
        
    * [Flux repo per team/tenant](https://github.com/cloudogu/gitops-patterns#flux-repo-per-teamtenant)
        
    * [📕 Path to GitOps examples](https://github.com/cloudogu/gitops-patterns#-path-to-gitops-examples)
        
    * [Environment variations](https://github.com/cloudogu/gitops-patterns#environment-variations)
        
    * [Others](https://github.com/cloudogu/gitops-patterns#others)
        
* [Synonyms](https://github.com/cloudogu/gitops-patterns#synonyms)
    
* [References](https://github.com/cloudogu/gitops-patterns#references)
    

## Articles

<table><tbody><tr><td colspan="1" rowspan="1"><p></p></td><td colspan="1" rowspan="1"><p><a target="_blank" rel="nofollow" href="https://cloudogu.com/en/blog/gitops-repository-patterns-part-1-introduction" style="pointer-events: none">Part 1️⃣: GitOps Chasm + categories</a></p></td></tr><tr><td colspan="1" rowspan="1"><p></p></td><td colspan="1" rowspan="1"><p><a target="_blank" rel="nofollow" href="https://cloudogu.com/en/blog/gitops-repository-patterns-part-2-operator-deployment-patterns" style="pointer-events: none">Part 2️⃣: Deployment patterns</a></p></td></tr><tr><td colspan="1" rowspan="1"><p></p></td><td colspan="1" rowspan="1"><p><a target="_blank" rel="nofollow" href="https://cloudogu.com/en/blog/gitops-repository-patterns-part-3-repository-patterns" style="pointer-events: none">Part 3️⃣: Repo patterns</a></p></td></tr><tr><td colspan="1" rowspan="1"><p></p></td><td colspan="1" rowspan="1"><p><a target="_blank" rel="nofollow" href="https://cloudogu.com/en/blog/gitops-repository-patterns-part-4-promotion-patterns" style="pointer-events: none">Part 4️⃣: Promotion patterns</a></p></td></tr><tr><td colspan="1" rowspan="1"><p></p></td><td colspan="1" rowspan="1"><p><a target="_blank" rel="nofollow" href="https://cloudogu.com/en/blog/gitops-repository-patterns-part-5-wiring-patterns" style="pointer-events: none">Part 5️⃣: Wiring patterns + conclusion</a></p></td></tr><tr><td colspan="1" rowspan="1"><p></p></td><td colspan="1" rowspan="1"><p><a target="_blank" rel="nofollow" href="https://cloudogu.com/en/blog/gitops-repository-patterns-part-6-examples" style="pointer-events: none">Part 6️⃣: Example Repositories</a></p></td></tr></tbody></table>

## Pattern categories

Let's group GitOps patterns into separate categories to make them easier to grasp.  
See also [part 1️⃣ of the article series](https://cloudogu.com/en/blog/gitops-repository-patterns-part-1-introduction).

* **Operator deployment**: GitOps operators ↔ Clusters/Namespaces
    
* **Repository**: How many repos?
    
* **Promotion**:
    
    * Environments: How to model environments/stages?
        
    * Implementation: How to implement the actual process of promotion?
        
* **Wiring**: Bootstrapping operator, linking repos and folders
    

## GitOps Patterns

### Operator deployment

See also [part 2️⃣ of the article series](https://cloudogu.com/en/blog/gitops-repository-patterns-part-2-operator-deployment-patterns).

* **Hub and Spoke** [<sup>1</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fn-1-02cfecf39363ede31ff61b8f96495d90)[<sup>2</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fn-2-02cfecf39363ede31ff61b8f96495d90) 1 Operator : n Clusters  
    Synonyms: Management Cluster [<sup>3</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fn-18-02cfecf39363ede31ff61b8f96495d90) - sounds familiar, e.g. from Cluster API, but it requires a cluster. In SaaS/PaaS constellations, the central instance may not even be operated in a cluster. Therefore, the term "Hub and Spoke" seems more fitting to us, especially since it is also well known from computer networks or logistics.  
    
    ![Hube and spoke](https://github.com/cloudogu/gitops-patterns/raw/main/src/svg/deployment-hub-and-spoke.svg align="left")
    
* **Instance Per Cluster** [<sup>3</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fn-18-02cfecf39363ede31ff61b8f96495d90) : 1 Operator : 1 Cluster  
    Synonyms: Standalone [<sup>1</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fn-1-02cfecf39363ede31ff61b8f96495d90) - could apply to both "Instance per Cluster" and "Instance per Namespace"; does not define the relationship to clusters and namespaces precisely enough, as not every operator supports both deployment patterns.  
    
    ![Instance Per Cluster](https://github.com/cloudogu/gitops-patterns/raw/main/src/svg/deployment-instance-per-cluster.svg align="left")
    
* **Instance per Namespace**: n Operators : 1 Cluster  
    Synonyms: Namespaced [<sup>4</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fn-3-02cfecf39363ede31ff61b8f96495d90)  
    
    ![Instance per Namespace](https://github.com/cloudogu/gitops-patterns/raw/main/src/svg/deployment-instance-per-namespace.svg align="left")
    

More Patterns:

* Split-Instance[<sup>1</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fn-1-02cfecf39363ede31ff61b8f96495d90): 1 Operator : n Clusters; components split between management and target clusters
    
* Hybrids of Hub and Spoke and Instance per Cluster patterns: "Instance per Logical Group" and "Argo Managing more Argos".[<sup>3</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fn-18-02cfecf39363ede31ff61b8f96495d90)
    

### Repository structure

See also [part 3️⃣ of the article series](https://cloudogu.com/en/blog/gitops-repository-patterns-part-3-repository-patterns).

* **Monorepo** [<sup>2</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fn-2-02cfecf39363ede31ff61b8f96495d90)[<sup>5</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fn-4-02cfecf39363ede31ff61b8f96495d90)  
    Opposite: polyrepo [<sup>2</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fn-2-02cfecf39363ede31ff61b8f96495d90)
    
* **Repo per Team** [<sup>5</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fn-4-02cfecf39363ede31ff61b8f96495d90)  
    More generalized: Team ➡️ Tenant[<sup>5</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fn-4-02cfecf39363ede31ff61b8f96495d90)
    
* **Repo per Application** [<sup>2</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fn-2-02cfecf39363ede31ff61b8f96495d90)[<sup>5</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fn-4-02cfecf39363ede31ff61b8f96495d90)  
    Implementations:
    
    * Repo separation [<sup>6</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fn-19-02cfecf39363ede31ff61b8f96495d90)  
        Keep code in app repo, config in config repo  
        
        ![](https://camo.githubusercontent.com/29067c692df488c368dcca3115a12c7695e9314a27a5f6fe5099570ec47a15b7/68747470733a2f2f7777772e706c616e74756d6c2e636f6d2f706c616e74756d6c2f70726f78793f7372633d68747470733a2f2f7261772e67697468756275736572636f6e74656e742e636f6d2f636c6f75646f67752f6769746f70732d7061747465726e732f6d61696e2f7372632f70756d6c2f7265706f2d73657061726174696f6e2e70756d6c26666d743d737667 align="left")
        
    * Config replication [<sup>4</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fn-3-02cfecf39363ede31ff61b8f96495d90)  
        Keep config in app repo and have CI server replicate it to the config repo  
        
        ![](https://camo.githubusercontent.com/c6b7bb90a44b1ae4ccfeb21074a4fce23ffcdfef8e41f31213a333aaeffdbe49/68747470733a2f2f7777772e706c616e74756d6c2e636f6d2f706c616e74756d6c2f70726f78793f7372633d68747470733a2f2f7261772e67697468756275736572636f6e74656e742e636f6d2f636c6f75646f67752f6769746f70732d7061747465726e732f6d61696e2f7372632f70756d6c2f636f6e6669672d7265706c69636174696f6e2e70756d6c26666d743d737667 align="left")
        
    * Repo pointer [<sup>7</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fn-6-02cfecf39363ede31ff61b8f96495d90)[<sup>4</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fn-3-02cfecf39363ede31ff61b8f96495d90)[<sup>5</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fn-4-02cfecf39363ede31ff61b8f96495d90)  
        Keep the whole config in app repo and add a pointer from config repo (e.g. Argo CD `Application` or a Flux `GitRepository`+`Kustomization`), avoiding redundancy  
        
        ![](https://camo.githubusercontent.com/c967fd9dd0158c156416ef1585106c196e806699feccfbd0933db5855ece9985/68747470733a2f2f7777772e706c616e74756d6c2e636f6d2f706c616e74756d6c2f70726f78793f7372633d68747470733a2f2f7261772e67697468756275736572636f6e74656e742e636f6d2f636c6f75646f67752f6769746f70732d7061747465726e732f6d61696e2f7372632f70756d6c2f7265706f2d706f696e7465722e70756d6c26666d743d737667 align="left")
        
    * Config Split [<sup>8</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fn-20-02cfecf39363ede31ff61b8f96495d90)  
        Keep parts of the config in app repo (e.g. helm chart or kustomize base), and rest in config repo (e.g. `value.yaml`s or overlays for different envs).  
        Then have the config repo point to the app repo (e.g. via ArgoCD `Application` or Flux `Kustomization`).  
        
        ![](https://camo.githubusercontent.com/6216914b408ff4ba789e1f845c76df5b50429a856a2b67bab03087306485393e/68747470733a2f2f7777772e706c616e74756d6c2e636f6d2f706c616e74756d6c2f70726f78793f7372633d68747470733a2f2f7261772e67697468756275736572636f6e74656e742e636f6d2f636c6f75646f67752f6769746f70732d7061747465726e732f6d61696e2f7372632f70756d6c2f636f6e6669672d73706c69742d68656c6d2d6769742e70756d6c26666d743d737667 align="left")
        
          
        Alternative implementations: have CI server push chart to **helm registry**  
        
        ![](https://camo.githubusercontent.com/884581e6af7fc37b24792a4536eb8fe2e066d5a1dc066fee7a2746813ac843ed/68747470733a2f2f7777772e706c616e74756d6c2e636f6d2f706c616e74756d6c2f70726f78793f7372633d68747470733a2f2f7261772e67697468756275736572636f6e74656e742e636f6d2f636c6f75646f67752f6769746f70732d7061747465726e732f6d61696e2f7372632f70756d6c2f636f6e6669672d73706c69742d68656c6d2d7265706f2e70756d6c26666d743d737667 align="left")
        
          
        Or use push **helm chart to OCI registry**  
        
        ![](https://camo.githubusercontent.com/99af308b29dc57fd1237f032563d5b45a3d7d04a4bc102964e549ed8896a5968/68747470733a2f2f7777772e706c616e74756d6c2e636f6d2f706c616e74756d6c2f70726f78793f7372633d68747470733a2f2f7261772e67697468756275736572636f6e74656e742e636f6d2f636c6f75646f67752f6769746f70732d7061747465726e732f6d61696e2f7372632f70756d6c2f636f6e6669672d73706c69742d68656c6d2d6f63692e70756d6c26666d743d737667 align="left")
        
          
        Or use any config management tool (e.g. `helm template`, `kustomize build`, `kubectl kustomize`, [jsonnet](https://jsonnet.org/), [cuelang](https://cuelang.org/), [timoni](https://timoni.sh/), etc. ) on the CI server for pushing the final manifests as **OCI artifacts**[**<sup>9</sup>**](https://github.com/cloudogu/gitops-patterns#user-content-fn-22-02cfecf39363ede31ff61b8f96495d90) **to the registry** (Rendered Manifests Pattern[<sup>10</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fn-23-02cfecf39363ede31ff61b8f96495d90)).  
        Then have the config repo point to the OCI artifact (e.g. via Flux `Kustomization`).  
        This way, the OCI registry functions as a "GitOps Cache"[<sup>11</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fn-21-02cfecf39363ede31ff61b8f96495d90):  
        The operator only needs to pull the artifacts instead of rendering/overlaying the config from different sources.  
        
        ![](https://camo.githubusercontent.com/c3e2f3b05e580c9cd581f38a197be2af97be2d92063d507edbda3d85f14fa095/68747470733a2f2f7777772e706c616e74756d6c2e636f6d2f706c616e74756d6c2f70726f78793f7372633d68747470733a2f2f7261772e67697468756275736572636f6e74656e742e636f6d2f636c6f75646f67752f6769746f70732d7061747465726e732f6d61696e2f7372632f70756d6c2f636f6e6669672d73706c69742d6f63692d6172746966616374732e70756d6c26666d743d737667 align="left")
        
* **Repo per environment** [<sup>5</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fn-4-02cfecf39363ede31ff61b8f96495d90)  
    Synonym: Environment per repository[<sup>12</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fn-5-02cfecf39363ede31ff61b8f96495d90), Repo per Stage
    

### Promotion

See also [part 4️⃣ of the article series](https://cloudogu.com/en/blog/gitops-repository-patterns-part-4-promotion-patterns).

We understand the term "promotion" as the process of deploying applications to different environments.  
Sometimes, the term "promotion" is prefixed with other words: [Release](https://codefresh.io/blog/how-to-model-your-gitops-environments-and-promote-releases-between-them/)/[Application](https://kubernetes.io/docs/tutorials/kubernetes-basics/update/update-intro)/[Environment](https://github.com/kostis-codefresh/gitops-environment-promotion)/[Workload](https://www.weave.works/blog/kubernetes-workload-promotion-in-gitops-cd-pipelines)/[Change](https://twitter.com/argoproj/status/1642527308450873345).

For promotion, we see different sets of patterns:

* one regarding the modelling of environments and
    
* one regarding the implementation of the actual process of promotion.
    

#### Environments

* **Folder/Directory per environment**  
    Synonym: Environment per folder [<sup>12</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fn-5-02cfecf39363ede31ff61b8f96495d90)
    
* **Repo per environment** [<sup>5</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fn-4-02cfecf39363ede31ff61b8f96495d90)  
    Synonym: Environment per repo [<sup>12</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fn-5-02cfecf39363ede31ff61b8f96495d90)
    
* **Branch per environment**  
    Synonym: Environment per branch [<sup>12</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fn-5-02cfecf39363ede31ff61b8f96495d90)  
    Often discouraged [<sup>7</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fn-6-02cfecf39363ede31ff61b8f96495d90) or declared an anti-pattern[<sup>13</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fn-7-02cfecf39363ede31ff61b8f96495d90)[<sup>14</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fn-14-02cfecf39363ede31ff61b8f96495d90), but can work [<sup>15</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fn-13-02cfecf39363ede31ff61b8f96495d90).
    
* **Preview environments** [<sup>16</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fn-9-02cfecf39363ede31ff61b8f96495d90) [<sup>17</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fn-10-02cfecf39363ede31ff61b8f96495d90) [<sup>18</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fn-11-02cfecf39363ede31ff61b8f96495d90)  
    Synonyms: ephemeral, dynamic, pull request[<sup>19</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fn-8-02cfecf39363ede31ff61b8f96495d90), test, temporary[<sup>16</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fn-9-02cfecf39363ede31ff61b8f96495d90)  
    Beyond the GitOps world also known as "Preview Deployments"[<sup>20</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fn-15-02cfecf39363ede31ff61b8f96495d90) and "Deploy Previews"[<sup>21</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fn-16-02cfecf39363ede31ff61b8f96495d90)
    

#### Implementation

* **Configuration Management**
    
    * Synonyms:
        
        * General: Templating, Patching, Overlay, Rendering, Hydrating
            
        * templates = dry; rendered = hydrated [<sup>22</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fn-26-02cfecf39363ede31ff61b8f96495d90)
            
    * Where to render the manifests?
        
        * On the CI Server (**Rendered Manifests Pattern**[<sup>10</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fn-23-02cfecf39363ede31ff61b8f96495d90))  
            This pattern also fits nicely with Flux's OCI artifacts feature (see [Config split](https://github.com/cloudogu/gitops-patterns#config-split)).
            
        * On the GitOps Operator (**GitOps Operator Rendering** or **GitOps Controller Rendering**[<sup>23</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fn-25-02cfecf39363ede31ff61b8f96495d90))
            
    * Tools:
        
        * Kustomize
            
            * Plain`kustomization.yaml` - **operator-agnostic** (GitOps Operator Rendering on Argo CD and Flux)
                
            * ≠ Flux CRD `Kustomization` (GitOps Operator Rendering)
                
            * `kustomize build` / `kubectl kustomize` via CI server (Rendered Manifests)
                
        * Helm
            
            * CRD such as `HelmRelease` (GitOps Operator Rendering on Flux) or `Application` (GitOps Operator Rendering on ArgoCD)
                
            * Umbrella Chart[<sup>24</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fn-12-02cfecf39363ede31ff61b8f96495d90) (common on Argo CD, possible but unusual on Flux)
                
            * `helm template` on CI server (Rendered Manifests)
                
        * Others, e.g. Jsonnet, CueLang, Timoni
            
            * Rendered Manifests Pattern
                
            * Argo CD Config Management Plugins[<sup>25</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fn-24-02cfecf39363ede31ff61b8f96495d90) (built-in for JSonnet)
                
* **Global Environments** vs **Environment per App**[<sup>4</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fn-3-02cfecf39363ede31ff61b8f96495d90)  
    
    ![Global Envs](https://github.com/cloudogu/gitops-patterns/raw/main/src/svg/global-environments.svg align="left")
    
    ![Env per app](https://github.com/cloudogu/gitops-patterns/raw/main/src/svg/environment-per-app.svg align="left")
    
* **Config update**  
    Who updates image (version) in GitOps repo, creates branch and PR?
    
    * Manual: Human pushes branch and create PR 🥵
        
    * CI Server: Build job pushes branch, creates PR  
        
        ![](https://camo.githubusercontent.com/162f9cc11831bfe792d6cd56b95392d181816c18a5469bd0e8a39e38a11b8a82/68747470733a2f2f7777772e706c616e74756d6c2e636f6d2f706c616e74756d6c2f70726f78793f7372633d68747470733a2f2f7261772e67697468756275736572636f6e74656e742e636f6d2f636c6f75646f67752f6769746f70732d7061747465726e732f6d61696e2f7372632f70756d6c2f636f6e6669672d7570646174652d63692e70756d6c26666d743d737667 align="left")
        
    * Image Updater: Operator pushes branch, create PR manually  
        
        ![](https://camo.githubusercontent.com/d6b7331db9748f26dbe0bdaf01c875337602618dfa732f96602c187f66d79a42/68747470733a2f2f7777772e706c616e74756d6c2e636f6d2f706c616e74756d6c2f70726f78793f7372633d68747470733a2f2f7261772e67697468756275736572636f6e74656e742e636f6d2f636c6f75646f67752f6769746f70732d7061747465726e732f6d61696e2f7372632f70756d6c2f636f6e6669672d7570646174652d696d6167652d757064617465722e70756d6c26666d743d737667 align="left")
        
    * Dependency Bot: Bot pushes branch, creates PR  
        
        ![](https://camo.githubusercontent.com/6566182ca4cc7f6958907bf7055cd0ba697578f3bacb853da1a4f9458da70a7e/68747470733a2f2f7777772e706c616e74756d6c2e636f6d2f706c616e74756d6c2f70726f78793f7372633d68747470733a2f2f7261772e67697468756275736572636f6e74656e742e636f6d2f636c6f75646f67752f6769746f70732d7061747465726e732f6d61696e2f7372632f70756d6c2f636f6e6669672d7570646174652d646570656e64656e63792d626f742e70756d6c26666d743d737667 align="left")
        

### Wiring

See also [part 5️⃣ of the article series](https://cloudogu.com/en/blog/gitops-repository-patterns-part-5-wiring-patterns).

* **Bootstrapping** , e.g. using `kubectl` or operator-specific CLI such as `flux` or `argocd-autopilot`
    
* **Linking** e.g. using Operator-specific CRDs such as `Kustomization` (Flux) or `Application` (ArgoCD)
    
    * **Nesting**, e.g. App of Apps pattern [<sup>26</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fn-17-02cfecf39363ede31ff61b8f96495d90) (ArgoCD)
        
    * **Templating**, e.g. implemented using `ApplicationSets`
        

## Public GitOps Repo Examples

See also [<sup>4</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fn-3-02cfecf39363ede31ff61b8f96495d90).

See also [part 6️⃣ of the article series](https://cloudogu.com/de/blog/gitops-repository-patterns-part-6-examples).

The diagrams have been created with [tree2svg](https://github.com/schnatterer/tree2svg).

### GitOps Playground

[cloudogu/gitops-playground](https://github.com/cloudogu/gitops-playground)

* **Repo pattern**: Per team mixed with per app (implemented via Config Replication)
    
* **Operator pattern**: Instance per Cluster (Hub and Spoke also possible)
    
* **Operator**: ArgoCD (Flux)
    
* Boostrapping: `Helm`, `kubectl`
    
* Linking: ArgoCD `Application`
    
* **Features**:
    
    * Env per app Pattern
        
    * Operate ArgoCD with GitOps
        
    * Config Update via CI server
        
    * Mixed repo patterns
        
    * ArgoCD **and** Flux examples
        

[![](https://github.com/cloudogu/gitops-patterns/raw/main/src/repo-examples/2-with-ci.svg align="left")](https://github.com/cloudogu/gitops-patterns/blob/main/src/repo-examples/2-with-ci.svg)

### ArgoCD autopilot

[argoproj-labs/argocd-autopilot](https://github.com/argoproj-labs/argocd-autopilot)

* **Repo pattern**: Monorepo
    
* **Operator pattern**: Instance per Cluster / Hub and Spoke
    
* **Operator**: ArgoCD
    
* **Boostrapping**: `argocd-autopilot`
    
* Linking: `kustomization.yaml`, ArgoCD `Application`, `ApplicationSet`
    
* Features:
    
    * Operate ArgoCD with GitOps
        
    * In the future: a lot more automation and YAML creation
        

[![](https://github.com/cloudogu/gitops-patterns/raw/main/src/repo-examples/3.svg align="left")](https://github.com/cloudogu/gitops-patterns/blob/main/src/repo-examples/3.svg)

### Flux Monorepo

[fluxcd/flux2-kustomize-helm-example](https://github.com/fluxcd/flux2-kustomize-helm-example)

* **Repo pattern**: Monorepo
    
* **Operator pattern**: Instance per Cluster
    
* **Operator**: Flux
    
* **Boostrapping**: `flux` CLI
    
* **Linking**: `kustomization.yaml`, Flux `Kustomization`
    
* **Features**: cross-cutting infra
    

[![](https://github.com/cloudogu/gitops-patterns/raw/main/src/repo-examples/4.svg align="left")](https://github.com/cloudogu/gitops-patterns/blob/main/src/repo-examples/4.svg)

### Flux repo per team/tenant

[fluxcd/flux2-multi-tenancy](https://github.com/fluxcd/flux2-multi-tenancy)

* **Repo pattern**: Repo per team/tenant
    
* **Operator pattern**: Instance per Cluster
    
* **Operator**: Flux
    
* **Boostrapping**: `flux` CLI
    
* **Linking**: `kustomization.yaml`, Flux `Kustomization`
    
* **Features**: cross-cutting infra
    

[![](https://github.com/cloudogu/gitops-patterns/raw/main/src/repo-examples/5.svg align="left")](https://github.com/cloudogu/gitops-patterns/blob/main/src/repo-examples/5.svg)

### 📕 Path to GitOps examples

[christianh814/example-kubernetes-go-repo](https://github.com/christianh814/example-kubernetes-go-repo)

[christianh814/example-kubernetes-goflux-repo](https://github.com/christianh814/example-kubernetes-goflux-repo/)

[christianh814/example-openshift-go-repo](https://github.com/christianh814/example-openshift-go-repo)

* **Repo pattern**: Monorepo
    
* **Operator pattern**: Instance per Cluster
    
* **Operator**: \[ArgoCD\] \[flux\]
    
* **Boostrapping**: kubectl
    
* **Linking**: `kustomization.yaml`,
    
    * ArgoCD `Application`, `ApplicationSet` /
        
    * Flux `Kustomization`
        
* **Features**:
    
    * Cross-cutting infra and app(s)
        
    * ArgoCD **and** Flux examples
        

[![](https://github.com/cloudogu/gitops-patterns/raw/main/src/repo-examples/6.svg align="left")](https://github.com/cloudogu/gitops-patterns/blob/main/src/repo-examples/6.svg)

### Environment variations

[kostis-codefresh/gitops-environment-promotion](https://github.com/kostis-codefresh/gitops-environment-promotion)

* Operator: ArgoCD (Flux)
    
* Features:
    
    * Env variants for a single app
        
    * Promotion "via cp"
        

[![](https://github.com/cloudogu/gitops-patterns/raw/main/src/repo-examples/7.svg align="left")](https://github.com/cloudogu/gitops-patterns/blob/main/src/repo-examples/7.svg)

### Others

Here are some other examples that we haven't had a chance to look at in more detail:

* [Lp-Francois/argocd-multi-tenancy](https://github.com/Lp-Francois/argocd-multi-tenancy)
    

## Synonyms

* Patterns ≈ strategies, models, approaches, best practices, standards
    
* GitOps process design ≈ GitOps repository structures,
    
* GitOps Operator ≈ GitOps controller ≈ GitOps agent
    
* Config Repo = GitOps repo, Infra repo, Payload repo  
    
    ![Config repo example](https://github.com/cloudogu/gitops-patterns/raw/main/src/svg/config-repo-example.svg align="left")
    
* App repo = Source code repo, Source repo  
    
    ![App repo example](https://github.com/cloudogu/gitops-patterns/raw/main/src/svg/app-repo-example.svg align="left")
    
* Environment = Stage
    
* Folder = Directory
    
* Templating ≈ Patching, Overlay, Rendering, Bundling, Packaging?
    

## References

## Footnotes

1. Article [A Comprehensive Overview of Argo CD Architectures – 2023](https://codefresh.io/blog/a-comprehensive-overview-of-argo-cd-architectures-2023/) by Dan Garfield [↩](https://github.com/cloudogu/gitops-patterns#user-content-fnref-1-02cfecf39363ede31ff61b8f96495d90) [↩<sup>2</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fnref-1-2-02cfecf39363ede31ff61b8f96495d90) [↩<sup>3</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fnref-1-3-02cfecf39363ede31ff61b8f96495d90)
    
2. Article/Book [How to set up your GitOps directory structure](https://developers.redhat.com/articles/2022/09/07/how-set-your-gitops-directory-structure) by Christian Hernandez [↩](https://github.com/cloudogu/gitops-patterns#user-content-fnref-2-02cfecf39363ede31ff61b8f96495d90) [↩<sup>2</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fnref-2-2-02cfecf39363ede31ff61b8f96495d90) [↩<sup>3</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fnref-2-3-02cfecf39363ede31ff61b8f96495d90) [↩<sup>4</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fnref-2-4-02cfecf39363ede31ff61b8f96495d90)
    
3. Talk [Control Plane, Service, or Both? – Argo CD Multi-Cluster Architectures - Nicholas Morey, Akuity](https://www.youtube.com/watch?v=vyaZv4yM3_o), Article [How many do you need? - Argo CD Architectures Explained](https://akuity.io/blog/argo-cd-architectures-explained/) by Nicholas Morey [↩](https://github.com/cloudogu/gitops-patterns#user-content-fnref-18-02cfecf39363ede31ff61b8f96495d90) [↩<sup>2</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fnref-18-2-02cfecf39363ede31ff61b8f96495d90) [↩<sup>3</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fnref-18-3-02cfecf39363ede31ff61b8f96495d90)
    
4. Slides [The perfect GitOps process: repos, folders, stages, patterns](https://cloudogu.github.io/gitops-talks/2023-03-mastering-gitops/#/) by Johannes Schnatterer [↩](https://github.com/cloudogu/gitops-patterns#user-content-fnref-3-02cfecf39363ede31ff61b8f96495d90) [↩<sup>2</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fnref-3-2-02cfecf39363ede31ff61b8f96495d90) [↩<sup>3</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fnref-3-3-02cfecf39363ede31ff61b8f96495d90) [↩<sup>4</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fnref-3-4-02cfecf39363ede31ff61b8f96495d90) [↩<sup>5</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fnref-3-5-02cfecf39363ede31ff61b8f96495d90)
    
5. Documentation [Flux | Ways of structuring your repositories](https://github.com/fluxcd/website/blob/a426979/content/en/flux/guides/repository-structure.md#repo-per-app) [↩](https://github.com/cloudogu/gitops-patterns#user-content-fnref-4-02cfecf39363ede31ff61b8f96495d90) [↩<sup>2</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fnref-4-2-02cfecf39363ede31ff61b8f96495d90) [↩<sup>3</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fnref-4-3-02cfecf39363ede31ff61b8f96495d90) [↩<sup>4</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fnref-4-4-02cfecf39363ede31ff61b8f96495d90) [↩<sup>5</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fnref-4-5-02cfecf39363ede31ff61b8f96495d90) [↩<sup>6</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fnref-4-6-02cfecf39363ede31ff61b8f96495d90) [↩<sup>7</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fnref-4-7-02cfecf39363ede31ff61b8f96495d90)
    
6. Documentation [Argo CD: Best Practices](https://github.com/argoproj/argo-cd/blob/v2.8.4/docs/user-guide/best_practices.md#separating-config-vs-source-code-repositories) [↩](https://github.com/cloudogu/gitops-patterns#user-content-fnref-19-02cfecf39363ede31ff61b8f96495d90)
    
7. Talk [GitOps: Core Concepts & Ways of Structuring Your Repos](https://www.youtube.com/watch?v=vLNZA_2Na_s) by Pinky Ravi and Scott Rigby [↩](https://github.com/cloudogu/gitops-patterns#user-content-fnref-6-02cfecf39363ede31ff61b8f96495d90) [↩<sup>2</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fnref-6-2-02cfecf39363ede31ff61b8f96495d90)
    
8. [Discussion on LinkedIn](https://www.linkedin.com/feed/update/urn:li:activity:7121084907526713346?commentUrn=urn%3Ali%3Acomment%3A%28activity%3A7121084907526713346%2C7121143258256166912%29&dashCommentUrn=urn%3Ali%3Afsd_comment%3A%287121143258256166912%2Curn%3Ali%3Aactivity%3A7121084907526713346%29) Benjamin Ruland and Johannes Schnatterer [↩](https://github.com/cloudogu/gitops-patterns#user-content-fnref-20-02cfecf39363ede31ff61b8f96495d90)
    
9. Documentation [Flux | OCI cheatsheet](https://github.com/fluxcd/website/blob/a426979/content/en/flux/cheatsheets/oci-artifacts.md) [↩](https://github.com/cloudogu/gitops-patterns#user-content-fnref-22-02cfecf39363ede31ff61b8f96495d90)
    
10. Talk: [GitOpsCon EU 23: The Art of GitOps: Rendered Manifests](https://gitopsconeu2023.sched.com/event/1Unk5/the-art-of-gitops-rendered-manifests-christian-hernandez-akuity?iframe=yes&w=100%&sidebar=yes&bg=no) by Christian Hernandez [↩](https://github.com/cloudogu/gitops-patterns#user-content-fnref-23-02cfecf39363ede31ff61b8f96495d90) [↩<sup>2</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fnref-23-2-02cfecf39363ede31ff61b8f96495d90)
    
11. Talk: [Mastering GitOps 2023: Keynote: GitOps Emerging Developments and Predictions](https://vimeo.com/805175348) by Alexis Richardson [↩](https://github.com/cloudogu/gitops-patterns#user-content-fnref-21-02cfecf39363ede31ff61b8f96495d90)
    
12. Lesson [GitOps at Scale Lesson series - Git repository strategies](https://learning.codefresh.io/path-player?courseid=gitops-scale&unit=gitops-scale_63a08184b7f67Unit) by Codefresh (paywalled) [↩](https://github.com/cloudogu/gitops-patterns#user-content-fnref-5-02cfecf39363ede31ff61b8f96495d90) [↩<sup>2</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fnref-5-2-02cfecf39363ede31ff61b8f96495d90) [↩<sup>3</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fnref-5-3-02cfecf39363ede31ff61b8f96495d90) [↩<sup>4</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fnref-5-4-02cfecf39363ede31ff61b8f96495d90)
    
13. Article [Stop Using Branches for Deploying to Different GitOps Environments](https://codefresh.io/blog/how-to-model-your-gitops-environments-and-promote-releases-between-them/) by Kostis Kapelonis [↩](https://github.com/cloudogu/gitops-patterns#user-content-fnref-7-02cfecf39363ede31ff61b8f96495d90)
    
14. Article [Git best practices: Workflows for GitOps deployments](https://developers.redhat.com/articles/2022/07/20/git-workflows-best-practices-gitops-deployments) by Christian Hernandez [↩](https://github.com/cloudogu/gitops-patterns#user-content-fnref-14-02cfecf39363ede31ff61b8f96495d90)
    
15. Article [Monitoring and Hardening the GitOps Delivery Pipeline with Flux](https://dev.to/mms-tech/monitoring-and-hardening-the-gitops-delivery-pipeline-with-flux-1gk) by Florian Heubeck [↩](https://github.com/cloudogu/gitops-patterns#user-content-fnref-13-02cfecf39363ede31ff61b8f96495d90)
    
16. Article [Creating Temporary Preview Environments Based On Pull Requests With Argo CD And Codefresh](https://codefresh.io/blog/creating-temporary-preview-environments-based-pull-requests-argo-cd-codefresh/) by Codefresh [↩](https://github.com/cloudogu/gitops-patterns#user-content-fnref-9-02cfecf39363ede31ff61b8f96495d90) [↩<sup>2</sup>](https://github.com/cloudogu/gitops-patterns#user-content-fnref-9-2-02cfecf39363ede31ff61b8f96495d90)
    
17. Talk [GitOps Con Europe - Implementing Preview Environments with GitOps in Kubernetes](https://www.youtube.com/watch?v=QNAiIJRIVWA&t=202s) by François Le Pape, Remazing [↩](https://github.com/cloudogu/gitops-patterns#user-content-fnref-10-02cfecf39363ede31ff61b8f96495d90)
    
18. Talk [Preview Environments with ArgoCD](https://www.youtube.com/watch?v=7ahiwZuiCBM) by Brandon Phillips [↩](https://github.com/cloudogu/gitops-patterns#user-content-fnref-11-02cfecf39363ede31ff61b8f96495d90)
    
19. Video [Environments Based On Pull Requests (PRs): Using Argo CD To Apply GitOps Principles On Previews](https://www.youtube.com/watch?v=cpAaI8p4R60) by Viktor Farcic [↩](https://github.com/cloudogu/gitops-patterns#user-content-fnref-8-02cfecf39363ede31ff61b8f96495d90)
    
20. Documentation [Vercel: Preview Deployments](https://vercel.com/docs/concepts/deployments/preview-deployments) [↩](https://github.com/cloudogu/gitops-patterns#user-content-fnref-15-02cfecf39363ede31ff61b8f96495d90)
    
21. Documentation [Netlify: Deploy Previews](https://docs.netlify.com/site-deploys/deploy-previews/) [↩](https://github.com/cloudogu/gitops-patterns#user-content-fnref-16-02cfecf39363ede31ff61b8f96495d90)
    
22. [Discussion on GitHub](https://github.com/argoproj/argo-cd/pull/17506#discussion_r1525548738) Michael Crenshaw [↩](https://github.com/cloudogu/gitops-patterns#user-content-fnref-26-02cfecf39363ede31ff61b8f96495d90)
    
23. [Discussion on LinkedIn](https://www.linkedin.com/feed/update/urn:li:activity:7138481326424276992?commentUrn=urn%3Ali%3Acomment%3A%28activity%3A7138481326424276992%2C7138548943428194304%29&dashCommentUrn=urn%3Ali%3Afsd_comment%3A%287138548943428194304%2Curn%3Ali%3Aactivity%3A7138481326424276992%29) Christian Hernandez, Scott Rigby and Johannes Schnatterer [↩](https://github.com/cloudogu/gitops-patterns#user-content-fnref-25-02cfecf39363ede31ff61b8f96495d90)
    
24. Documentation [Helm | Chart Development Tips and Tricks](https://github.com/helm/helm-www/blob/d2543/content/en/docs/howto/charts_tips_and_tricks.md#complex-charts-with-many-dependencies) [↩](https://github.com/cloudogu/gitops-patterns#user-content-fnref-12-02cfecf39363ede31ff61b8f96495d90)
    
25. Documentation [Argo CD | Config Management Plugins](https://github.com/argoproj/argo-cd/blob/v2.9.3/docs/operator-manual/config-management-plugins.md) [↩](https://github.com/cloudogu/gitops-patterns#user-content-fnref-24-02cfecf39363ede31ff61b8f96495d90)
    
26. Documentation [ArgoCD: Cluster Bootstrapping - App Of Apps Pattern](https://github.com/argoproj/argo-cd/blob/v2.9.3/docs/operator-manual/cluster-bootstrapping.md#app-of-apps-pattern) [↩](https://github.com/cloudogu/gitops-patterns#user-content-fnref-17-02cfecf39363ede31ff61b8f96495d90)
