Skip to content

Commit 1e69ff8

Browse files
authored
Merge pull request #5000 from knight42/test-with-kind
doc: describe how to run conformance tests with kind
2 parents 44565cf + 1cf544c commit 1e69ff8

File tree

1 file changed

+75
-12
lines changed

1 file changed

+75
-12
lines changed

contributors/devel/sig-architecture/conformance-tests.md

Lines changed: 75 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -68,21 +68,21 @@ Examples of features which are not currently eligible for conformance tests:
6868
- anything that requires a non-default admission plugin
6969
- features that are pending deprecation, eg: componentstatus
7070

71-
Conformance tests are intended to be stable and backwards compatible according to
72-
the standard API deprecation policies. Therefore any test that relies on specific
73-
output that is not subject to the deprecation policy cannot be promoted to conformance.
71+
Conformance tests are intended to be stable and backwards compatible according to
72+
the standard API deprecation policies. Therefore any test that relies on specific
73+
output that is not subject to the deprecation policy cannot be promoted to conformance.
7474
Examples of tests which are not eligible to conformance:
7575
- anything that checks specific Events are generated, as we make no guarantees
7676
about the contents of events, nor their delivery
77-
- If a test depends on events it is recommended to change the test to
77+
- If a test depends on events it is recommended to change the test to
7878
use an informer pattern and watch specific resource changes instead.
79-
- An exception to this is tests that generates synthetic events themselves
79+
- An exception to this is tests that generates synthetic events themselves
8080
to verify that the API is capable of being exercised
8181
- anything that checks optional Condition fields, such as Reason or Message, as
8282
these may change over time (however it is reasonable to verify these fields
8383
exist or are non-empty)
84-
- If the test is checking for specific conditions or reasons, it is considered
85-
overly specific and it is recommended to simply look for pass/failure criteria
84+
- If the test is checking for specific conditions or reasons, it is considered
85+
overly specific and it is recommended to simply look for pass/failure criteria
8686
where possible, and output the condition/reason for debugging purposes only.
8787

8888
Examples of areas we may want to relax these requirements once we have a
@@ -105,7 +105,7 @@ Generally speaking, the goals are to:
105105

106106
- Make sure tests that are already passing remain passing. If new OS-specific
107107
functionality is added, it should be in a new test.
108-
- Ensure that new tests covering Linux-specific functionality are tagged with `[LinuxOnly]`
108+
- Ensure that new tests covering Linux-specific functionality are tagged with `[LinuxOnly]`
109109
(see: [Kinds of Tests](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-testing/e2e-tests.md#kinds-of-tests),
110110
- Give future reviewers a reference to an active issue or documentation clarifying why a test
111111
cannot run on Windows.
@@ -116,7 +116,7 @@ The tests that are running today:
116116
including Windows versions, or have been ported by SIG-Windows
117117
(see [kubernetes-sigs/windows-testing/images](https://github.com/kubernetes-sigs/windows-testing/tree/master/images)
118118
- Do not depend on any functionality that is different or not available on Windows. The full list
119-
is available in the Windows Kubernetes docs under [api](https://kubernetes.io/docs/setup/windows/intro-windows-in-kubernetes/#api).
119+
is available in the Windows Kubernetes docs under [api](https://kubernetes.io/docs/setup/windows/intro-windows-in-kubernetes/#api).
120120
A brief summary is included here as a starting point. If the docs are insufficient
121121
or there are more questions, please contact #SIG-Windows on Slack to get another
122122
reviewer.
@@ -139,13 +139,13 @@ implicitly by Docker or ContainerD, not by the kubelet. Do not check properties
139139
- Networking
140140
- Pods set `HostNetwork=true`. Is not supported on Windows, and the Pod will not start.
141141
- Network and DNS settings must be passed through CNI. Windows does not use `/etc/resolv.conf`, so tests should not rely on reading that file to check DNS settings.
142-
- If you to check network settings such as dns search lists, please use [agnhost](https://github.com/kubernetes/kubernetes/tree/master/test/images/agnhost) to output needed data from the container.
142+
- If you to check network settings such as dns search lists, please use [agnhost](https://github.com/kubernetes/kubernetes/tree/master/test/images/agnhost) to output needed data from the container.
143143
- Windows treats all DNS lookups with a `.` to be FQDN, not PQDN. For example `kubernetes` will resolve as a PQDN,
144144
but `kubernetes.default` will be resolved as a FQDN and fail.
145145
- ICMP only works between pods on the same network, and are not routable to external networks. TCP/UDP are routable.
146146
- Windows containers do not support IPv6.
147147

148-
The existing tests which are affected by one of those criteria are tagged with `[LinuxOnly]`
148+
The existing tests which are affected by one of those criteria are tagged with `[LinuxOnly]`
149149
(see: [Kinds of Tests](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-testing/e2e-tests.md#kinds-of-tests).
150150

151151
## Conformance Test Version Skew Policy
@@ -169,7 +169,7 @@ with the following versions must pass conformance tests built from the
169169
following branches:
170170

171171
| cluster version | master | release-1.3 | release-1.2 | release-1.1 |
172-
| --------------- | ----- | ----------- | ----------- | ----------- |
172+
| --------------- | ------ | ----------- | ----------- | ----------- |
173173
| v1.3.0-alpha | yes | yes | yes | no |
174174
| v1.2.x | no | no | yes | yes |
175175
| v1.1.x | no | no | no | yes |
@@ -181,6 +181,69 @@ configured. Conformance tests must be able to be run against clusters that have
181181
not been created with `test-infra/kubetest`, just provide a kubeconfig with the
182182
appropriate endpoint and credentials.
183183

184+
### Running Conformance Tests With [KinD](https://kind.sigs.k8s.io/)
185+
186+
1. Work in your kubernetes branch, preferably in the default go src location: `$GOPATH/src/k8s.io/kubernetes`
187+
188+
2. Create your kind node image:
189+
190+
```sh
191+
# Without bazel
192+
kind build node-image
193+
194+
# Or with bazel
195+
kind build node-image --type bazel
196+
```
197+
198+
3. Create your kind e2e cluster config kind-config-yaml:
199+
200+
```yaml
201+
# necessary for conformance
202+
kind: Cluster
203+
apiVersion: kind.x-k8s.io/v1alpha4
204+
networking:
205+
ipFamily: ipv4
206+
nodes:
207+
# the control plane node
208+
- role: control-plane
209+
- role: worker
210+
- role: worker
211+
```
212+
213+
4. Set your KUBECONFIG env variable (KIND generates the conf based on it):
214+
215+
```sh
216+
export KUBECONFIG="${HOME}/.kube/kind-test-config"
217+
```
218+
219+
5. Use the previous config to create your cluster:
220+
221+
```sh
222+
kind create cluster --config kind-config.yaml --image kindest/node:latest -v4
223+
```
224+
225+
6. Create your e2e Kubernetes binary (from your Kubernetes src code):
226+
227+
```sh
228+
# Without bazel
229+
make WHAT="test/e2e/e2e.test"
230+
231+
# Or with bazel
232+
bazel build //test/e2e:e2e.test
233+
```
234+
235+
7. Execute your tests:
236+
237+
```sh
238+
# Without bazel
239+
./_output/bin/e2e.test -context kind-kind -ginkgo.focus="\[sig-network\].*Conformance" -num-nodes 2
240+
241+
# Or with bazel
242+
./bazel-bin/test/e2e/e2e.test -context kind-kind -ginkgo.focus="\[sig-network\].*Conformance" -num-nodes 2
243+
```
244+
245+
### Running Conformance Tests With kubetest
246+
184247
These commands are intended to be run within a kubernetes directory, either
185248
cloned from source, or extracted from release artifacts such as
186249
`kubernetes.tar.gz`. They assume you have a valid golang installation.

0 commit comments

Comments
 (0)