Skip to content

Commit 0fbb246

Browse files
committed
Update GCE Windows README steps for running e2e tests.
1 parent 583ff36 commit 0fbb246

File tree

1 file changed

+60
-89
lines changed

1 file changed

+60
-89
lines changed

cluster/gce/windows/README-GCE-Windows-kube-up.md

Lines changed: 60 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
## IMPORTANT PLEASE NOTE!
44
Any time the file structure in the `windows` directory changes, `windows/BUILD`
5-
and `k8s.io/release/lib/releaselib.sh` must be manually updated with the changes.
6-
We HIGHLY recommend not changing the file structure, because consumers of
7-
Kubernetes releases depend on the release structure remaining stable.
5+
and `k8s.io/release/lib/releaselib.sh` must be manually updated with the
6+
changes. We HIGHLY recommend not changing the file structure, because consumers
7+
of Kubernetes releases depend on the release structure remaining stable.
88

99
## Bring up the cluster
1010

@@ -31,48 +31,42 @@ The most straightforward approach to build those binaries is to run `make
3131
release`. However, that builds binaries for all supported platforms, and can be
3232
slow. You can speed up the process by following the instructions below to only
3333
build the necessary binaries.
34-
```
35-
# Fetch the PR: https://github.com/pjh/kubernetes/pull/43
36-
git remote add pjh https://github.com/pjh/kubernetes
37-
git fetch pjh pull/43/head
3834

39-
# Get the commit hash and cherry-pick the commit to your current branch
40-
BUILD_WIN_COMMIT=$(git ls-remote pjh | grep refs/pull/43/head | cut -f 1)
41-
git cherry-pick $BUILD_WIN_COMMIT
35+
```
36+
# Apply https://github.com/pjh/kubernetes/pull/43 to your tree:
37+
curl \
38+
https://patch-diff.githubusercontent.com/raw/pjh/kubernetes/pull/43.patch | \
39+
git apply
4240
43-
# Build binaries for both Linux and Windows
41+
# Build binaries for both Linux and Windows:
4442
make quick-release
4543
```
4644

47-
### 2 Create a Kubernetes cluster
45+
### 2. Create a Kubernetes cluster
4846

4947
You can create a regular Kubernetes cluster or an end-to-end test cluster.
48+
End-to-end test clusters support running the Kubernetes e2e tests and enable
49+
some debugging features such as SSH access on the Windows nodes.
50+
5051
Please make sure you set the environment variables properly following the
5152
instructions in the previous section.
5253

5354
First, set the following environment variables which are required for
5455
controlling the number of Linux and Windows nodes in the cluster and for
55-
enabling IP aliases (which are required for Windows pod routing):
56+
enabling IP aliases (which are required for Windows pod routing). At least one
57+
Linux worker node is required and two are recommended because many default
58+
cluster-addons (e.g., `kube-dns`) need to run on Linux nodes. The master control
59+
plane only runs on Linux.
5660

5761
```
5862
export NUM_NODES=2 # number of Linux nodes
5963
export NUM_WINDOWS_NODES=2
6064
export KUBE_GCE_ENABLE_IP_ALIASES=true
6165
```
6266

63-
If you wish to use `netd` as the CNI plugin for Linux nodes, set these
64-
variables:
65-
66-
```
67-
export KUBE_ENABLE_NETD=true
68-
export KUBE_CUSTOM_NETD_YAML=$(curl -s \
69-
https://raw.githubusercontent.com/GoogleCloudPlatform/netd/master/netd.yaml \
70-
| sed -e 's/^/ /')
71-
```
72-
7367
Now bring up a cluster using one of the following two methods:
7468

75-
#### 2.a Create a regular Kubernetes cluster
69+
#### 2a. Create a regular Kubernetes cluster
7670

7771
```
7872
# Invoke kube-up.sh with these environment variables:
@@ -87,13 +81,15 @@ To teardown the cluster run:
8781
PROJECT=${CLOUDSDK_CORE_PROJECT} KUBERNETES_SKIP_CONFIRM=y ./cluster/kube-down.sh
8882
```
8983

90-
#### 2.b Create a Kubernetes end-to-end (E2E) test cluster
84+
#### 2b. Create a Kubernetes end-to-end (E2E) test cluster
9185

9286
```
9387
PROJECT=${CLOUDSDK_CORE_PROJECT} go run ./hack/e2e.go -- --up
9488
```
95-
This command, by default, tears down the existing E2E cluster and create a new
96-
one.
89+
90+
This command, by default, tears down any existing E2E cluster and creates a new
91+
one. To teardown the cluster run the same command with `--down` instead of
92+
`--up`.
9793

9894
No matter what type of cluster you chose to create, the result should be a
9995
Kubernetes cluster with one Linux master node, `NUM_NODES` Linux worker nodes
@@ -108,87 +104,62 @@ brought up correctly:
108104
cluster/gce/windows/smoke-test.sh
109105
```
110106

111-
## Running tests against the cluster
112-
113-
These steps are based on
114-
[kubernetes-sigs/windows-testing](https://github.com/kubernetes-sigs/windows-testing).
107+
Sometimes the first run of the smoke test will fail because it took too long to
108+
pull the Windows test containers. The smoke test will usually pass on the next
109+
attempt.
115110

116-
* TODO(pjh): use patched `cluster/local/util.sh` from
117-
https://github.com/pjh/kubernetes/blob/windows-up/cluster/local/util.sh.
111+
## Running e2e tests against the cluster
118112

119-
* If necessary run `alias kubectl=client/bin/kubectl` .
113+
If you brought up an end-to-end test cluster using the steps above then you can
114+
use the steps below to run K8s e2e tests. These steps are based on
115+
[kubernetes-sigs/windows-testing](https://github.com/kubernetes-sigs/windows-testing).
120116

121-
* Set the following environment variables (these values should make sense if
122-
you built your cluster using the kube-up steps above):
117+
* Build the necessary test binaries. This must be done after every change to
118+
test code.
123119

124120
```
125-
export KUBE_HOME=$(pwd)
126-
export KUBECONFIG=~/.kube/config
127-
export KUBE_MASTER=local
128-
export KUBE_MASTER_NAME=kubernetes-master
129-
export KUBE_MASTER_IP=$(kubectl get node ${KUBE_MASTER_NAME} -o jsonpath='{.status.addresses[?(@.type=="ExternalIP")].address}')
130-
export KUBE_MASTER_URL=https://${KUBE_MASTER_IP}
131-
export KUBE_MASTER_PORT=443
121+
make WHAT=test/e2e/e2e.test
132122
```
133123
134-
* Download the list of Windows e2e tests:
124+
* Set necessary environment variables and fetch the `run-e2e.sh` script:
135125
136126
```
137-
curl https://raw.githubusercontent.com/e2e-win/e2e-win-prow-deployment/master/repo-list.txt -o ${KUBE_HOME}/repo-list.yaml
138-
export KUBE_TEST_REPO_LIST=${KUBE_HOME}/repo-list.yaml
139-
```
140-
141-
* Download and configure the list of tests to exclude:
127+
export KUBECONFIG=~/.kube/config
128+
export WORKSPACE=$(pwd)
129+
export ARTIFACTS=${WORKSPACE}/e2e-artifacts
142130
131+
curl \
132+
https://raw.githubusercontent.com/yujuhong/gce-k8s-windows-testing/master/run-e2e.sh \
133+
-o ${WORKSPACE}/run-e2e.sh
134+
chmod u+x run-e2e.sh
143135
```
144-
curl https://raw.githubusercontent.com/e2e-win/e2e-win-prow-deployment/master/exclude_conformance_test.txt -o ${KUBE_HOME}/exclude_conformance_test.txt
145-
export EXCLUDED_TESTS=$(cat exclude_conformance_test.txt |
146-
tr -d '\r' | # remove Windows carriage returns
147-
tr -s '\n' '|' | # coalesce newlines into |
148-
tr -s ' ' '.' | # coalesce spaces into .
149-
sed -e 's/[]\[()]/\\&/g' | # escape brackets and parentheses
150-
sed -e 's/.$//g') # remove final | added by tr
151-
```
152-
153-
* Taint the Linux nodes so that test pods will not land on them:
154136
155-
```
156-
export LINUX_NODES=$(kubectl get nodes -l beta.kubernetes.io/os=linux,kubernetes.io/hostname!=${KUBE_MASTER_NAME} -o name)
157-
export LINUX_NODE_COUNT=$(echo ${LINUX_NODES} | wc -w)
158-
for node in $LINUX_NODES; do
159-
kubectl taint node $node node-under-test=false:NoSchedule
160-
done
161-
```
137+
NOTE: `run-e2e.sh` begins with a 5 minute sleep to wait for container images
138+
to be pre-pulled. You'll probably want to edit the script and remove this.
162139
163-
* Build necessary test binaries:
140+
* The canonical arguments for running all Windows e2e tests against a cluster
141+
on GCE can be seen by searching for `--test-cmd-args` in the [test
142+
configuration](https://github.com/kubernetes/test-infra/blob/master/config/jobs/kubernetes/sig-gcp/sig-gcp-windows.yaml#L78)
143+
for the `ci-kubernetes-e2e-windows-gce` continuous test job. These arguments
144+
should be passed to the `run-e2e` script; escape the ginkgo arguments by
145+
adding quotes around them. For example:
164146
165147
```
166-
make WHAT=test/e2e/e2e.test
148+
./run-e2e.sh --node-os-distro=windows \
149+
--ginkgo.focus="\[Conformance\]|\[NodeConformance\]|\[sig-windows\]" \
150+
--ginkgo.skip="\[LinuxOnly\]|\[Serial\]|\[Feature:.+\]" --minStartupPods=8
167151
```
168152
169-
* Run the tests with flags that point at the "local" (already-running) cluster
170-
and that permit the `NoSchedule` Linux nodes:
153+
* Run a single test by setting the ginkgo focus to match your test name; for
154+
example, the "DNS should provide DNS for the cluster" test can be run using:
171155
172156
```
173-
export KUBETEST_ARGS="--ginkgo.noColor=true "\
174-
"--report-dir=${KUBE_HOME}/e2e-reports "\
175-
"--allowed-not-ready-nodes=${LINUX_NODE_COUNT} "\
176-
"--ginkgo.dryRun=false "\
177-
"--ginkgo.focus=\[Conformance\] "\
178-
"--ginkgo.skip=${EXCLUDED_TESTS}"
179-
180-
go run ${KUBE_HOME}/hack/e2e.go -- --verbose-commands \
181-
--ginkgo-parallel=4 \
182-
--check-version-skew=false --test --provider=local \
183-
--test_args="${KUBETEST_ARGS}" &> ${KUBE_HOME}/conformance.out
157+
./run-e2e.sh --node-os-distro=windows \
158+
--ginkgo.focus="provide\sDNS\sfor\sthe\scluster"
184159
```
185160
186-
TODO: copy log files from Windows nodes using some command like:
187-
188-
```
189-
scp -r -o PreferredAuthentications=keyboard-interactive,password \
190-
-o PubkeyAuthentication=no \
191-
user@kubernetes-minion-windows-group-mk0p:C:\\etc\\kubernetes\\logs \
192-
kubetest-logs/
193-
```
161+
Make sure to always include `--node-os-distro=windows` for testing against
162+
Windows nodes.
194163
164+
After the test run completes, log files can be found under the `${ARTIFACTS}`
165+
directory.

0 commit comments

Comments
 (0)