-
Notifications
You must be signed in to change notification settings - Fork 228
Local development workflow for Rio
Thanks for helping to make Rio awesome!
The majority of the code and functionality runs in the rio controller. When you do a rio install
this pod is included in the install, and you can see its logs by running rio systemlogs
. For local development you will instead run this controller locally.
- Fork and clone rio
- Setup a kubernetes cluster, preferably with k3s/k3d - see section below on local DNS
-
go run main.go
with environment variables KUBECONFIG and CATTLE_DEV_MODE=30. Or you can do a build:./scripts/build && ./bin/rio-controller
.
This will install everything and run your controller. Now you can follow the quick start guide in the main readme to run an app. You can easily write a script (a, b) to help automate this.
Note: rio up
uses a controller image. Do the following to enable:
REPO=myDockerUsername TAG=dev ./scripts/build && docker build -f package/Dockerfile -t myDockerUsername/rio-controller:dev . && docker push myDockerUsername/rio-controller:dev
- add to go build command:
-ldflags " -X github.com/rancher/rio/pkg/constants.ControllerImage=myDockerUsername/rio-controller -X github.com/rancher/rio/pkg/constants.ControllerImageTag=dev"
This is the primary method of interacting with Rio. You can develop on the controller using a standard release. If you are making changes to the cli and want to build and use locally:
- Fork and clone rio
go build -i -o bin/rio cli/main.go
./bin/rio help
When deploying the cluster locally, there are some additional settings required to get access to services
- Start k3d using port forwarding:
k3d create -n rio --image rancher/k3s:v1.0.1 --api-port 6550 --publish 80:80 --publish 443:443 --publish 9443:9443 --publish 9080:9080 --workers 1
- Start controller with flag
--ip-address=127.0.0.1
- Now
rio info
should showCluster Domain IPs: 127.0.0.1
- On MacOS (possibly others) you will need to delete the traefik service to free up port 80,
kubectl delete svc -n kube-system traefik