{"id":1192,"date":"2019-02-05T06:44:26","date_gmt":"2019-02-05T06:44:26","guid":{"rendered":"https:\/\/www.appservgrid.com\/paw93\/?p=1192"},"modified":"2019-02-10T01:52:36","modified_gmt":"2019-02-10T01:52:36","slug":"contributing-to-kubernetes-open-source-citizenship","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw93\/index.php\/2019\/02\/05\/contributing-to-kubernetes-open-source-citizenship\/","title":{"rendered":"Contributing to Kubernetes: Open-Source Citizenship"},"content":{"rendered":"<p>Feb 4, 2019<\/p>\n<h3>A Little Background<\/h3>\n<p>I\u2019ve been using Kubernetes for a while now and decided it was time to be a responsible open-source citizen, and contribute some code. So I started combing their<a href=\"https:\/\/github.com\/kubernetes\/kubernetes\/issues\" target=\"_blank\" rel=\"noopener\"> issue tracker<\/a>, looking for a relatively small and straight-forward patch that I could cut my teeth on. If you\u2019re also thinking of contributing to Kubernetes, I hope you can learn something from my experience.<\/p>\n<p><a href=\"http:\/\/container-solutions.com\/content\/uploads\/2019\/02\/maximilian-weisbecker-121294-unsplash.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/container-solutions.com\/content\/uploads\/2019\/02\/maximilian-weisbecker-121294-unsplash-1024x684.jpg\" alt=\"Contributing to Kubernetes Opensource citizenship\" width=\"651\" height=\"435\" \/><\/a><\/p>\n<h3>First Steps<\/h3>\n<p>If you, too, have been looking to make your first-ever open source contribution, <a href=\"https:\/\/github.com\" target=\"_blank\" rel=\"noopener\">GitHub<\/a> makes it easy to take the all-important first step of finding a beginner-friendly contrib opportunity. Look for issues marked <a href=\"https:\/\/github.com\/kubernetes\/kubernetes\/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22\" target=\"_blank\" rel=\"noopener\">good first issue<\/a> or <a href=\"https:\/\/github.com\/kubernetes\/kubernetes\/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22\" target=\"_blank\" rel=\"noopener\">help wanted<\/a>, and don\u2019t forget to look at <a href=\"https:\/\/github.com\/kubernetes\/\" target=\"_blank\" rel=\"noopener\">other projects<\/a> in the Kubernetes organization.<\/p>\n<p>If you\u2019re still not sure how you can start contributing to Kubernetes, you can glean a lot of insight from a project\u2019s test suite. Writing tests for existing functionality can help you find your bearings in a new codebase, and the maintainers will love you for it. Another option with a fairly low barrier to entry is contributing to Kubernetes documentation \u2013 there is even a<a href=\"https:\/\/kubernetes.io\/docs\/contribute\/start\/\" target=\"_blank\" rel=\"noopener\"> whole website<\/a> devoted to helping you get started doing just this. Again, the maintainers will love you for it.<\/p>\n<p>In my case, I found an issue looking to add tests to ensure <a href=\"https:\/\/github.com\/gogo\/protobuf\" target=\"_blank\" rel=\"noopener\">protobuf<\/a> doesn\u2019t break their API. That way, the maintainers can upgrade the protobuf dependency as needed without triggering any unpleasant surprises. A nice side effect of choosing this issue, in particular, was learning more about protobuf. Prior to starting, I knew what protobuf was, and even how to use it, but I had no idea how it actually worked. Protobuf internals are beyond the scope of this article, so here\u2019s a link to a <a href=\"https:\/\/developers.google.com\/protocol-buffers\/docs\/overview\" target=\"_blank\" rel=\"noopener\">comprehensive overview<\/a>.<\/p>\n<h3>Diving In<\/h3>\n<p>Once I decided what issue I was going to work on, I cloned the repo and started looking through the code. Kubernetes, for better or for worse, contains nearly 4,000,000 lines of code spread out across more than 13,000 files. Navigating a codebase this large can be daunting, to say the least, so diving in without a plan is definitely not advised.<\/p>\n<p>One thing that can greatly narrow your search domain is identifying which packages or libraries you\u2019ll need to dig into to accomplish your goals. My patch, for example, targets the <b>apimachinery<\/b> library. That cuts it down to around 60kloc across ~330 files. Now we\u2019re getting somewhere!<\/p>\n<p>Once you know where to look, a good understanding of how to search the source with tools like <b>find<\/b> and <b>ack<\/b> will be an invaluable asset, so it pays to brush up on their usage (the<a href=\"https:\/\/www.linux.org\/docs\/\" target=\"_blank\" rel=\"noopener\"> Linux man pages<\/a> are a great place to start). You should ultimately be able to focus your attention on, at most, a handful of files.<\/p>\n<h3>Do Your Thing<\/h3>\n<p>The next step is to actually write your code. In my case, that meant adding a few tests to an existing file. If your patch is much larger in scope, then you should probably put it on hold, and find something smaller. It\u2019s no fun to spend weeks writing something you\u2019re proud of, only to have it rejected right off the bat.<\/p>\n<p>I can\u2019t provide much more guidance when it comes to writing your first patch. since every issue is unique. Hopefully, you didn\u2019t bite off more than you could chew. Once you\u2019re happy with your code and\/or documentation, it\u2019s time to submit your pull request. That can be a rather stressful experience for the uninitiated, and if you\u2019re not used to very direct feedback, it can be hurt. Try not to take things too personally.<\/p>\n<p>To minimize the pain, it\u2019s a good idea to make sure your contribution is consistent with the existing codebase, and\/or <a href=\"https:\/\/kubernetes.io\/docs\/contribute\/style\/style-guide\/\" target=\"_blank\" rel=\"noopener\">Documentation Style Guide<\/a>. Also, make sure your git history is clean, by squashing and rebasing your working commits and checking the diffs against the latest master.<\/p>\n<h3>Read The Fine Print<\/h3>\n<p>Before your patch can be reviewed, you will have to sign the <a href=\"https:\/\/github.com\/cncf\/cla\" target=\"_blank\" rel=\"noopener\">CNCF Contributor License Agreement<\/a>, which grants the <a href=\"https:\/\/www.cncf.io\/\" target=\"_blank\" rel=\"noopener\">Cloud Native Computing Foundation<\/a> additional rights and limitations not covered under the <a href=\"https:\/\/www.apache.org\/licenses\/LICENSE-2.0\" target=\"_blank\" rel=\"noopener\">Apache-2.0<\/a> license that accompanies the project. While the CLA requirement definitely merits further discussion, this article is not the place to do it.<\/p>\n<p>Once you\u2019ve signed the CLA, make sure you read and follow the <a href=\"https:\/\/github.com\/kubernetes\/kubernetes\/blob\/master\/.github\/PULL_REQUEST_TEMPLATE.md\" target=\"_blank\" rel=\"noopener\">pull request template<\/a>. In the same vein, you should pay special attention to the format and content of your commit message. Make sure that the message is clear and concise, and that it conveys the purpose of your changes\/additions. If you\u2019re not sure what format to use, I\u2019m quite fond of:<\/p>\n<p>topic: subtopic: Concise description of your patch here<br \/>\nFor example, the commit message for my patch was:<\/p>\n<p>apimachinery: protobuf: Test protobuf compatibility<\/p>\n<h3>Wait For It\u2026<\/h3>\n<p>Now comes the hard part; waiting for review. Kubernetes is one of the most active projects on GitHub, and currently has <a href=\"https:\/\/github.com\/kubernetes\/kubernetes\/pulls\" target=\"_blank\" rel=\"noopener\">over 1000 open pull requests<\/a>, so it shouldn\u2019t come as a surprise that you might have to wait a while before you get any feedback.<\/p>\n<p>First, someone from the Kubernetes organization will triage your patch, and assign it to a suitable reviewer. If that person deems it safe, they will trigger the tests and review your code for style, correctness, and utility. You will probably need to make some changes, unless your patch is tiny and you\u2019re a rock-star. Finally, once they\u2019re happy with your patch, they\u2019ll flag it with a \u2018\/LGTM\u2019 message, and it will be automatically merged into Kubernetes\u2019 master branch.<\/p>\n<p>Congratulations, you\u2019re now part of the CNCF\/Kubernetes developer community! That wasn\u2019t so bad, was it? Feel free to share your thoughts in the comments below, and ping me here or on <a href=\"https:\/\/twitter.com\/JonWritesCode\" target=\"_blank\" rel=\"noopener\">Twitter<\/a> if you have any questions or comments.<\/p>\n<p><a href=\"https:\/\/container-solutions.com\/contributing-kubernetes\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Feb 4, 2019 A Little Background I\u2019ve been using Kubernetes for a while now and decided it was time to be a responsible open-source citizen, and contribute some code. So I started combing their issue tracker, looking for a relatively small and straight-forward patch that I could cut my teeth on. If you\u2019re also thinking &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw93\/index.php\/2019\/02\/05\/contributing-to-kubernetes-open-source-citizenship\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Contributing to Kubernetes: Open-Source Citizenship&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-1192","post","type-post","status-publish","format-standard","hentry","category-kubernetes"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/posts\/1192","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/comments?post=1192"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/posts\/1192\/revisions"}],"predecessor-version":[{"id":1229,"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/posts\/1192\/revisions\/1229"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/media?parent=1192"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/categories?post=1192"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/tags?post=1192"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}