Skip to content

Commit 5c1e710

Browse files
committed
Add SIG Architecture Code Organization spotlight article
1 parent 402816f commit 5c1e710

File tree

1 file changed

+140
-0
lines changed

1 file changed

+140
-0
lines changed
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
---
2+
layout: blog
3+
title: "Spotlight on SIG Architecture: Code Organization"
4+
slug: sig-architecture-code-spotlight-2024
5+
canonicalUrl:https://www.kubernetes.dev/blog/2024/04/04/sig-architecture-code-spotlight-2024
6+
date: 2024-04-04
7+
---
8+
9+
** Author: Frederico Muñoz (SAS Institute)**
10+
11+
_This is the third interview of a SIG Architecture Spotlight series that will cover the different
12+
subprojects. We will cover the [SIG Architecture: Code
13+
Organization](https://github.com/kubernetes/community/blob/master/sig-architecture/README.md#code-organization-1)_
14+
15+
In this SIG Architecture spotlight we talked with [Madhav
16+
Jivrajan](https://github.com/MadhavJivrajani) (VMware), a member of the Code Organization
17+
subproject.
18+
19+
## Introducing the Code Organization subproject
20+
21+
**Frederico (FSM)**: Hello Madhav, thank you for your availability. Could you start by telling us a
22+
bit about yourself, your role and how you got involved in Kubernetes?
23+
24+
**Madhav Jivrajani (MJ)**: Hello! My name is Madhav Jivrajani, I serve as a technical lead for SIG
25+
Contributor Experience and a GitHub Admin for the Kubernetes project. Apart from that I also
26+
contribute to SIG API Machinery and SIG Etcd, but more recently, I’ve been helping out with the work
27+
that is needed to help Kubernetes [stay on supported versions of
28+
Go](https://github.com/kubernetes/enhancements/tree/cf6ee34e37f00d838872d368ec66d7a0b40ee4e6/keps/sig-release/3744-stay-on-supported-go-versions),
29+
and it is through this that I am involved with the Code Organization subproject of SIG Architecture.
30+
31+
**FSM**: A project the size of Kubernetes must have unique challenges in terms of code organization
32+
-- is this a fair assumption? If so, what would you pick as some of the main challenges that are
33+
specific to Kubernetes?
34+
35+
**MJ**: That’s a fair assumption! The first interesting challenge comes from the sheer size of the
36+
Kubernetes codebase. We have ~2.2 million lines of Go code (which is steadily decreasing thanks to
37+
[dims](https://github.com/dims) and other folks in this sub-project!), and a little over 240
38+
dependencies that we rely on either directly or indirectly, which is why having a sub-project
39+
dedicated to helping out with dependency management is crucial: we need to know what dependencies
40+
we’re pulling in, what versions these dependencies are at, and tooling to help make sure we are
41+
managing these dependencies across different parts of the codebase in a consistent manner.
42+
43+
Another interesting challenge with Kubernetes is that we publish a lot of Go modules as part of the
44+
Kubernetes release cycles, one example of this is
45+
[`client-go`](https://github.com/kubernetes/client-go).However, we as a project would also like the
46+
benefits of having everything in one repository to get the advantages of using a monorepo, like
47+
atomic commits... so, because of this, code organization works with other SIGs (like SIG Release) to
48+
automate the process of publishing code from the monorepo to downstream individual repositories
49+
which are much easier to consume, and this way you won’t have to import the entire Kubernetes
50+
codebase!
51+
52+
## Code organization and Kubernetes
53+
54+
**FSM**: For someone just starting contributing to Kubernetes code-wise, what are the main things
55+
they should consider in terms of code organization? How would you sum up the key concepts?
56+
57+
**MJ**: I think one of the key things to keep in mind at least as you’re starting off is the concept
58+
of staging directories. In the [`kubernetes/kubernetes`](https://github.com/kubernetes/kubernetes)
59+
repository, you will come across a directory called
60+
[`staging/`](https://github.com/kubernetes/kubernetes/tree/master/staging). The sub-folders in this
61+
directory serve as a bunch of pseudo-repositories. For example, the
62+
[`kubernetes/client-go`](https://github.com/kubernetes/client-go) repository that publishes releases
63+
for `client-go` is actually a [staging
64+
repo](https://github.com/kubernetes/kubernetes/tree/master/staging/src/k8s.io/client-go).
65+
66+
**FSM**: So the concept of staging directories fundamentally impact contributions?
67+
68+
**MJ**: Precisely, because if you’d like to contribute to any of the staging repos, you will need to
69+
send in a PR to its corresponding staging directory in `kubernetes/kubernetes`, once the code merges
70+
there, we have a bot called the [`publishing-bot`](https://github.com/kubernetes/publishing-bot)
71+
that will sync the merged commits to the required staging repositories (like
72+
`kubernetes/client-go`). This way we get the benefits of a monorepo but we also can modularly
73+
publish code for downstream consumption. PS: The `publishing-bot` needs more folks to help out!
74+
75+
For more information on staging repositories, please see the [contributor
76+
documentation](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/staging.md).
77+
78+
**FSM**: Speaking of contributions, the very high number of contributors, both individuals and
79+
companies, must also be a challenge: how does the subproject operate in terms of making sure that
80+
standards are being followed?
81+
82+
**MJ**: When it comes to dependency management in the project, there is a [dedicated
83+
team](https://github.com/kubernetes/org/blob/a106af09b8c345c301d072bfb7106b309c0ad8e9/config/kubernetes/org.yaml#L1329)
84+
that helps review and approve dependency changes. These are folks who have helped lay the foundation
85+
of much of the
86+
[tooling](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/vendor.md)
87+
that Kubernetes uses today for dependency management. This tooling helps ensure there is a
88+
consistent way that contributors can make changes to dependencies. The project has also worked on
89+
additional tooling to signal statistics of dependencies that is being added or removed:
90+
<code>[depstat](https://github.com/kubernetes-sigs/depstat)</code>
91+
92+
Apart from dependency management, another crucial task that the project does is management of the
93+
staging repositories. The tooling for achieving this (`publishing-bot`) is completely transparent to
94+
contributors and helps ensure that the staging repos get a consistent view of contributions that are
95+
submitted to `kubernetes/kubernetes`.
96+
97+
Code Organization also works towards making sure that Kubernetes [stays on supported versions of
98+
Go](https://github.com/kubernetes/enhancements/tree/cf6ee34e37f00d838872d368ec66d7a0b40ee4e6/keps/sig-release/3744-stay-on-supported-go-versions). The
99+
linked KEP provides more context on why we need to do this. We collaborate with SIG Release to
100+
ensure that we are testing Kubernetes as rigorously and as early as we can on Go releases and
101+
working on changes that break our CI as a part of this. An example of how we track this process can
102+
be found [here](https://github.com/kubernetes/release/issues/3076).
103+
104+
## Release cycle and current priorities
105+
106+
**FSM**: Is there anything that changes during the release cycle?
107+
108+
**MJ** During the release cycle, specifically before code freeze, there are often changes that go in
109+
that add/update/delete dependencies, fix code that needs fixing as part of our effort to stay on
110+
supported versions of Go.
111+
112+
Furthermore, some of these changes are also candidates for
113+
[backporting](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-release/cherry-picks.md)
114+
to our supported release branches.
115+
116+
**FSM**: Is there any major project or theme the subproject is working on right now that you would
117+
like to highlight?
118+
119+
**MJ**: I think one very interesting and immensely useful change that has been recently added (and I
120+
take the opportunity to specifically highlight the work of [Tim Hochin](https://github.com/thockin)
121+
on this) is the introduction of [Go workspaces to the Kubernetes
122+
repo](https://github.com/kubernetes/enhancements/tree/master/keps/sig-architecture/4402-go-workspaces). A
123+
lot of our current tooling for dependency management and code publishing, as well as the experience
124+
of editing code in the Kubernetes repo, can be significantly improved by this change.
125+
126+
## Wrapping up
127+
128+
**FSM**: How would someone interested in the topic start helping the subproject?
129+
130+
**MJ**: The first step, as is the first step with any project in Kubernetes, is to join our slack:
131+
slack.k8s.io, and after that join the `#k8s-code-organization` channel. There is also a
132+
[code-organization office
133+
hours](https://github.com/kubernetes/community/tree/master/sig-architecture#meetings) that takes
134+
place that you can choose to attend. Timezones are hard, so feel free to also look at the recordings
135+
or meeting notes and follow up on slack!
136+
137+
**FSM**: Excellent, thank you! Any final comments you would like to share?
138+
139+
**MJ**: The Code Organization subproject always needs help! Especially areas like the publishing
140+
bot, so don’t hesitate to get involved in the `#k8s-code-organization` slack channel.

0 commit comments

Comments
 (0)