###### tags: `Workshop`
# Contribution Workshop #1
#### # 流程 / Agenda
09:30 - 10:00 報到
10:00 - 10:10 開場
10:10 - 10:50 如何貢獻 OpenStack Upstream (開發者與使用者)
11:00 - 11:40 How to start contributing to Kubernetes
11:50 - 12:20 Ceph Upstream-Dashboard and Orchestrator
12:20 - 13:20 交流及午餐時間
13:20 - 13:50 Ceph Upstream-general ceph and deepsea and prom and grafana
14:00 - 16:30 Hands-on Labs (分組進行)
16:30 - 18:00 Summary (交流與小活動時間)
---
## 如何貢獻 OpenStack Upstream (開發者與使用者)
SIGs(特殊興趣小組):不維護專案, 讓使用者有機會可以和開發者交流
把問題拿去和 project team 討論
LINE 的應用場景是K8s 架在 OpenStack上
RabbitMQ的效能性問題?RabbitMQ debug message always shows timeout
流程:
使用者遇到問題 -> 小貢獻 -> 有新想法或是大貢獻 -> 與社群討論溝通
* 是否可以簡化流程?
* 貢獻可以成為社群的主要目標
* 所有貢獻的起源在於企業內部有人知道貢獻的方法
- [How to become members of contributing OpenStack](https://docs.openstack.org/upstream-training/)
Step:
- Create Accounts
- Setup gerrit: 要可以讀懂log
- Setup git and gerrit config
- Try summit to sandbox: 可以隨意丟,互相Review
- Review and feeback: 可以filter tag看自己想看的主題
- Communication: 實際的參與討論
---
## How to start contributing to Kubernetes
每個 SIG 的 reviewer 都不一樣,基本上 PR 裡面都是用 comment 來做操作,例如 `/test`, `/retest` ,要被 merge 要等 reviewer 下 `/lgtm` 以及 `/approved` 才會被 merge 進去裡面。
會先遇到Robot
labels 根據改動的行數來上標籤
合併會經過另外一個bot來做處理
要貢獻 Kubernetes 最好要熟 Golang。
Before start
- [Sign the CLA](https://identity.linuxfoundation.org/projects/cncf)
- Setup Go environment
```bash
brew install go
```
- Build Kubernetes from source code
* how to know $GOPATH?
```shell
go env
```
* how to build k8s project?
```
mkdir -p $GOPATH/src/k8s.io
cd $GOPATH/src/k8s.io
git clone http://github.com/kubernetes/kubernetes
cd kubernetes
make
```
* how to install golang from source code? (Based on RHEL 8/CentOS 8)
```bash
wget https://dl.google.com/go/go1.13.4.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.13.4.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin
go version
go env
```
* how to check go project?
https://goreportcard.com/
GitHub FLow
* Fork repository
* Set remote URL with your repo link
* Push commit and open pull request
---
## Ceph Upstream-Dashboard and Orchestrator
Slide: https://docs.google.com/presentation/d/1-UWfgiXsZjz50j7lYwNwtdAnFzWAbfMb7IAA8JvKwQs/edit?usp=sharing
#### What is Ceph?
distributed scalable storage
Ceph的底層是 RADOS
#### How to Deploy Ceph
ceph-dev-docker(* recommend try @ home)
#### Components and Languages
Core => C++
* RADOS, common codes
* CLI
* Daemons/ Services
Kernel Modules => C
* krbd
* kcephfs
MGR => Python / Typescript (Recommend to starter)
* Dashboard
* Orchestrator
* Restful
Tools
* ceph-volume
#### Issue Tracker
Must have to check here @ first
#### Hacking Codes (GitHub Flow)
1. git clone the ceph project
2. git remote add ceph https://github.com/ceph/ceph.git
3. git checkout -b wip-<issue-id> ceph/master (create a new branch to modity)
4. ./run-make-check.sh (Run test)
5. git add <xxx> <xxx>
6. git commit -s (simular with CLA)
7. git push
#### CI Tests /Reviews
* To be merged
* At least 1 approvement is required
* CI test (Jenkins) must be passed
#### Backports & Release cycles
- implement new feature on master, and then backport if needed.
- if possible, fix a bug on master and backport it.
#### Where to Ask for helps
- dev guide (https://docs.ceph.com/docs/master/dev/developer_guide/)
- IRC(OFTC: https://ceph.io/irc/)
- Mailing List
#### Events & Talks
* Ceph Days (https://ceph.io/cephdays)
* Cephalocon (https://ceph.io/cephalocon/)(large-scale)
* Ceph Tech Talks
#### Rook event
* [rook meetup](https://rook.io/?fbclid=IwAR0QhPy7P_eCPKVfnPMFFjza_w-No-EO4rizc7hji9vt9VzADxVouEWZGgU)
---
## Ceph Upstream-general ceph and deepsea and prom and grafana
Prometheus is implemented by pulling
和license有關的東西會在slack上
### Ceph Source Tree
有興趣要貢獻的話,建議先跟一些社群老手溝通
Ceph has a lot of components
* mon
* mgr
* osd
* rgw
* mds
* crushmap
* erasure-code
* ...
### Salt Repo
Python base IPC/RPC event queue, and default transport is ZeroMQ.
* Master
* Minion
* Client
### Patch Flow
Self Repo -> CI/CD test -> PR to master
### Notice
在同一個專案用超過兩套工具去compile, deploy要注意。
有可能會遇到手動改完了之後東西不動?Module 已經看不懂那個 config 是做什麼的情況。
### Prometheus Source Tree
K8s 如果不特別 disable module, 預設modules 全開
* node_exporter: CPU, memory等資訊
* collectd_exporter: [collectd](https://collectd.org/) 的 exporter。
* alertmanager: 可提供 prometheus 警報
* procfs
### Grafana Source Tree
* contribute/
* vendor/
* package/front-end
* package/back-end
---
## Hands-on Labs - OpenStack
- http://bit.ly/33z4mno
- Set:
- https://docs.openstack.org/contributors/zh_CN/common/accounts.html
-
---
## Hands-on Labs - Ceph
---
## Hands-on Labs - Kubernetes
https://goreportcard.com/
看到v1aplha, v1beta, staging不要選
**修正 Coding Style(underscore)**
有分兩種情況:
1. `xxx_AttachDetachControllerConfiguration_To_xxx` 這種是 scripts 產生的,盡量不要去改。
2. `scsi_path` or `sys_path` 這種就是作者自己打的,這種就可以去修
**<function name >should have comment or be unexported** => 在 Golang 中函數名稱是大寫開頭的會被 export 出去,而這種通常會建議寫註解,這裡要修補的就是補上註解或是改成小寫取消 export 。
認領issue
https://docs.google.com/spreadsheets/d/1Ht7auakyW0x7kpLWVvgpq841_ECMepO4rWNckHRJow8/edit#gid=0
### GitHub Flow
1. Fork the Kubernetes project.
2. Create the branch and edit the files. ( Branch 名稱 Prefix 可以使用修正的位置,例如修正 kubelet 可以命名為 `kubelet - update xxx`)
3. Send PR to upstream kubernetes master branch