参与Kubernetes贡献

整理参与Kubernetes的相关内容:

相关链接

slack channel: http://slack.k8s.io/
google group: https://groups.google.com/forum/#!forum/kubernetes-dev
weekly community meeting: https://groups.google.com/forum/#!forum/kubernetes-community-video-chat
官方的Meetup:
https://www.meetup.com/topics/kubernetes/
https://www.meetup.com/Kubernetes-Cloud-Native-Online-Meetup/
Kubernetes API: https://kubernetes.io/docs/reference/
kuberntes.io --教程
kubeweekly ---案例分享
design-proposal 设计方案说明(https://github.com/kubernetes/community/blob/master/contributors/design-proposals/),同样可以用来学习插件的开发.
kubernets项目更好的参与 https://github.com/kubernetes/community/tree/master/contributors/devel

list of SIGs(罗列了主要的SIG以及Meetings时间)
https://github.com/kubernetes/community/blob/master/sig-list.md

SIGs

name URL
API Machinery https://github.com/kubernetes/community/blob/master/sig-api-machinery/README.md
AWS https://github.com/kubernetes/community/blob/master/sig-aws/README.md
Apps https://github.com/kubernetes/community/blob/master/sig-apps/README.md
Architecture https://github.com/kubernetes/community/blob/master/sig-architecture/README.md
Auth https://github.com/kubernetes/community/blob/master/sig-auth/README.md
Autoscaling https://github.com/kubernetes/community/blob/master/sig-autoscaling/README.md
Azure https://github.com/kubernetes/community/blob/master/sig-azure/README.md
Big Data https://github.com/kubernetes/community/blob/master/sig-big-data/README.md
CLI https://github.com/kubernetes/community/blob/master/sig-cli/README.md
Cluster Lifecycle https://github.com/kubernetes/community/blob/master/sig-cluster-lifecycle/README.md
Cluster Ops https://github.com/kubernetes/community/blob/master/sig-cluster-ops/README.md
Contributor Experience https://github.com/kubernetes/community/blob/master/sig-contributor-experience/README.md
Docs https://github.com/kubernetes/community/blob/master/sig-docs/README.md
Federation https://github.com/kubernetes/community/blob/master/sig-federation/README.md
Instrumentation https://github.com/kubernetes/community/blob/master/sig-instrumentation/README.md
Network https://github.com/kubernetes/community/blob/master/sig-network/README.md
Node https://github.com/kubernetes/community/blob/master/sig-node/README.md
On Premise https://github.com/kubernetes/community/blob/master/sig-on-premise/README.md
OpenStack https://github.com/kubernetes/community/blob/master/sig-openstack/README.md
Product Management https://github.com/kubernetes/community/blob/master/sig-product-management/README.md
Scalability https://github.com/kubernetes/community/blob/master/sig-scalability/README.md
Scheduling https://github.com/kubernetes/community/blob/master/sig-scheduling/README.md
Service Catalog https://github.com/kubernetes/community/blob/master/sig-service-catalog/README.md
Storage https://github.com/kubernetes/community/blob/master/sig-storage/README.md
Testing https://github.com/kubernetes/community/blob/master/sig-testing/README.md
UI https://github.com/kubernetes/community/blob/master/sig-ui/README.md
Windows https://github.com/kubernetes/community/blob/master/sig-windows/README.md
Container Identity https://github.com/kubernetes/community/blob/master/wg-container-identity/README.md
Resource Management https://github.com/kubernetes/community/blob/master/wg-resource-management/README.md

Kubernetes Developer Guide

https://github.com/kubernetes/community/blob/master/contributors/devel/README.md
https://github.com/kubernetes/community/blob/master/contributors/guide/github-workflow.md
有几篇强相关的文档可以read一下,包含的内容

开发以及贡献代码到Kuberentes project的流程

  • pr的信息以及代码reviw
  • github上提交Issues
  • pr处理过程
  • 怎么加速Pr的review
  • ci最新编译的i去那个看
  • 自动化的工具

建立你的开发环境,coding以及debugging

  • 建立开发环境
  • 测试(unit, integration and e2e test)

    unit测试
    运行unit测试,下面是一些常用的例子
    cd kubernetes
    make test #Run all unit tests
    make test WHAT=./pkg/api  #Run tests for pkg/api        
    make test WHAT=”./pkg/api  ./pkg/kubelet”  # run tests for pkg/api and pkg/kubelet
    指定需要运行的test方法
    
    # Runs TestValidatePod in pkg/api/validation with the verbose flag set
    
    make test WHAT=./pkg/api/validation GOFLAGS="-v" KUBE_TEST_ARGS='-run ^TestValidatePod$'
    
    # Runs tests that match the regex ValidatePod|ValidateConfigMap in pkg/api/validation
    
    make test WHAT=./pkg/api/validation GOFLAGS="-v" KUBE_TEST_ARGS="-run ValidatePod|ValidateConfigMap$"
    压力测试
    make test PARALLEL=2 ITERATION=5
    生成覆盖率
    make test PARALLEL=2 ITERATION=5
    make test WHAT=./pkg/kubectl KUBE_COVER=y  #only one package-k8s-images
    Benchmark unit tests
    go test ./pkg/apiserver -benchmem -run=XXX -bench=BenchmarkWatch
    集成测试Integration tests
    End-to-End tests 
    https://github.com/kubernetes/community/blob/master/contributors/devel/e2e-tests.md
  • flake free tests

  • glog日志打印级别
    glog.Errorf()
    glog.Warningf()
    glog.Infof info级别的日志又分成五个级别,范围依次变高
    glog.V(0) <glog.V(1)<glog.V(2)<glog.V(3) <glog.V(4)
    可以通过-v=X来设置X is the descired maximum level to log.
  • profiling kubernetes
  • add a new metrics to kubernetes code.
  • 代码规范
  • 文档规范
  • 运行a fast and lightweight local cluster deployment for development

Kuberntes API的开发

  • REST API文档
  • Annotations:用于将任意的非识别元数据附加到对象。 自动化Kubernetes对象的程序可能会使用注释来存储少量的状态。
  • API conventions(约定)

插件开发

  • Authentication 认证插件 
  • Authorization Plugins 授权插件
  • Admission Control Plugins 准入插件

发布流程

具体流程

参与Kubernetes贡献_第1张图片

  • Fork kubernetes to your own in the github
  • Clone fork to local storage

    place Kubernetes' code on your GOPATH using the following cloning procedure. working_dir=$GOPATH/src/k8s.io
    mkdir -p $working_dir
    cd $working_dir
    git clone https://github.com/$user/kubernetes.git
    # or: git clone [email protected]:$user/kubernetes.git
    cd $working_dir/kubernetes
    git remote add upstream https://github.com/kubernetes/kubernetes.git
    # or: git remote add upstream [email protected]:kubernetes/kubernetes.git
    # Never push to upstream master
    git remote set-url --push upstream no_push
    # Confirm that your remotes make sense:
    git remote -v
    3 Branch
    Get your local master up to date:
    cd $working_dir/kubernetes
    git fetch upstream
    git checkout master
    git rebase upstream/master
    Branch from it:
    git checkout -b myfeature

    Then edit code on the myfeature branch.
  • Build

    cd $working_dir/kubernetes
    make

    To remove the limit on the number of errors the Go compiler reports (default limit is 10 errors):
    make GOGCFLAGS="-e"
    To build with optimizations disabled (enables use of source debug tools):
    make GOGCFLAGS="-N -l"
    To build binaries for all platforms:

    make cross
  • Install etcd
    hack/install-etcd.sh
  • Test
    cd $working_dir/kubernetes

    # Run all the presubmission verification. Then, run a specific update script (hack/update-*.sh)
    # for each failed verification. For example:
    #   hack/update-gofmt.sh (to make sure all files are correctly formatted, usually needed when you add new files)
    #   hack/update-bazel.sh (to update bazel build related files, usually needed when you add or remove imports)

 make verify

    \# Alternatively, run all update scripts to avoid fixing verification failures one by one.
make update

 Run every unit test
make test 

# Run package tests verbosely
make test WHAT=./pkg/api/helper GOFLAGS=-v

# Run integration tests, requires etcd
# For more info, visit https://github.com/kubernetes/community/blob/master/contributors/devel/testing.md#integration-tests
make test-integration

# Run e2e tests by building test binaries, turn up a test cluster, run all tests, and tear the cluster down
# Equivalent to: go run hack/e2e.go -- -v --build --up --test --down
# Note: running all e2e tests takes a LONG time! To run specific e2e tests, visit:
# https://github.com/kubernetes/community/blob/master/contributors/devel/e2e-tests.md#building-kubernetes-and-running-the-tests
make test-e2e

    See the testing guide and end-to-end tests for additional information and scenarios.
    Run make help for additional information on these make targets.
  • Keep your branch in sync
# While on your myfeature branch
git fetch upstream
git rebase upstream/master
  • Commit
    Commit your changes.
    git commit
    Likely you go back and edit/build/test some more then commit –amend in a few cycles.
  • Push
    When ready to review (or just to establish an offsite backup or your work), push your branch to your fork on github.com:
    git push -f ${your_remote_name} myfeature

  • Create a pull request

    1. Visit your fork at https://github.com/$user/kubernetes
    2. Click the Compare & Pull Request button next to your myfeature branch.
    3. Check out the pull request process for more details.
      If you have upstream write access, please refrain from using the GitHub UI for creating PRs, because GitHub will create the PR branch inside the main repository rather than inside your fork.
  • Get a code review
    Once your pull request has been opened it will be assigned to one or more reviewers. Those reviewers will do a thorough code review, looking for correctness, bugs, opportunities for improvement, documentation and comments, and style.
    Commit changes made in response to review comments to the same branch on your fork.
    Very small PRs are easy to review. Very large PRs are very difficult to review. At the assigned reviewer’s discretion, a PR may be switched to use Reviewable instead. Once a PR is switched to Reviewable, please ONLY send or reply to comments through Reviewable. Mixing code review tools can be very confusing.
    See Faster Reviews for some thoughts on how to streamline the review process.

  • Squash and Merge
    Upon merge (by either you or your reviewer), all commits left on the review branch should represent meaningful milestones or units of work. Use commits to add clarity to the development and review process.
    Before merging a PR, squash any fix review feedback, typo, and rebased sorts of commits.
    It is not imperative that every commit in a PR compile and pass tests independently, but it is worth striving for.
    For mass automated fixups (e.g. automated doc formatting), use one or more commits for the changes to tooling and a final commit to apply the fixup en masse. This makes reviews easier.

你可能感兴趣的:(kubernetes)