Local development quickstart
This guide covers setting up a local development environment for ORC, running the controller, and executing tests.
Setting up kind
kind (Kubernetes in Docker) provides a local Kubernetes cluster for development.
Install kind
Follow the official installation instructions for your platform.
Create a cluster
Create a default kind cluster:
kind create cluster
Verify the cluster is running:
kubectl get nodes
NAME STATUS ROLES AGE VERSION
kind-control-plane Ready control-plane 1m v1.30.0
Setting up DevStack
ORC's end-to-end tests require an OpenStack environment. We recommend DevStack for local development because several e2e tests require admin-level access to OpenStack APIs, and it's easy enough to restart fresh if anything goes wrong with the OpenStack environment while testing.
Install DevStack
Follow the DevStack Quick Start Guide to set up a single-machine installation.
For ORC development, the default services are currently enough.
Configure credentials
After DevStack installation, locate your clouds.yaml file (typically at /etc/openstack/clouds.yaml or in your DevStack directory). You'll need two cloud entries:
devstack, for regular user credentials on the demo projectdevstack-admin-demo, for admin credentials on the demo project
Loading the CRDs
Install the ORC Custom Resource Definitions into your cluster:
kubectl apply -k config/crd --server-side
Verify the CRDs are installed:
kubectl get crds | grep openstack
flavors.openstack.k-orc.cloud 2024-11-11T12:00:00Z
images.openstack.k-orc.cloud 2024-11-11T12:00:00Z
networks.openstack.k-orc.cloud 2024-11-11T12:00:00Z
...
Whenever you make changes to the API, you'll need to re-generate the CRDs with make generate and install the updated CRDs in the cluster using above command.
Running ORC locally
Run the ORC manager directly from source:
go run ./cmd/manager -zap-log-level 5
The manager will start all controllers and begin watching for ORC resources. Use Ctrl+C to stop the manager.
Re-run the same command to recompile after you've made changes to the source code.
Running tests
At this point, you're ready to run both the unit tests and the end-to-end tests.
# Run the unit tests
make test
# Run the end-to-end tests
make test-e2e