Local Dev Setup
Prerequisites
- go version v1.22.0+
- docker version 17.03+.
- kubectl version v1.28.0+.
Overview
The metal-operator is leveraging envtest to conduct and run unit test suites. Additionally, it is using the Redfish Mock Server to run a local mock Redfish instance to simulate operations performed by various reconcilers.
Run the local test suite
The local test suite can be run via
shell
make testThis Makefile directive will start under the hood the Redfish mock server, instantiate the envtest environment and run go test ./... on the whole project.
Start/Stop Redfish Mock Server
The Redfish mock server can be started and stopped with the following command
shell
make startbmc
make stopbmcRun the local Tilt development environment
Prerequisites
The local development environment can be started via
shell
make tilt-upThis Makefile directive will:
- create a local Kind cluster with local registry
- install cert-manager
- install boot-operator to reconcile the
ServerBootConfigurationCRD - start the
metal-operatorcontroller and Redfish mock server as a sidecar container - an Endpoint resource is created to point to the Redfish mock server
- this will result in
Serverresources being created and reconciled by themetal-operator
shell
‹kind-metal› kubectl get server
NAME UUID MANUFACTURER POWERSTATE STATE AGE
compute-0-bmc-endpoint-sample 38947555-7742-3448-3784-823347823834 Contoso On Available 3m21sThe local development environment can be deleted via
shell
make kind-delete