/README.md

https://gitlab.com/unofficial-mirrors/kubernetes-contrib · Markdown · 99 lines · 80 code · 19 blank · 0 comment · 0 complexity · 04e67f3a9a6922af22415d345a8c58aa MD5 · raw file

  1. # Kubernetes Contrib
  2. [![Build Status](https://travis-ci.org/kubernetes/contrib.svg)](https://travis-ci.org/kubernetes/contrib)
  3. [![Go Report Card](https://goreportcard.com/badge/github.com/kubernetes/contrib)](https://goreportcard.com/report/github.com/kubernetes/contrib)
  4. [![APACHEv2 License](https://img.shields.io/badge/license-APACHEv2-blue.svg)](https://github.com/kubernetes/contrib/blob/master/LICENSE)
  5. **Do not add new projects to this repository.** We eventually want to
  6. move all code in this repository to more appropriate repositories (see
  7. [#762](https://github.com/kubernetes/contrib/issues/762)). Create a new
  8. repository in `kubernetes-incubator` instead
  9. ([process](https://github.com/kubernetes/community/blob/master/incubator.md)).
  10. ## Getting the Code
  11. The code must be checked out as a subdirectory of `k8s.io`, and not `github.com`.
  12. ```shell
  13. mkdir -p $GOPATH/src/k8s.io
  14. cd $GOPATH/src/k8s.io
  15. # Replace "$YOUR_GITHUB_USERNAME" below with your github username
  16. git clone https://github.com/$YOUR_GITHUB_USERNAME/contrib.git
  17. cd contrib
  18. ```
  19. ## Updating Godeps
  20. Godeps in contrib/ has a different layout than in kubernetes/ proper. This is because
  21. contrib contains multiple tiny projects, each with their own dependencies. Each
  22. in contrib/ has it's own Godeps.json. For example the Godeps.json for Ingress
  23. is Ingress/Godeps/Godeps.json. This means that godeps commands like `godep restore`
  24. or `godep test` do not work in the root directory. They should be run from inside the
  25. subproject directory you want to test.
  26. ## Prerequisites for updating Godeps
  27. Since we vendor godeps through `/vendor` vs the old style `Godeps/_workspace`, you either need a more recent install of go and godeps, or you need to set `GO15VENDOREXPERIMENT=1`. Eg:
  28. ```shell
  29. $ godep version
  30. godep v74 (linux/amd64/go1.6.1)
  31. $ go version
  32. go version go1.6.1 linux/amd64
  33. $ godep save ./...
  34. ```
  35. Will automatically save godeps to `vendor/` instead of `_workspace/`.
  36. If you have an older version of go, you must run:
  37. ```shell
  38. $ GO15VENDOREXPERIMENT=1 godep save ./...
  39. ```
  40. If you have an older version of godep, you must update it:
  41. ```shell
  42. $ go get github.com/tools/godep
  43. $ cd $GOPATH/src/github.com/tools/godep
  44. $ go build -o godep *.go
  45. ```
  46. ## Updating Godeps
  47. The most common dep to update is obviously going to be kubernetes proper. Updating
  48. kubernetes and it's dependancies in the Ingress subproject for example can be done
  49. as follows (the example assumes your Kubernetes repo is rooted at `$GOPATH/src/github.com/kubernetes`, `s/github.com\/kubernetes/k8s.io/` as required):
  50. ```shell
  51. cd $GOPATH/src/github.com/kubernetes/contrib/ingress
  52. godep restore
  53. go get -u github.com/kubernetes/kubernetes
  54. cd $GOPATH/src/github.com/kubernetes/kubernetes
  55. godep restore
  56. cd $GOPATH/src/github/kubernetes/contrib/ingress
  57. rm -rf Godeps
  58. godep save ./...
  59. git [add/remove] as needed
  60. git commit
  61. ```
  62. Other deps are similar, although if the dep you wish to update is included from
  63. kubernetes we probably want to stay in sync using the above method. If the dep is not in kubernetes proper something like the following should get you a nice clean result:
  64. ```shell
  65. cd $GOPATH/src/github/kubernetes/contrib/ingress
  66. godep restore
  67. go get -u $SOME_DEP
  68. rm -rf Godeps
  69. godep save ./...
  70. git [add/remove] as needed
  71. git commit
  72. ```
  73. ## Running all tests
  74. To run all go test in all projects do this:
  75. ```shell
  76. ./hack/for-go-proj.sh test
  77. ```
  78. ## Getting PRs Merged Into Contrib
  79. In order for your PR to get merged, it must have the both `lgtm` AND `approved` labels. When you open a PR, the k8s-merge-bot will automatically assign a reviewer from the `OWNERS` files. Once assigned, the reviewer can then comment `/lgtm`, which will add the `lgtm` label, or if he/she has permission, the reviewer can add the label directly.
  80. Each file modified in the PR will also need to be approved by an approver from its `OWNERS` file or an approver in a parent directory's `OWNERS` file. A file is approved when the approver comments `/approve`, and it is unapproved if an approver comments `/approve cancel`. When all files have been approved, the `approved` label will automatically be added by the k8s-merge-bot and the PR will be added to the submit-queue to be merged.