Skip to content

Commit 324f896

Browse files
authored
Merge pull request #45725 from fsmunoz/sig-arch-code-spotlight
Add SIG Architecture Code Organization spotlight article
2 parents f29fa48 + e0cadb0 commit 324f896

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