Skip to content

Commit

Permalink
Add "config split" pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
schnatterer committed Oct 26, 2023
1 parent a8a1fcf commit 436a00c
Show file tree
Hide file tree
Showing 4 changed files with 202 additions and 4 deletions.
18 changes: 14 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ PRs welcome!
- [Repository structure](#repository-structure)
- [Monorepo](#monorepo)
- [Repo per Team](#repo-per-team)
- [Repo per Application](#repo-per-app) (can be implemented via [Config-Code-Separation](#config-code-separation), [Config Replication](#config-replication) or
- [Repo per Application](#repo-per-app) (can be implemented via [Config-Code-Separation](#config-code-separation), [Config Replication](#config-replication), [Config Split](#config-split) or
[Repo Pointer](#repo-pointer))
- [Repo per Environment](#repo-per-env)
- [Promotion](#promotion)
Expand Down Expand Up @@ -120,12 +120,21 @@ More Patterns:
* **Repo per Application** [^2][^4] <span id="repo-per-app"/>
Implementations:
* Config-Code-Separation [^19] <span id="config-code-separation"/>
Keep code in app repo, config in config repo
<img width=50% src="https://www.plantuml.com/plantuml/proxy?src=https://raw.githubusercontent.com/cloudogu/gitops-patterns/main/src/puml/gitops-with-app-repo-separation.puml&fmt=svg">
* Config replication [^3] <span id="config-replication"/>
* Config replication [^3] <span id="config-replication"/>
Keep config in app repo and have CI server replicate it to the config repo
<img width=50% src="https://www.plantuml.com/plantuml/proxy?src=https://raw.githubusercontent.com/cloudogu/gitops-patterns/main/src/puml/gitops-with-app-repo-replication.puml&fmt=svg">
Alternative implementation: replicate to OCI as a "GitOps Cache":
<img width=50% src="https://www.plantuml.com/plantuml/proxy?src=https://raw.githubusercontent.com/cloudogu/gitops-patterns/main/src/puml/gitops-with-app-repo-replication-oci.puml&fmt=svg">
* Repo pointer [^6][^3] <span id="repo-pointer"/>
* Config Split [^20] <span id="config-split"/>
Keep parts of the config in app repo (e.g. helm chart), and rest in config repo (e.g. value.yamls for different envs)
<img width=50% src="https://www.plantuml.com/plantuml/proxy?src=https://raw.githubusercontent.com/cloudogu/gitops-patterns/main/src/puml/gitops-with-app-repo-split-git.puml&fmt=svg">
Alternative implementations: have CI server push chart to OCI or helm registry
<img width=50% src="https://www.plantuml.com/plantuml/proxy?src=https://raw.githubusercontent.com/cloudogu/gitops-patterns/main/src/puml/gitops-with-app-repo-split-oci.puml&fmt=svg">
<img width=50% src="https://www.plantuml.com/plantuml/proxy?src=https://raw.githubusercontent.com/cloudogu/gitops-patterns/main/src/puml/gitops-with-app-repo-split-helm-reg.puml&fmt=svg">

* Repo pointer [^6][^3] <span id="repo-pointer"/>
<img width=50% src="https://www.plantuml.com/plantuml/proxy?src=https://raw.githubusercontent.com/cloudogu/gitops-patterns/main/src/puml/gitops-with-app-repo-pointer.puml&fmt=svg">
* **Repo per environment** [^4] <span id="repo-per-env"/>
Synonym: Environment per repository[^5], Repo per Stage
Expand Down Expand Up @@ -325,4 +334,5 @@ Here are some other examples that we haven't had a chance to look at in more det
[^16]: Documentation [Netlify: Deploy Previews](https://docs.netlify.com/site-deploys/deploy-previews/)
[^17]: Documentation [ArgoCD: Cluster Bootstrapping - App Of Apps Pattern](https://github.com/argoproj/argo-cd/blob/v2.8.4/docs/operator-manual/cluster-bootstrapping.md#app-of-apps-pattern)
[^18]: 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
[^19]: 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)
[^19]: 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)
[^20]: Discussion on LinkedIn: [Benjamin Ruland and Johannes Schnatterer](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)
61 changes: 61 additions & 0 deletions src/puml/gitops-with-app-repo-split-git.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
@startuml

!includeurl https://raw.githubusercontent.com/michiel/plantuml-kubernetes-sprites/master/resource/k8s-sprites-unlabeled-25pct.iuml

!define ICONURL https://raw.githubusercontent.com/tupadr3/plantuml-icon-font-sprites/v2.0.0
!includeurl ICONURL/common.puml
!includeurl ICONURL/devicons/docker.puml
!includeurl ICONURL/devicons/git.puml
!includeurl ICONURL/font-awesome-5/jenkins.puml
!includeurl ICONURL/font-awesome-5/sync.puml

!define CLOUDOGUURL https://raw.githubusercontent.com/cloudogu/plantuml-cloudogu-sprites/master
!includeurl CLOUDOGUURL/tools/k8s.puml

!define CLOUDOGU_BLUE #23a3dd
!define COLOR_ABOVE_TRANSPARENT_BACKGROUND #777

skinparam backgroundcolor TRANSPARENT
skinparam DefaultFontColor COLOR_ABOVE_TRANSPARENT_BACKGROUND
skinparam sequenceArrowColor COLOR_ABOVE_TRANSPARENT_BACKGROUND

skinparam actorStyle awesome

together {
actor Developer as user
rectangle "<$git>\nApp Repo" as appRepo
rectangle "<$git>\nConfig Repo" as configRepo
rectangle "<$jenkins>\nCI Server" as ciServer
}

rectangle "<$k8s>\nK8s Cluster" as k8s {
rectangle "<$sync>\nGitOps\noperator" as operator
}
rectangle "<$docker>\nOCI Registry" as registry

user -[#red]> appRepo : push\ncode\n<color:red>+chart
user -[#red]> configRepo : <color:red>push values.yaml per env
appRepo -[hidden]> configRepo
appRepo <-- ciServer : pull
ciServer -> registry : push\nimage
configRepo <- ciServer : push new\nimage version
k8s -[#red]> appRepo : <color:red>pull\n<color:red>chart
k8s --> registry : pull\nimage
k8s -[#red]> configRepo : <color:red>pull\n<color:red>values.yaml
k8s -> k8s : deploy


skinparam actor {
BackgroundColor CLOUDOGU_BLUE
BorderColor #16688d
}

skinparam rectangle {
BackgroundColor CLOUDOGU_BLUE
BorderColor #16688d
FontColor WHITE
backgroundColor<<node>> WHITE
FontColor<<node>> CLOUDOGU_BLUE
}

@enduml
65 changes: 65 additions & 0 deletions src/puml/gitops-with-app-repo-split-helm-reg.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
@startuml

!includeurl https://raw.githubusercontent.com/michiel/plantuml-kubernetes-sprites/master/resource/k8s-sprites-unlabeled-25pct.iuml

!define ICONURL https://raw.githubusercontent.com/tupadr3/plantuml-icon-font-sprites/v2.4.0
!includeurl ICONURL/common.puml
!includeurl ICONURL/devicons/docker.puml
!includeurl ICONURL/devicons/git.puml
!includeurl ICONURL/font-awesome-5/jenkins.puml
!includeurl ICONURL/font-awesome-5/sync.puml
!includeurl ICONURL/font-awesome-5/dharmachakra.puml

!define CLOUDOGUURL https://raw.githubusercontent.com/cloudogu/plantuml-cloudogu-sprites/master
!includeurl CLOUDOGUURL/tools/k8s.puml

!define CLOUDOGU_BLUE #23a3dd
!define COLOR_ABOVE_TRANSPARENT_BACKGROUND #777

skinparam backgroundcolor TRANSPARENT
skinparam DefaultFontColor COLOR_ABOVE_TRANSPARENT_BACKGROUND
skinparam sequenceArrowColor COLOR_ABOVE_TRANSPARENT_BACKGROUND

skinparam actorStyle awesome

together {
actor Developer as user
rectangle "<$git>\nApp Repo" as appRepo
rectangle "<$git>\nConfig Repo" as configRepo
rectangle "<$jenkins>\nCI Server" as ciServer
}

rectangle "<$k8s>\nK8s Cluster" as k8s {
rectangle "<$sync>\nGitOps\noperator" as operator
}
rectangle "<$dharmachakra>\nHelm Registry" as helmRegistry
rectangle "<$docker>\nOCI Registry" as ociRegistry

user -[#red]> appRepo : push\ncode\n<color:red>+chart
user -[#red]> configRepo : <color:red>push values.yaml per env
appRepo -[hidden]> configRepo
appRepo <-- ciServer : pull
ciServer -[#red]> helmRegistry : <color:red>push\n<color:red>chart
ciServer --> ociRegistry : push\nimage
configRepo <- ciServer : push new\nimage version
k8s -[#red]> helmRegistry : <color:red>pull\n<color:red>chart
k8s -> ociRegistry : pull\nimage
k8s -[#red]> configRepo : <color:red>pull\n<color:red>values.yaml

k8s -> k8s : deploy


skinparam actor {
BackgroundColor CLOUDOGU_BLUE
BorderColor #16688d
}

skinparam rectangle {
BackgroundColor CLOUDOGU_BLUE
BorderColor #16688d
FontColor WHITE
backgroundColor<<node>> WHITE
FontColor<<node>> CLOUDOGU_BLUE
}

@enduml
62 changes: 62 additions & 0 deletions src/puml/gitops-with-app-repo-split-oci.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
@startuml

!includeurl https://raw.githubusercontent.com/michiel/plantuml-kubernetes-sprites/master/resource/k8s-sprites-unlabeled-25pct.iuml

!define ICONURL https://raw.githubusercontent.com/tupadr3/plantuml-icon-font-sprites/v2.0.0
!includeurl ICONURL/common.puml
!includeurl ICONURL/devicons/docker.puml
!includeurl ICONURL/devicons/git.puml
!includeurl ICONURL/font-awesome-5/jenkins.puml
!includeurl ICONURL/font-awesome-5/sync.puml

!define CLOUDOGUURL https://raw.githubusercontent.com/cloudogu/plantuml-cloudogu-sprites/master
!includeurl CLOUDOGUURL/tools/k8s.puml

!define CLOUDOGU_BLUE #23a3dd
!define COLOR_ABOVE_TRANSPARENT_BACKGROUND #777

skinparam backgroundcolor TRANSPARENT
skinparam DefaultFontColor COLOR_ABOVE_TRANSPARENT_BACKGROUND
skinparam sequenceArrowColor COLOR_ABOVE_TRANSPARENT_BACKGROUND

skinparam actorStyle awesome

together {
actor Developer as user
rectangle "<$git>\nApp Repo" as appRepo
rectangle "<$git>\nConfig Repo" as configRepo
rectangle "<$jenkins>\nCI Server" as ciServer
}

rectangle "<$k8s>\nK8s Cluster" as k8s {
rectangle "<$sync>\nGitOps\noperator" as operator
}
rectangle "<$docker>\nOCI Registry" as registry

user -[#red]> appRepo : push\ncode\n<color:red>+chart
user -[#red]> configRepo : <color:red>push values.yaml per env
appRepo -[hidden]> configRepo
appRepo <-- ciServer : pull
ciServer -[#red]> registry : <color:red>push\n<color:red>chart
ciServer -> registry : push\nimage
configRepo <- ciServer : push new\nimage version
k8s -[#red]> registry : <color:red>pull\n<color:red>chart
k8s --> registry : pull\nimage
k8s -[#red]> configRepo : <color:red>pull\n<color:red>values.yaml
k8s -> k8s : deploy


skinparam actor {
BackgroundColor CLOUDOGU_BLUE
BorderColor #16688d
}

skinparam rectangle {
BackgroundColor CLOUDOGU_BLUE
BorderColor #16688d
FontColor WHITE
backgroundColor<<node>> WHITE
FontColor<<node>> CLOUDOGU_BLUE
}

@enduml

0 comments on commit 436a00c

Please sign in to comment.