You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/developers-guide.md
+43-1Lines changed: 43 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -58,6 +58,48 @@ If you are ready for code contribution, you need to have development environment
58
58
1. IDE. You can choose any IDE that supports Golang, e.g. Visual Studio Code, GoLand, etc.
59
59
1. Install [Docker Engine](https://docs.docker.com/engine/install/) or other tools that could build container images such as [podman](https://podman.io/). After writing the code, the best way to test openstack-cloud-controller-manager is to replace the container image specified in its Deployment/StatefulSet/DaemonSet manifest in the kubernetes cluster. We are using docker in this guide.
60
60
61
+
### Testing
62
+
63
+
*cloud-provider-openstack* includes a number of different types of test. As is usual for Kubernetes projects, jobs definitions live in the [test-infra](https://github.com/kubernetes/test-infra/tree/master/config/jobs/kubernetes/cloud-provider-openstack) project. A variety of tests run on each PR, however, you can also run your tests locally.
64
+
65
+
### Unit tests
66
+
67
+
Unit tests require a go environment with a suitable go version, as noted previously. Assuming you have this, you can run unit tests using the `unit` Makefile target.
68
+
69
+
```
70
+
make unit
71
+
```
72
+
73
+
### E2E tests
74
+
75
+
End-to-end or _e2e_ tests are more complex to run as they require a functioning OpenStack cloud and Kubernetes (well, k3s) deployment. Fortunately, you can rely on the infrastructure used for CI to run this on your own machines.
76
+
77
+
For example, to run the Cinder CSI e2e tests, the CI calls the `tests/ci-csi-cinder-e2e.sh` script. Inspecting this, you'll note that a lot of the commands in here are simply provisioning an instance on GCE, using [Boskos](https://github.com/kubernetes-sigs/boskos) to manage static resources (projects, in this case) if needed. If you have a set of GCE credentials, then in theory you could run this script as-is. However, all you need is a VM with sufficient resources and network connectivity running the correct image (Ubuntu 20.04 cloud image as of writing - check `tests/scripts/create-gce-vm.sh` for the latest info). For example, using OpenStack:
78
+
79
+
```
80
+
openstack server create \
81
+
--image ubuntu2004 \
82
+
--flavor m1.large \
83
+
--key-name <key-name> \
84
+
--network <network> \
85
+
--wait \
86
+
${USER}-csi-cinder-e2e-tests
87
+
openstack server add floating ip <server> <ip-address>
88
+
```
89
+
90
+
Once done, you can run the same Ansible commands seen in `tests/ci-csi-cinder-e2e.sh`:
91
+
92
+
```
93
+
ansible-playbook \
94
+
-v \
95
+
--user ubuntu \
96
+
--inventory 10.0.110.127, \
97
+
--ssh-common-args "-o StrictHostKeyChecking=no" \
98
+
tests/playbooks/test-csi-cinder-e2e.yaml
99
+
```
100
+
101
+
As you can see, this whole area needs improvement to make this a little more approachable for non-CI use cases. This should be enough direction to get started though.
Now, you can change openstack-cloud-controller-manager image in the kubernetes cluster, assuming the openstack-cloud-controller-manager is running as a DaemonSet:
141
+
Now you can change openstack-cloud-controller-manager image in the kubernetes cluster, assuming the openstack-cloud-controller-manager is running as a DaemonSet:
0 commit comments