Kubernetes uses a monorepo approach for development and testing. For Golang vendoring by 3rdparties we publish subdirectories as separate Github repositories (like k8s.io/client-go, k8s.io/apimachinery, k8s.io/api, etc.) continuously every night, while keeping all history, all Github merge commits and while rewriting commits with Godep-save updates to express dependencies. Sounds easy? It's not! Implementing this was the best learning experience of git and git internals and the topic of this talk.
4. • Founded in 2014 by Google engineers
• 100% OpenSource, Apache license
• Governed by Cloud Native Computing Foundation (CNCF)
• > 100 companies contributing Go
5. Monorepo
+ makes testing easier
+ makes releases easier
+ makes global changes easier
+ is easy to implement
- is not how Golang works
- is not what 3rd-parties expect
- does not scale well
github.com/kubernetes/kubernetes
cmd
pkg
staging
src
k8s.io
api
apimachinery
apiserver
client-go
apiextensions-apiserver
kube-aggregator
sample-apiserver
sample-controller
6. Monorepo
+ makes testing easier
+ makes releases easier
+ makes global changes easier
+ is easy to implement
- is not how Golang works
- is not what 3rd-parties expect
- does not scale well
github.com/kubernetes/kubernetes
cmd
pkg
staging
src
k8s.io
api
apimachinery
apiserver
client-go
apiextensions-apiserver
kube-aggregator
sample-apiserver
sample-controller
vendor
...
symlinks
7. Monorepo
+ makes testing easier
+ makes releases easier
+ makes global changes easier
+ is easy to implement
- is not how Golang works
- is not what 3rd-parties expect
- does not scale well
😱
github.com/kubernetes/kubernetes
cmd
pkg
staging
src
k8s.io
api
apimachinery
apiserver
client-go
apiextensions-apiserver
kube-aggregator
sample-apiserver
sample-controller
vendor
...
symlinks
28. Lessons learnt
• Git data structures are no rocket science
• Choose:
1. 700 lines custom Git code in Go
2. 700 dense bash lines working around git filter-branch and friends
• porcelain vs. plumbing commands
Do not script the former, understand what they do!