2
2
3
3
## IMPORTANT PLEASE NOTE!
4
4
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.
8
8
9
9
## Bring up the cluster
10
10
@@ -31,48 +31,42 @@ The most straightforward approach to build those binaries is to run `make
31
31
release`. However, that builds binaries for all supported platforms, and can be
32
32
slow. You can speed up the process by following the instructions below to only
33
33
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
38
34
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
42
40
43
- # Build binaries for both Linux and Windows
41
+ # Build binaries for both Linux and Windows:
44
42
make quick-release
45
43
```
46
44
47
- ### 2 Create a Kubernetes cluster
45
+ ### 2. Create a Kubernetes cluster
48
46
49
47
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
+
50
51
Please make sure you set the environment variables properly following the
51
52
instructions in the previous section.
52
53
53
54
First, set the following environment variables which are required for
54
55
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.
56
60
57
61
```
58
62
export NUM_NODES=2 # number of Linux nodes
59
63
export NUM_WINDOWS_NODES=2
60
64
export KUBE_GCE_ENABLE_IP_ALIASES=true
61
65
```
62
66
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
-
73
67
Now bring up a cluster using one of the following two methods:
74
68
75
- #### 2.a Create a regular Kubernetes cluster
69
+ #### 2a. Create a regular Kubernetes cluster
76
70
77
71
```
78
72
# Invoke kube-up.sh with these environment variables:
@@ -87,13 +81,15 @@ To teardown the cluster run:
87
81
PROJECT=${CLOUDSDK_CORE_PROJECT} KUBERNETES_SKIP_CONFIRM=y ./cluster/kube-down.sh
88
82
```
89
83
90
- #### 2.b Create a Kubernetes end-to-end (E2E) test cluster
84
+ #### 2b. Create a Kubernetes end-to-end (E2E) test cluster
91
85
92
86
```
93
87
PROJECT=${CLOUDSDK_CORE_PROJECT} go run ./hack/e2e.go -- --up
94
88
```
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 ` .
97
93
98
94
No matter what type of cluster you chose to create, the result should be a
99
95
Kubernetes cluster with one Linux master node, ` NUM_NODES ` Linux worker nodes
@@ -108,87 +104,62 @@ brought up correctly:
108
104
cluster/gce/windows/smoke-test.sh
109
105
```
110
106
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.
115
110
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
118
112
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 ) .
120
116
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.
123
119
124
120
```
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
132
122
```
133
123
134
- * Download the list of Windows e2e tests :
124
+ * Set necessary environment variables and fetch the `run- e2e.sh` script :
135
125
136
126
```
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
142
130
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
143
135
```
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:
154
136
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.
162
139
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:
164
146
165
147
```
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
167
151
```
168
152
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 :
171
155
172
156
```
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"
184
159
```
185
160
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.
194
163
164
+ After the test run completes, log files can be found under the `${ARTIFACTS}`
165
+ directory.
0 commit comments