Commit 27f41884 authored by k8s-merge-robot's avatar k8s-merge-robot

Merge pull request #25099 from mikebrow/devel-tree-80col-updates

Automatic merge from submit-queue devel/ tree minor edits Address line wrap issue #1488. Also cleans up other minor editing issues in the docs/devel/* tree such as spelling errors, links,... Signed-off-by: 's avatarMike Brown <brownwm@us.ibm.com>
parents 088694fa a42ea536
...@@ -50,65 +50,129 @@ Updated: 5/3/2016 ...@@ -50,65 +50,129 @@ Updated: 5/3/2016
## Code conventions ## Code conventions
- Bash - Bash
- https://google-styleguide.googlecode.com/svn/trunk/shell.xml - https://google-styleguide.googlecode.com/svn/trunk/shell.xml
- Ensure that build, release, test, and cluster-management scripts run on OS X
- Ensure that build, release, test, and cluster-management scripts run on
OS X
- Go - Go
- Ensure your code passes the [presubmit checks](development.md#hooks) - Ensure your code passes the [presubmit checks](development.md#hooks)
- [Go Code Review Comments](https://github.com/golang/go/wiki/CodeReviewComments)
- [Go Code Review
Comments](https://github.com/golang/go/wiki/CodeReviewComments)
- [Effective Go](https://golang.org/doc/effective_go.html) - [Effective Go](https://golang.org/doc/effective_go.html)
- Comment your code. - Comment your code.
- [Go's commenting conventions](http://blog.golang.org/godoc-documenting-go-code) - [Go's commenting
- If reviewers ask questions about why the code is the way it is, that's a sign that comments might be helpful. conventions](http://blog.golang.org/godoc-documenting-go-code)
- If reviewers ask questions about why the code is the way it is, that's a
sign that comments might be helpful.
- Command-line flags should use dashes, not underscores - Command-line flags should use dashes, not underscores
- Naming - Naming
- Please consider package name when selecting an interface name, and avoid redundancy. - Please consider package name when selecting an interface name, and avoid
- e.g.: `storage.Interface` is better than `storage.StorageInterface`. redundancy.
- Do not use uppercase characters, underscores, or dashes in package names.
- e.g.: `storage.Interface` is better than `storage.StorageInterface`.
- Do not use uppercase characters, underscores, or dashes in package
names.
- Please consider parent directory name when choosing a package name. - Please consider parent directory name when choosing a package name.
- so pkg/controllers/autoscaler/foo.go should say `package autoscaler` not `package autoscalercontroller`.
- Unless there's a good reason, the `package foo` line should match the name of the directory in which the .go file exists. - so pkg/controllers/autoscaler/foo.go should say `package autoscaler`
- Importers can use a different name if they need to disambiguate. not `package autoscalercontroller`.
- Locks should be called `lock` and should never be embedded (always `lock sync.Mutex`). When multiple locks are present, give each lock a distinct name following Go conventions - `stateLock`, `mapLock` etc. - Unless there's a good reason, the `package foo` line should match
- API conventions the name of the directory in which the .go file exists.
- [API changes](api_changes.md) - Importers can use a different name if they need to disambiguate.
- [API conventions](api-conventions.md)
- Locks should be called `lock` and should never be embedded (always `lock
sync.Mutex`). When multiple locks are present, give each lock a distinct name
following Go conventions - `stateLock`, `mapLock` etc.
- [API changes](api_changes.md)
- [API conventions](api-conventions.md)
- [Kubectl conventions](kubectl-conventions.md) - [Kubectl conventions](kubectl-conventions.md)
- [Logging conventions](logging.md) - [Logging conventions](logging.md)
## Testing conventions ## Testing conventions
- All new packages and most new significant functionality must come with unit tests - All new packages and most new significant functionality must come with unit
- Table-driven tests are preferred for testing multiple scenarios/inputs; for example, see [TestNamespaceAuthorization](../../test/integration/auth_test.go) tests
- Significant features should come with integration (test/integration) and/or [end-to-end (test/e2e) tests](e2e-tests.md)
- Table-driven tests are preferred for testing multiple scenarios/inputs; for
example, see [TestNamespaceAuthorization](../../test/integration/auth_test.go)
- Significant features should come with integration (test/integration) and/or
[end-to-end (test/e2e) tests](e2e-tests.md)
- Including new kubectl commands and major features of existing commands - Including new kubectl commands and major features of existing commands
- Unit tests must pass on OS X and Windows platforms - if you use Linux specific features, your test case must either be skipped on windows or compiled out (skipped is better when running Linux specific commands, compiled out is required when your code does not compile on Windows).
- Unit tests must pass on OS X and Windows platforms - if you use Linux
specific features, your test case must either be skipped on windows or compiled
out (skipped is better when running Linux specific commands, compiled out is
required when your code does not compile on Windows).
- Avoid relying on Docker hub (e.g. pull from Docker hub). Use gcr.io instead. - Avoid relying on Docker hub (e.g. pull from Docker hub). Use gcr.io instead.
- Avoid waiting for a short amount of time (or without waiting) and expect an asynchronous thing to happen (e.g. wait for 1 seconds and expect a Pod to be running). Wait and retry instead.
- Avoid waiting for a short amount of time (or without waiting) and expect an
asynchronous thing to happen (e.g. wait for 1 seconds and expect a Pod to be
running). Wait and retry instead.
- See the [testing guide](testing.md) for additional testing advice. - See the [testing guide](testing.md) for additional testing advice.
## Directory and file conventions ## Directory and file conventions
- Avoid package sprawl. Find an appropriate subdirectory for new packages. (See [#4851](http://issues.k8s.io/4851) for discussion.) - Avoid package sprawl. Find an appropriate subdirectory for new packages.
- Libraries with no more appropriate home belong in new package subdirectories of pkg/util (See [#4851](http://issues.k8s.io/4851) for discussion.)
- Avoid general utility packages. Packages called "util" are suspect. Instead, derive a name that describes your desired function. For example, the utility functions dealing with waiting for operations are in the "wait" package and include functionality like Poll. So the full name is wait.Poll - Libraries with no more appropriate home belong in new package
subdirectories of pkg/util
- Avoid general utility packages. Packages called "util" are suspect. Instead,
derive a name that describes your desired function. For example, the utility
functions dealing with waiting for operations are in the "wait" package and
include functionality like Poll. So the full name is wait.Poll
- All filenames should be lowercase - All filenames should be lowercase
- Go source files and directories use underscores, not dashes - Go source files and directories use underscores, not dashes
- Package directories should generally avoid using separators as much as possible (when packages are multiple words, they usually should be in nested subdirectories). - Package directories should generally avoid using separators as much as
possible (when packages are multiple words, they usually should be in nested
subdirectories).
- Document directories and filenames should use dashes rather than underscores - Document directories and filenames should use dashes rather than underscores
- Contrived examples that illustrate system features belong in /docs/user-guide or /docs/admin, depending on whether it is a feature primarily intended for users that deploy applications or cluster administrators, respectively. Actual application examples belong in /examples.
- Examples should also illustrate - Contrived examples that illustrate system features belong in
[best practices for configuration and using the system](../user-guide/config-best-practices.md) /docs/user-guide or /docs/admin, depending on whether it is a feature primarily
intended for users that deploy applications or cluster administrators,
respectively. Actual application examples belong in /examples.
- Examples should also illustrate [best practices for configuration and
using the system](../user-guide/config-best-practices.md)
- Third-party code - Third-party code
- Go code for normal third-party dependencies is managed using [Godeps](https://github.com/tools/godep)
- Go code for normal third-party dependencies is managed using
[Godeps](https://github.com/tools/godep)
- Other third-party code belongs in `/third_party` - Other third-party code belongs in `/third_party`
- forked third party Go code goes in `/third_party/forked` - forked third party Go code goes in `/third_party/forked`
- forked _golang stdlib_ code goes in `/third_party/golang` - forked _golang stdlib_ code goes in `/third_party/golang`
- Third-party code must include licenses - Third-party code must include licenses
- This includes modified third-party code and excerpts, as well - This includes modified third-party code and excerpts, as well
## Coding advice ## Coding advice
- Go - Go
- [Go landmines](https://gist.github.com/lavalamp/4bd23295a9f32706a48f) - [Go landmines](https://gist.github.com/lavalamp/4bd23295a9f32706a48f)
......
...@@ -34,44 +34,86 @@ Documentation for other releases can be found at ...@@ -34,44 +34,86 @@ Documentation for other releases can be found at
# On Collaborative Development # On Collaborative Development
Kubernetes is open source, but many of the people working on it do so as their day job. In order to avoid forcing people to be "at work" effectively 24/7, we want to establish some semi-formal protocols around development. Hopefully these rules make things go more smoothly. If you find that this is not the case, please complain loudly. Kubernetes is open source, but many of the people working on it do so as their
day job. In order to avoid forcing people to be "at work" effectively 24/7, we
want to establish some semi-formal protocols around development. Hopefully these
rules make things go more smoothly. If you find that this is not the case,
please complain loudly.
## Patches welcome ## Patches welcome
First and foremost: as a potential contributor, your changes and ideas are welcome at any hour of the day or night, weekdays, weekends, and holidays. Please do not ever hesitate to ask a question or send a PR. First and foremost: as a potential contributor, your changes and ideas are
welcome at any hour of the day or night, weekdays, weekends, and holidays.
Please do not ever hesitate to ask a question or send a PR.
## Code reviews ## Code reviews
All changes must be code reviewed. For non-maintainers this is obvious, since you can't commit anyway. But even for maintainers, we want all changes to get at least one review, preferably (for non-trivial changes obligatorily) from someone who knows the areas the change touches. For non-trivial changes we may want two reviewers. The primary reviewer will make this decision and nominate a second reviewer, if needed. Except for trivial changes, PRs should not be committed until relevant parties (e.g. owners of the subsystem affected by the PR) have had a reasonable chance to look at PR in their local business hours. All changes must be code reviewed. For non-maintainers this is obvious, since
you can't commit anyway. But even for maintainers, we want all changes to get at
least one review, preferably (for non-trivial changes obligatorily) from someone
who knows the areas the change touches. For non-trivial changes we may want two
reviewers. The primary reviewer will make this decision and nominate a second
reviewer, if needed. Except for trivial changes, PRs should not be committed
until relevant parties (e.g. owners of the subsystem affected by the PR) have
had a reasonable chance to look at PR in their local business hours.
Most PRs will find reviewers organically. If a maintainer intends to be the primary reviewer of a PR they should set themselves as the assignee on GitHub and say so in a reply to the PR. Only the primary reviewer of a change should actually do the merge, except in rare cases (e.g. they are unavailable in a reasonable timeframe). Most PRs will find reviewers organically. If a maintainer intends to be the
primary reviewer of a PR they should set themselves as the assignee on GitHub
and say so in a reply to the PR. Only the primary reviewer of a change should
actually do the merge, except in rare cases (e.g. they are unavailable in a
reasonable timeframe).
If a PR has gone 2 work days without an owner emerging, please poke the PR thread and ask for a reviewer to be assigned. If a PR has gone 2 work days without an owner emerging, please poke the PR
thread and ask for a reviewer to be assigned.
Except for rare cases, such as trivial changes (e.g. typos, comments) or emergencies (e.g. broken builds), maintainers should not merge their own changes. Except for rare cases, such as trivial changes (e.g. typos, comments) or
emergencies (e.g. broken builds), maintainers should not merge their own
changes.
Expect reviewers to request that you avoid [common go style mistakes](https://github.com/golang/go/wiki/CodeReviewComments) in your PRs. Expect reviewers to request that you avoid [common go style
mistakes](https://github.com/golang/go/wiki/CodeReviewComments) in your PRs.
## Assigned reviews ## Assigned reviews
Maintainers can assign reviews to other maintainers, when appropriate. The assignee becomes the shepherd for that PR and is responsible for merging the PR once they are satisfied with it or else closing it. The assignee might request reviews from non-maintainers. Maintainers can assign reviews to other maintainers, when appropriate. The
assignee becomes the shepherd for that PR and is responsible for merging the PR
once they are satisfied with it or else closing it. The assignee might request
reviews from non-maintainers.
## Merge hours ## Merge hours
Maintainers will do merges of appropriately reviewed-and-approved changes during their local "business hours" (typically 7:00 am Monday to 5:00 pm (17:00h) Friday). PRs that arrive over the weekend or on holidays will only be merged if there is a very good reason for it and if the code review requirements have been met. Concretely this means that nobody should merge changes immediately before going to bed for the night. Maintainers will do merges of appropriately reviewed-and-approved changes during
their local "business hours" (typically 7:00 am Monday to 5:00 pm (17:00h)
Friday). PRs that arrive over the weekend or on holidays will only be merged if
there is a very good reason for it and if the code review requirements have been
met. Concretely this means that nobody should merge changes immediately before
going to bed for the night.
There may be discussion an even approvals granted outside of the above hours, but merges will generally be deferred. There may be discussion an even approvals granted outside of the above hours,
but merges will generally be deferred.
If a PR is considered complex or controversial, the merge of that PR should be delayed to give all interested parties in all timezones the opportunity to provide feedback. Concretely, this means that such PRs should be held for 24 If a PR is considered complex or controversial, the merge of that PR should be
hours before merging. Of course "complex" and "controversial" are left to the judgment of the people involved, but we trust that part of being a committer is the judgment required to evaluate such things honestly, and not be delayed to give all interested parties in all timezones the opportunity to
motivated by your desire (or your cube-mate's desire) to get their code merged. Also see "Holds" below, any reviewer can issue a "hold" to indicate that the PR is in fact complicated or complex and deserves further review. provide feedback. Concretely, this means that such PRs should be held for 24
hours before merging. Of course "complex" and "controversial" are left to the
judgment of the people involved, but we trust that part of being a committer is
the judgment required to evaluate such things honestly, and not be motivated by
your desire (or your cube-mate's desire) to get their code merged. Also see
"Holds" below, any reviewer can issue a "hold" to indicate that the PR is in
fact complicated or complex and deserves further review.
PRs that are incorrectly judged to be merge-able, may be reverted and subject to re-review, if subsequent reviewers believe that they in fact are controversial or complex. PRs that are incorrectly judged to be merge-able, may be reverted and subject to
re-review, if subsequent reviewers believe that they in fact are controversial
or complex.
## Holds ## Holds
Any maintainer or core contributor who wants to review a PR but does not have time immediately may put a hold on a PR simply by saying so on the PR discussion and offering an ETA measured in single-digit days at most. Any PR that has a hold shall not be merged until the person who requested the hold acks the review, withdraws their hold, or is overruled by a preponderance of maintainers. Any maintainer or core contributor who wants to review a PR but does not have
time immediately may put a hold on a PR simply by saying so on the PR discussion
and offering an ETA measured in single-digit days at most. Any PR that has a
hold shall not be merged until the person who requested the hold acks the
review, withdraws their hold, or is overruled by a preponderance of maintainers.
<!-- BEGIN MUNGE: GENERATED_ANALYTICS --> <!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
......
...@@ -47,7 +47,8 @@ branch, but release branches of Kubernetes should not change. ...@@ -47,7 +47,8 @@ branch, but release branches of Kubernetes should not change.
## Building Kubernetes ## Building Kubernetes
Official releases are built using Docker containers. To build Kubernetes using Official releases are built using Docker containers. To build Kubernetes using
Docker please follow [these instructions](http://releases.k8s.io/HEAD/build/README.md). Docker please follow [these
instructions](http://releases.k8s.io/HEAD/build/README.md).
### Go development environment ### Go development environment
...@@ -55,14 +56,16 @@ Kubernetes is written in the [Go](http://golang.org) programming language. ...@@ -55,14 +56,16 @@ Kubernetes is written in the [Go](http://golang.org) programming language.
To build Kubernetes without using Docker containers, you'll need a Go To build Kubernetes without using Docker containers, you'll need a Go
development environment. Builds for Kubernetes 1.0 - 1.2 require Go version development environment. Builds for Kubernetes 1.0 - 1.2 require Go version
1.4.2. Builds for Kubernetes 1.3 and higher require Go version 1.6.0. If you 1.4.2. Builds for Kubernetes 1.3 and higher require Go version 1.6.0. If you
haven't set up a Go development environment, please follow [these instructions](http://golang.org/doc/code.html) haven't set up a Go development environment, please follow [these
to install the go tools and set up a GOPATH. instructions](http://golang.org/doc/code.html) to install the go tools and set
up a GOPATH.
To build Kubernetes using your local Go development environment (generate linux To build Kubernetes using your local Go development environment (generate linux
binaries): binaries):
hack/build-go.sh hack/build-go.sh
You may pass build options and packages to the script as necessary. To build binaries for all platforms: You may pass build options and packages to the script as necessary. To build
binaries for all platforms:
hack/build-cross.sh hack/build-cross.sh
...@@ -82,7 +85,9 @@ Other git workflows are also valid. ...@@ -82,7 +85,9 @@ Other git workflows are also valid.
### Clone your fork ### Clone your fork
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 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`. there is more than one directory in your `$GOPATH`.
```sh ```sh
...@@ -108,7 +113,9 @@ git fetch upstream ...@@ -108,7 +113,9 @@ git fetch upstream
git rebase upstream/master git rebase upstream/master
``` ```
Note: If you have write access to the main repository at github.com/kubernetes/kubernetes, you should modify your git configuration so that you can't accidentally push to upstream: Note: If you have write access to the main repository at
github.com/kubernetes/kubernetes, you should modify your git configuration so
that you can't accidentally push to upstream:
```sh ```sh
git remote set-url --push upstream no_push git remote set-url --push upstream no_push
...@@ -116,9 +123,10 @@ git remote set-url --push upstream no_push ...@@ -116,9 +123,10 @@ git remote set-url --push upstream no_push
### Committing changes to your fork ### Committing changes to your fork
Before committing any changes, please link/copy the pre-commit hook Before committing any changes, please link/copy the pre-commit hook into your
into your .git directory. This will keep you from accidentally .git directory. This will keep you from accidentally committing non-gofmt'd Go
committing non-gofmt'd Go code. In addition this hook will do a build. code. This hook will also do a build and test whether documentation generation
scripts need to be executed.
The hook requires both Godep and etcd on your `PATH`. The hook requires both Godep and etcd on your `PATH`.
...@@ -156,15 +164,22 @@ See [Faster Reviews](faster_reviews.md) for more details. ...@@ -156,15 +164,22 @@ See [Faster Reviews](faster_reviews.md) for more details.
## godep and dependency management ## godep and dependency management
Kubernetes uses [godep](https://github.com/tools/godep) to manage dependencies. It is not strictly required for building Kubernetes but it is required when managing dependencies under the Godeps/ tree, and is required by a number of the build and test scripts. Please make sure that ``godep`` is installed and in your ``$PATH``. Kubernetes uses [godep](https://github.com/tools/godep) to manage dependencies.
It is not strictly required for building Kubernetes but it is required when
managing dependencies under the Godeps/ tree, and is required by a number of the
build and test scripts. Please make sure that ``godep`` is installed and in your
``$PATH``.
### Installing godep ### Installing godep
There are many ways to build and host Go binaries. Here is an easy way to get utilities like `godep` installed: There are many ways to build and host Go binaries. Here is an easy way to get
utilities like `godep` installed:
1) Ensure that [mercurial](http://mercurial.selenic.com/wiki/Download) is installed on your system. (some of godep's dependencies use the mercurial 1) Ensure that [mercurial](http://mercurial.selenic.com/wiki/Download) is
source control system). Use `apt-get install mercurial` or `yum install mercurial` on Linux, or [brew.sh](http://brew.sh) on OS X, or download installed on your system. (some of godep's dependencies use the mercurial
directly from mercurial. source control system). Use `apt-get install mercurial` or `yum install
mercurial` on Linux, or [brew.sh](http://brew.sh) on OS X, or download directly
from mercurial.
2) Create a new GOPATH for your tools and install godep: 2) Create a new GOPATH for your tools and install godep:
...@@ -182,7 +197,8 @@ export PATH=$PATH:$GOPATH/bin ...@@ -182,7 +197,8 @@ export PATH=$PATH:$GOPATH/bin
``` ```
Note: Note:
At this time, godep update in the Kubernetes project only works properly if your version of godep is < 54. At this time, godep update in the Kubernetes project only works properly if your
version of godep is < 54.
To check your version of godep: To check your version of godep:
...@@ -193,11 +209,14 @@ godep v53 (linux/amd64/go1.5.3) ...@@ -193,11 +209,14 @@ godep v53 (linux/amd64/go1.5.3)
### Using godep ### Using godep
Here's a quick walkthrough of one way to use godeps to add or update a Kubernetes dependency into `vendor/`. For more details, please see the instructions in [godep's documentation](https://github.com/tools/godep). Here's a quick walkthrough of one way to use godeps to add or update a
Kubernetes dependency into `vendor/`. For more details, please see the
instructions in [godep's documentation](https://github.com/tools/godep).
1) Devote a directory to this endeavor: 1) Devote a directory to this endeavor:
_Devoting a separate directory is not required, but it is helpful to separate dependency updates from other changes._ _Devoting a separate directory is not required, but it is helpful to separate
dependency updates from other changes._
```sh ```sh
export KPATH=$HOME/code/kubernetes export KPATH=$HOME/code/kubernetes
...@@ -240,20 +259,27 @@ go get -u path/to/dependency ...@@ -240,20 +259,27 @@ go get -u path/to/dependency
godep update path/to/dependency/... godep update path/to/dependency/...
``` ```
_If `go get -u path/to/dependency` fails with compilation errors, instead try `go get -d -u path/to/dependency` _If `go get -u path/to/dependency` fails with compilation errors, instead try
to fetch the dependencies without compiling them. This can happen when updating the cadvisor dependency._ `go get -d -u path/to/dependency` to fetch the dependencies without compiling
them. This can happen when updating the cadvisor dependency._
5) Before sending your PR, it's a good idea to sanity check that your Godeps.json file is ok by running `hack/verify-godeps.sh` 5) Before sending your PR, it's a good idea to sanity check that your
Godeps.json file is ok by running `hack/verify-godeps.sh`
_If hack/verify-godeps.sh fails after a `godep update`, it is possible that a transitive dependency was added or removed but not _If hack/verify-godeps.sh fails after a `godep update`, it is possible that a
updated by godeps. It then may be necessary to perform a `godep save ./...` to pick up the transitive dependency changes._ transitive dependency was added or removed but not updated by godeps. It then
may be necessary to perform a `godep save ./...` to pick up the transitive
dependency changes._
It is sometimes expedient to manually fix the /Godeps/godeps.json file to minimize the changes. It is sometimes expedient to manually fix the /Godeps/godeps.json file to
minimize the changes.
Please send dependency updates in separate commits within your PR, for easier reviewing. Please send dependency updates in separate commits within your PR, for easier
reviewing.
6) If you updated the Godeps, please also update `Godeps/LICENSES` by running `hack/update-godep-licenses.sh`. 6) If you updated the Godeps, please also update `Godeps/LICENSES` by running
`hack/update-godep-licenses.sh`.
## Testing ## Testing
......
...@@ -34,32 +34,39 @@ Documentation for other releases can be found at ...@@ -34,32 +34,39 @@ Documentation for other releases can be found at
# Node End-To-End tests # Node End-To-End tests
Node e2e tests start kubelet and minimal supporting infrastructure to validate the kubelet on a host. Node e2e tests start kubelet and minimal supporting infrastructure to validate
Tests can be run either locally, against a remote host or against a GCE image. the kubelet on a host. Tests can be run either locally, against a remote host or
against a GCE image.
*Note: Linux only. Mac and Windows unsupported.* *Note: Linux only. Mac and Windows unsupported.*
## Running tests locally ## Running tests locally
etcd must be installed and on the PATH to run the node e2e tests. To verify etcd is installed: `which etcd`. etcd must be installed and on the PATH to run the node e2e tests. To verify
You can find instructions for installing etcd [on the etcd releases page](https://github.com/coreos/etcd/releases). etcd is installed: `which etcd`. You can find instructions for installing etcd
[on the etcd releases page](https://github.com/coreos/etcd/releases).
Run the tests locally: `make test_e2e_node` Run the tests locally: `make test_e2e_node`
Running the node e2e tests locally will build the kubernetes go source files and then start the Running the node e2e tests locally will build the kubernetes go source files and
kubelet, kube-apiserver, and etcd binaries on localhost before executing the ginkgo tests under then start the kubelet, kube-apiserver, and etcd binaries on localhost before
test/e2e_node against the local kubelet instance. executing the ginkgo tests under test/e2e_node against the local kubelet
instance.
## Running tests against a remote host ## Running tests against a remote host
The node e2e tests can be run against one or more remote hosts using one of The node e2e tests can be run against one or more remote hosts using one of:
* [e2e-node-jenkins.sh](../../test/e2e_node/jenkins/e2e-node-jenkins.sh) (gce only) * [e2e-node-jenkins.sh](../../test/e2e_node/jenkins/e2e-node-jenkins.sh) (gce
* [run_e2e.go](../../test/e2e_node/runner/run_e2e.go) (requires passwordless ssh and remote passwordless sudo access over ssh) only)
* using [run_e2e.go](../../test/e2e_node/runner/run_e2e.go) to build a tar.gz and executing on host (requires host access w/ remote sudo) * [run_e2e.go](../../test/e2e_node/runner/run_e2e.go) (requires passwordless ssh
and remote passwordless sudo access over ssh)
* using [run_e2e.go](../../test/e2e_node/runner/run_e2e.go) to build a tar.gz
and executing on host (requires host access w/ remote sudo)
### Configuring a new remote host for testing ### Configuring a new remote host for testing
The host must contain a environment capable of supporting a mini-kubernetes cluster. Includes: The host must contain a environment capable of supporting a mini-kubernetes
cluster. Includes:
* install etcd * install etcd
* install docker * install docker
* install lxc and update grub commandline * install lxc and update grub commandline
...@@ -70,35 +77,60 @@ See [setup_host.sh](../../test/e2e_node/environment/setup_host.sh) ...@@ -70,35 +77,60 @@ See [setup_host.sh](../../test/e2e_node/environment/setup_host.sh)
### Running the tests ### Running the tests
1. If running against a host on gce 1. If running against a host on gce
* Copy [template.properties](../../test/e2e_node/jenkins/template.properties) * Copy [template.properties](../../test/e2e_node/jenkins/template.properties)
* Fill in `GCE_HOSTS` * Fill in `GCE_HOSTS`
* Set `INSTALL_GODEP=true` to install `godep`, `gomega`, `ginkgo` * Set `INSTALL_GODEP=true` to install `godep`, `gomega`, `ginkgo`
* Make sure host names are resolvable to ssh `ssh <host>`. * Make sure host names are resolvable to ssh `ssh <host>`.
* If needed, you can run `gcloud compute config-ssh` to add gce hostnames to your .ssh/config so they are resolvable by ssh.
* If needed, you can run `gcloud compute config-ssh` to add gce hostnames to
your .ssh/config so they are resolvable by ssh.
* Run `test/e2e_node/jenkins/e2e-node-jenkins.sh <path to properties file>` * Run `test/e2e_node/jenkins/e2e-node-jenkins.sh <path to properties file>`
* **Must be run from kubernetes root** * **Must be run from kubernetes root**
2. If running against a host anywhere else 2. If running against a host anywhere else
* **Requires password-less ssh and sudo access** * **Requires password-less ssh and sudo access**
* Make sure this works - e.g. `ssh <hostname> -- sudo echo "ok"` * Make sure this works - e.g. `ssh <hostname> -- sudo echo "ok"`
* If ssh flags are required (e.g. `-i`), they can be used and passed to the tests with `--ssh-options` * If ssh flags are required (e.g. `-i`), they can be used and passed to the
* `go run test/e2e_node/runner/run_e2e.go --logtostderr --hosts <comma separated hosts>` tests with `--ssh-options`
* `go run test/e2e_node/runner/run_e2e.go --logtostderr --hosts <comma
separated hosts>`
* **Must be run from kubernetes root** * **Must be run from kubernetes root**
* requires (go get): `github.com/tools/godep`, `github.com/onsi/gomega`, `github.com/onsi/ginkgo/ginkgo` * requires (go get): `github.com/tools/godep`, `github.com/onsi/gomega`,
`github.com/onsi/ginkgo/ginkgo`
3. Alternatively, manually build and copy `e2e_node_test.tar.gz` to a remote
host
* Build the tar.gz `go run test/e2e_node/runner/run_e2e.go --logtostderr
--build-only`
* requires (go get): `github.com/tools/godep`, `github.com/onsi/gomega`,
`github.com/onsi/ginkgo/ginkgo`
3. Alternatively, manually build and copy `e2e_node_test.tar.gz` to a remote host
* Build the tar.gz `go run test/e2e_node/runner/run_e2e.go --logtostderr --build-only`
* requires (go get): `github.com/tools/godep`, `github.com/onsi/gomega`, `github.com/onsi/ginkgo/ginkgo`
* Copy `e2e_node_test.tar.gz` to the remote host * Copy `e2e_node_test.tar.gz` to the remote host
* Extract the archive on the remote host `tar -xzvf e2e_node_test.tar.gz` * Extract the archive on the remote host `tar -xzvf e2e_node_test.tar.gz`
* Run the tests `./e2e_node.test --logtostderr --vmodule=*=2 --build-services=false --node-name=<hostname>`
* Note: This must be run from the directory containing the kubelet and kube-apiserver binaries. * Run the tests `./e2e_node.test --logtostderr --vmodule=*=2
--build-services=false --node-name=<hostname>`
* Note: This must be run from the directory containing the kubelet and
kube-apiserver binaries.
## Running tests against a gce image ## Running tests against a gce image
* Build a gce image from a prepared gce host * Build a gce image from a prepared gce host
* Create the host from a base image and configure it (see above) * Create the host from a base image and configure it (see above)
* Run tests against this remote host to ensure that it is setup correctly before doing anything else * Run tests against this remote host to ensure that it is setup correctly
before doing anything else
* Create a gce *snapshot* of the instance * Create a gce *snapshot* of the instance
* Create a gce *disk* from the snapshot * Create a gce *disk* from the snapshot
* Create a gce *image* from the disk * Create a gce *image* from the disk
...@@ -112,8 +144,9 @@ See [setup_host.sh](../../test/e2e_node/environment/setup_host.sh) ...@@ -112,8 +144,9 @@ See [setup_host.sh](../../test/e2e_node/environment/setup_host.sh)
## Kubernetes Jenkins CI and PR builder ## Kubernetes Jenkins CI and PR builder
Node e2e tests are run against a static list of host environments continuously or when manually triggered on a github.com Node e2e tests are run against a static list of host environments continuously
pull requests using the trigger phrase `@k8s-bot test node e2e experimental` - *results not yet publish, pending or when manually triggered on a github.com pull requests using the trigger
phrase `@k8s-bot test node e2e experimental` - *results not yet publish, pending
evaluation of test stability.*. evaluation of test stability.*.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment