Merge pull request #11551 from a-robinson/docs

Improve syntax highlighting for design and devel docs
This commit is contained in:
Brian Grant
2015-07-19 08:45:54 -07:00
18 changed files with 116 additions and 125 deletions

View File

@@ -58,40 +58,40 @@ Below, we outline one of the more common git workflows that core developers use.
The commands below require that you have $GOPATH set ([$GOPATH docs](https://golang.org/doc/code.html#GOPATH)). We highly recommend you put kubernetes' code into your GOPATH. Note: the commands below will not work if there is more than one directory in your `$GOPATH`.
```
$ mkdir -p $GOPATH/src/github.com/GoogleCloudPlatform/
$ cd $GOPATH/src/github.com/GoogleCloudPlatform/
```sh
mkdir -p $GOPATH/src/github.com/GoogleCloudPlatform/
cd $GOPATH/src/github.com/GoogleCloudPlatform/
# Replace "$YOUR_GITHUB_USERNAME" below with your github username
$ git clone https://github.com/$YOUR_GITHUB_USERNAME/kubernetes.git
$ cd kubernetes
$ git remote add upstream 'https://github.com/GoogleCloudPlatform/kubernetes.git'
git clone https://github.com/$YOUR_GITHUB_USERNAME/kubernetes.git
cd kubernetes
git remote add upstream 'https://github.com/GoogleCloudPlatform/kubernetes.git'
```
### Create a branch and make changes
```
$ git checkout -b myfeature
```sh
git checkout -b myfeature
# Make your code changes
```
### Keeping your development fork in sync
```
$ git fetch upstream
$ git rebase upstream/master
```sh
git fetch upstream
git rebase upstream/master
```
Note: If you have write access to the main repository at github.com/GoogleCloudPlatform/kubernetes, you should modify your git configuration so that you can't accidentally push to upstream:
```
```sh
git remote set-url --push upstream no_push
```
### Commiting changes to your fork
```
$ git commit
$ git push -f origin myfeature
```sh
git commit
git push -f origin myfeature
```
### Creating a pull request
@@ -114,7 +114,7 @@ directly from mercurial.
2) Create a new GOPATH for your tools and install godep:
```
```sh
export GOPATH=$HOME/go-tools
mkdir -p $GOPATH
go get github.com/tools/godep
@@ -122,7 +122,7 @@ go get github.com/tools/godep
3) Add $GOPATH/bin to your path. Typically you'd add this to your ~/.profile:
```
```sh
export GOPATH=$HOME/go-tools
export PATH=$PATH:$GOPATH/bin
```
@@ -133,7 +133,7 @@ Here's a quick walkthrough of one way to use godeps to add or update a Kubernete
1) Devote a directory to this endeavor:
```
```sh
export KPATH=$HOME/code/kubernetes
mkdir -p $KPATH/src/github.com/GoogleCloudPlatform/kubernetes
cd $KPATH/src/github.com/GoogleCloudPlatform/kubernetes
@@ -143,7 +143,7 @@ git clone https://path/to/your/fork .
2) Set up your GOPATH.
```
```sh
# Option A: this will let your builds see packages that exist elsewhere on your system.
export GOPATH=$KPATH:$GOPATH
# Option B: This will *not* let your local builds see packages that exist elsewhere on your system.
@@ -153,14 +153,14 @@ export GOPATH=$KPATH
3) Populate your new GOPATH.
```
```sh
cd $KPATH/src/github.com/GoogleCloudPlatform/kubernetes
godep restore
```
4) Next, you can either add a new dependency or update an existing one.
```
```sh
# To add a new dependency, do:
cd $KPATH/src/github.com/GoogleCloudPlatform/kubernetes
go get path/to/dependency
@@ -185,28 +185,28 @@ Please send dependency updates in separate commits within your PR, for easier re
Before committing any changes, please link/copy these hooks into your .git
directory. This will keep you from accidentally committing non-gofmt'd go code.
```
```sh
cd kubernetes/.git/hooks/
ln -s ../../hooks/pre-commit .
```
## Unit tests
```
```sh
cd kubernetes
hack/test-go.sh
```
Alternatively, you could also run:
```
```sh
cd kubernetes
godep go test ./...
```
If you only want to run unit tests in one package, you could run ``godep go test`` under the package directory. For example, the following commands will run all unit tests in package kubelet:
```
```console
$ cd kubernetes # step into kubernetes' directory.
$ cd pkg/kubelet
$ godep go test
@@ -221,7 +221,7 @@ Currently, collecting coverage is only supported for the Go unit tests.
To run all unit tests and generate an HTML coverage report, run the following:
```
```sh
cd kubernetes
KUBE_COVER=y hack/test-go.sh
```
@@ -230,7 +230,7 @@ At the end of the run, an the HTML report will be generated with the path printe
To run tests and collect coverage in only one package, pass its relative path under the `kubernetes` directory as an argument, for example:
```
```sh
cd kubernetes
KUBE_COVER=y hack/test-go.sh pkg/kubectl
```
@@ -243,7 +243,7 @@ Coverage results for the project can also be viewed on [Coveralls](https://cover
You need an [etcd](https://github.com/coreos/etcd/releases/tag/v2.0.0) in your path, please make sure it is installed and in your ``$PATH``.
```
```sh
cd kubernetes
hack/test-integration.sh
```
@@ -252,14 +252,14 @@ hack/test-integration.sh
You can run an end-to-end test which will bring up a master and two nodes, perform some tests, and then tear everything down. Make sure you have followed the getting started steps for your chosen cloud platform (which might involve changing the `KUBERNETES_PROVIDER` environment variable to something other than "gce".
```
```sh
cd kubernetes
hack/e2e-test.sh
```
Pressing control-C should result in an orderly shutdown but if something goes wrong and you still have some VMs running you can force a cleanup with this command:
```
```sh
go run hack/e2e.go --down
```
@@ -332,7 +332,7 @@ See [conformance-test.sh](../../hack/conformance-test.sh).
## Regenerating the CLI documentation
```
```sh
hack/run-gendocs.sh
```