Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
5f7c7ad1
Commit
5f7c7ad1
authored
Jun 08, 2016
by
Colin Hom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
document federation e2e cli flow
parent
782bf6e8
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
136 additions
and
15 deletions
+136
-15
push-federation-images.sh
build/push-federation-images.sh
+1
-1
kube-util.sh
cluster/kube-util.sh
+1
-1
e2e-tests.md
docs/devel/e2e-tests.md
+121
-0
common.sh
federation/cluster/common.sh
+4
-4
federation-down.sh
federation/cluster/federation-down.sh
+1
-1
federation-push.sh
federation/cluster/federation-push.sh
+1
-1
federation-up.sh
federation/cluster/federation-up.sh
+1
-1
e2e-down.sh
hack/e2e-internal/e2e-down.sh
+2
-2
e2e-status.sh
hack/e2e-internal/e2e-status.sh
+1
-1
e2e-up.sh
hack/e2e-internal/e2e-up.sh
+2
-2
federated-ginkgo-e2e.sh
hack/federated-ginkgo-e2e.sh
+1
-1
No files found.
build/push-federation-images.sh
View file @
5f7c7ad1
...
@@ -26,4 +26,4 @@ source "${KUBE_ROOT}/build/util.sh"
...
@@ -26,4 +26,4 @@ source "${KUBE_ROOT}/build/util.sh"
source
"
${
KUBE_ROOT
}
/federation/cluster/common.sh"
source
"
${
KUBE_ROOT
}
/federation/cluster/common.sh"
FEDERATION_IMAGE_TAG
=
"
$(
kube::release::semantic_image_tag_version
)
"
push-federat
ed
-images
FEDERATION_IMAGE_TAG
=
"
$(
kube::release::semantic_image_tag_version
)
"
push-federat
ion
-images
cluster/kube-util.sh
View file @
5f7c7ad1
...
@@ -104,7 +104,7 @@ fi
...
@@ -104,7 +104,7 @@ fi
# Should NOT be called within the global scope, unless setting the desired global zone vars
# Should NOT be called within the global scope, unless setting the desired global zone vars
# This function is currently NOT USED in the global scope
# This function is currently NOT USED in the global scope
function
set-federat
ed
-zone-vars
{
function
set-federat
ion
-zone-vars
{
zone
=
"
$1
"
zone
=
"
$1
"
export
OVERRIDE_CONTEXT
=
"federation-e2e-
${
KUBERNETES_PROVIDER
}
-
$zone
"
export
OVERRIDE_CONTEXT
=
"federation-e2e-
${
KUBERNETES_PROVIDER
}
-
$zone
"
echo
"Setting zone vars to:
$OVERRIDE_CONTEXT
"
echo
"Setting zone vars to:
$OVERRIDE_CONTEXT
"
...
...
docs/devel/e2e-tests.md
View file @
5f7c7ad1
...
@@ -45,6 +45,14 @@ Updated: 5/3/2016
...
@@ -45,6 +45,14 @@ Updated: 5/3/2016
-
[
Cleaning up
](
#cleaning-up
)
-
[
Cleaning up
](
#cleaning-up
)
-
[
Advanced testing
](
#advanced-testing
)
-
[
Advanced testing
](
#advanced-testing
)
-
[
Bringing up a cluster for testing
](
#bringing-up-a-cluster-for-testing
)
-
[
Bringing up a cluster for testing
](
#bringing-up-a-cluster-for-testing
)
-
[
Federation e2e tests
](
#federation-e2e-tests
)
-
[
Configuring federation e2e tests
](
#configuring-federation-e2e-tests
)
-
[
Image Push Repository
](
#image-push-repository
)
-
[
Build
](
#build
)
-
[
Deploy federation control plane
](
#deploy-federation-control-plane
)
-
[
Run the Tests
](
#run-the-tests
)
-
[
Teardown
](
#teardown
)
-
[
Shortcuts for test developers
](
#shortcuts-for-test-developers
)
-
[
Debugging clusters
](
#debugging-clusters
)
-
[
Debugging clusters
](
#debugging-clusters
)
-
[
Local clusters
](
#local-clusters
)
-
[
Local clusters
](
#local-clusters
)
-
[
Testing against local clusters
](
#testing-against-local-clusters
)
-
[
Testing against local clusters
](
#testing-against-local-clusters
)
...
@@ -232,6 +240,119 @@ stale permissions can cause problems.
...
@@ -232,6 +240,119 @@ stale permissions can cause problems.
-
`sudo iptables -F`
, clear ip tables rules left by the kube-proxy.
-
`sudo iptables -F`
, clear ip tables rules left by the kube-proxy.
### Federation e2e tests
By default,
`e2e.go`
provisions a single Kubernetes cluster, and any
`Feature:Federation`
ginkgo tests will be skipped.
Federation e2e testing involve bringing up multiple "underlying" Kubernetes clusters,
and deploying the federation control plane as a Kubernetes application on the underlying clusters.
The federation e2e tests are still managed via
`e2e.go`
, but require some extra configuration items.
#### Configuring federation e2e tests
The following environment variables will enable federation e2e building, provisioning and testing.
```
sh
$
export
FEDERATION
=
true
$
export
E2E_ZONES
=
"us-central1-a us-central1-b us-central1-f"
```
A Kubernetes cluster will be provisioned in each zone listed in
`E2E_ZONES`
. A zone can only appear once in the
`E2E_ZONES`
list.
#### Image Push Repository
Next, specify the docker repository where your ci images will be pushed.
*
**If `KUBERNETES_PROVIDER=gce` or `KUBERNETES_PROVIDER=gke`**
:
You can simply set your push repo base based on your project name, and the necessary repositories will be auto-created when you
first push your container images.
```sh
$ export FEDERATION_PUSH_REPO_BASE="gcr.io/${GCE_PROJECT_NAME}"
```
Skip ahead to the **Build** section.
*
**For all other providers**
:
You'll be responsible for creating and managing access to the repositories manually.
```sh
$ export FEDERATION_PUSH_REPO_BASE="quay.io/colin_hom"
```
Given this example, the `federation-apiserver` container image will be pushed to the repository
`quay.io/colin_hom/federation-apiserver`.
The docker client on the machine running `e2e.go` must have push access for the following pre-existing repositories:
* `${FEDERATION_PUSH_REPO_BASE}/federation-apiserver`
* `${FEDERATION_PUSH_REPO_BASE}/federation-controller-manager`
These repositories must allow public read access, as the e2e node docker daemons will not have any credentials. If you're using
gce/gke as your provider, the repositories will have read-access by default.
#### Build
*
Compile the binaries and build container images:
```
sh
$ KUBE_RELEASE_RUN_TESTS
=
n
KUBE_FASTBUILD
=
true
go run hack/e2e.go
-v
-build
```
*
Push the federation container images
```
sh
$
build/push-federation-images.sh
```
#### Deploy federation control plane
The following
command
will create the underlying Kubernetes clusters
in
each of
`
E2E_ZONES
`
, and
then
provision the
federation control plane
in
the cluster occupying the last zone
in
the
`
E2E_ZONES
`
list.
```
sh
$ go run hack/e2e.go -v -up
```
#### Run the Tests
This will run only the `Feature:Federation` e2e tests. You can omit the `ginkgo.focus` argument to run the entire e2e suite.
```
sh
$ go run hack/e2e.go -v -test --test_args="--ginkgo.focus=
\[
Feature:Federation
\]
"
```
#### Teardown
```
sh
$ go run hack/e2e.go -v -down
```
#### Shortcuts for test developers
* To speed up `e2e.go -up`, provision a single-node kubernetes cluster in a single e2e zone:
`NUM_NODES=1 E2E_ZONES="us-central1-f"`
Keep in mind that some tests may require multiple underlying clusters and/or minimum compute resource availability.
* You can quickly recompile the e2e testing framework via `go install ./test/e2e`. This will not do anything besides
allow you to verify that the go code compiles.
* If you want to run your e2e testing framework without re-provisioning the e2e setup, you can do so via
`make WHAT=test/e2e/e2e.test` and then re-running the ginkgo tests.
* If you're hacking around with the federation control plane deployment itself,
you can quickly re-deploy the federation control plane Kubernetes manifests without tearing any resources down.
To re-deploy the federation control plane after running `-up` for the first time:
```sh
$ federation/cluster/federation-up.sh
```
### Debugging clusters
### Debugging clusters
If a cluster fails to initialize, or you'd like to better understand cluster
If a cluster fails to initialize, or you'd like to better understand cluster
...
...
federation/cluster/common.sh
View file @
5f7c7ad1
...
@@ -41,7 +41,7 @@ host_kubectl="${KUBE_ROOT}/cluster/kubectl.sh --namespace=${FEDERATION_NAMESPACE
...
@@ -41,7 +41,7 @@ host_kubectl="${KUBE_ROOT}/cluster/kubectl.sh --namespace=${FEDERATION_NAMESPACE
# Optional
# Optional
# FEDERATION_IMAGE_TAG: reference and pull all federated images with this tag. Used for ci testing
# FEDERATION_IMAGE_TAG: reference and pull all federated images with this tag. Used for ci testing
function
create-federat
ed
-api-objects
{
function
create-federat
ion
-api-objects
{
(
(
:
"
${
FEDERATION_PUSH_REPO_BASE
?Must set FEDERATION_PUSH_REPO_BASE env var
}
"
:
"
${
FEDERATION_PUSH_REPO_BASE
?Must set FEDERATION_PUSH_REPO_BASE env var
}
"
export
FEDERATION_APISERVER_DEPLOYMENT_NAME
=
"federation-apiserver"
export
FEDERATION_APISERVER_DEPLOYMENT_NAME
=
"federation-apiserver"
...
@@ -69,7 +69,7 @@ function create-federated-api-objects {
...
@@ -69,7 +69,7 @@ function create-federated-api-objects {
$template
"
${
manifests_root
}
/federation-ns.yaml"
|
$host_kubectl
apply
-f
-
$template
"
${
manifests_root
}
/federation-ns.yaml"
|
$host_kubectl
apply
-f
-
cleanup-federat
ed
-api-objects
cleanup-federat
ion
-api-objects
export
FEDERATION_API_HOST
=
""
export
FEDERATION_API_HOST
=
""
export
KUBE_MASTER_IP
=
""
export
KUBE_MASTER_IP
=
""
...
@@ -181,7 +181,7 @@ function create-federated-api-objects {
...
@@ -181,7 +181,7 @@ function create-federated-api-objects {
# Optional
# Optional
# FEDERATION_IMAGE_TAG: push all federated images with this tag. Used for ci testing
# FEDERATION_IMAGE_TAG: push all federated images with this tag. Used for ci testing
function
push-federat
ed
-images
{
function
push-federat
ion
-images
{
:
"
${
FEDERATION_PUSH_REPO_BASE
?Must set FEDERATION_PUSH_REPO_BASE env var
}
"
:
"
${
FEDERATION_PUSH_REPO_BASE
?Must set FEDERATION_PUSH_REPO_BASE env var
}
"
local
FEDERATION_BINARIES
=
${
FEDERATION_BINARIES
:-
"federation-apiserver federation-controller-manager"
}
local
FEDERATION_BINARIES
=
${
FEDERATION_BINARIES
:-
"federation-apiserver federation-controller-manager"
}
...
@@ -230,7 +230,7 @@ function push-federated-images {
...
@@ -230,7 +230,7 @@ function push-federated-images {
done
done
}
}
function
cleanup-federat
ed
-api-objects
{
function
cleanup-federat
ion
-api-objects
{
# Delete all resources with the federated-cluster label.
# Delete all resources with the federated-cluster label.
$host_kubectl
delete pods,svc,rc,deployment,secret
-lapp
=
federated-cluster
$host_kubectl
delete pods,svc,rc,deployment,secret
-lapp
=
federated-cluster
# Delete all resources in FEDERATION_NAMESPACE.
# Delete all resources in FEDERATION_NAMESPACE.
...
...
federation/cluster/federat
ed
-down.sh
→
federation/cluster/federat
ion
-down.sh
View file @
5f7c7ad1
...
@@ -22,6 +22,6 @@ KUBE_ROOT=$(readlink -m $(dirname "${BASH_SOURCE}")/../../)
...
@@ -22,6 +22,6 @@ KUBE_ROOT=$(readlink -m $(dirname "${BASH_SOURCE}")/../../)
.
${
KUBE_ROOT
}
/federation/cluster/common.sh
.
${
KUBE_ROOT
}
/federation/cluster/common.sh
cleanup-federat
ed
-api-objects
cleanup-federat
ion
-api-objects
$host_kubectl
delete ns/
${
FEDERATION_NAMESPACE
}
$host_kubectl
delete ns/
${
FEDERATION_NAMESPACE
}
federation/cluster/federat
ed
-push.sh
→
federation/cluster/federat
ion
-push.sh
View file @
5f7c7ad1
...
@@ -28,5 +28,5 @@ KUBE_ROOT=$(readlink -m $(dirname "${BASH_SOURCE}")/../../)
...
@@ -28,5 +28,5 @@ KUBE_ROOT=$(readlink -m $(dirname "${BASH_SOURCE}")/../../)
.
${
KUBE_ROOT
}
/federation/cluster/common.sh
.
${
KUBE_ROOT
}
/federation/cluster/common.sh
push-federat
ed
-images
push-federat
ion
-images
federation/cluster/federat
ed
-up.sh
→
federation/cluster/federat
ion
-up.sh
View file @
5f7c7ad1
...
@@ -22,4 +22,4 @@ KUBE_ROOT=$(readlink -m $(dirname "${BASH_SOURCE}")/../../)
...
@@ -22,4 +22,4 @@ KUBE_ROOT=$(readlink -m $(dirname "${BASH_SOURCE}")/../../)
.
${
KUBE_ROOT
}
/federation/cluster/common.sh
.
${
KUBE_ROOT
}
/federation/cluster/common.sh
create-federat
ed
-api-objects
create-federat
ion
-api-objects
hack/e2e-internal/e2e-down.sh
View file @
5f7c7ad1
...
@@ -34,8 +34,8 @@ if [[ "${FEDERATION:-}" == "true" ]];then
...
@@ -34,8 +34,8 @@ if [[ "${FEDERATION:-}" == "true" ]];then
for
zone
in
${
E2E_ZONES
}
;
do
for
zone
in
${
E2E_ZONES
}
;
do
# bring up e2e cluster
# bring up e2e cluster
(
(
set-federat
ed
-zone-vars
"
$zone
"
set-federat
ion
-zone-vars
"
$zone
"
cleanup-federat
ed-api-objects
||
echo
"Couldn't cleanup federated
api objects"
cleanup-federat
ion-api-objects
||
echo
"Couldn't cleanup federation
api objects"
test-teardown
test-teardown
)
)
done
done
...
...
hack/e2e-internal/e2e-status.sh
View file @
5f7c7ad1
...
@@ -37,7 +37,7 @@ if [[ "${FEDERATION:-}" == "true" ]];then
...
@@ -37,7 +37,7 @@ if [[ "${FEDERATION:-}" == "true" ]];then
# select each one and call federated-up
# select each one and call federated-up
for
zone
in
${
E2E_ZONES
}
;
do
for
zone
in
${
E2E_ZONES
}
;
do
(
(
set-federat
ed
-zone-vars
"
$zone
"
set-federat
ion
-zone-vars
"
$zone
"
printf
"
\n\t
Checking version for
$OVERRIDE_CONTEXT
\n
"
printf
"
\n\t
Checking version for
$OVERRIDE_CONTEXT
\n
"
${
KUBECTL
}
--context
=
"
$OVERRIDE_CONTEXT
"
version
${
KUBECTL
}
--context
=
"
$OVERRIDE_CONTEXT
"
version
)
)
...
...
hack/e2e-internal/e2e-up.sh
View file @
5f7c7ad1
...
@@ -36,14 +36,14 @@ if [[ "${FEDERATION:-}" == "true" ]];then
...
@@ -36,14 +36,14 @@ if [[ "${FEDERATION:-}" == "true" ]];then
# select each one and call federated-up
# select each one and call federated-up
for
zone
in
${
E2E_ZONES
}
;
do
for
zone
in
${
E2E_ZONES
}
;
do
(
(
set-federat
ed
-zone-vars
"
$zone
"
set-federat
ion
-zone-vars
"
$zone
"
test-setup
test-setup
)
)
done
done
if
[[
-f
"
${
KUBE_ROOT
}
/federation/manifests/federated-image.tag"
]]
;
then
if
[[
-f
"
${
KUBE_ROOT
}
/federation/manifests/federated-image.tag"
]]
;
then
export
FEDERATION_IMAGE_TAG
=
"
$(
cat
"
${
KUBE_ROOT
}
/federation/manifests/federated-image.tag"
)
"
export
FEDERATION_IMAGE_TAG
=
"
$(
cat
"
${
KUBE_ROOT
}
/federation/manifests/federated-image.tag"
)
"
fi
fi
"
${
KUBE_ROOT
}
/federation/cluster/federat
ed
-up.sh"
"
${
KUBE_ROOT
}
/federation/cluster/federat
ion
-up.sh"
else
else
test-setup
test-setup
fi
fi
hack/federated-ginkgo-e2e.sh
View file @
5f7c7ad1
...
@@ -29,6 +29,6 @@ for zone in ${E2E_ZONES};do
...
@@ -29,6 +29,6 @@ for zone in ${E2E_ZONES};do
lastZone
=
"
$zone
"
lastZone
=
"
$zone
"
done
done
(
(
set-federat
ed
-zone-vars
"
$zone
"
set-federat
ion
-zone-vars
"
$zone
"
"
${
KUBE_ROOT
}
/hack/ginkgo-e2e.sh"
$@
"
${
KUBE_ROOT
}
/hack/ginkgo-e2e.sh"
$@
)
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment