Contributing¶
Warning
Page under construction.
Before You Start¶
The Gateway Plugin for Argo Rollouts is written in Golang. If you do not have a good grounding in Go, try out the tutorial.
Pre-requisites¶
Install:
Checkout the code:
git clone https://github.com/argoproj-labs/rollouts-plugin-trafficrouter-gatewayapi.git
cd rollouts-plugin-trafficrouter-gatewayapi
Argo Rollouts plugin system architecture¶
When Argo Rollouts controller starts, it requests the ConfigMap argo-rollouts-config (from the namespace in which controller is located) from api server of k8s cluster and if it gets it, it validates its content before putting this ConfigMap in RAM. It is important to understand it happens only at the beginning and only one time, so if you will change argo-rollouts-config or you will add it after Argo Rollouts controller you will need to restart Argo Rollouts. Controller uses this config map to understand where specified in argo manifest plugins are. When Argo Rollouts learns their locations it downloads and executes them as seperate RPC servers in the same pod. When controller gets specific events, for example events corresponding to the SetWeight action, it makes specific remote procedure call to the needing RPC server and waits its response. Diagram illustrating the main aspects of architecture is below
Project dependecies¶
go.mod
is used, so the go build/test
commands automatically install the needed dependencies
Building¶
We have 2 targets in /Makefile:
- local-build It is recommended to use this target "make local-build" to make not optimized build for local testing as debugger can't link optimized binary code with its go code to debug it correctly
- gateway-api-plugin-build It is recommended to use this target "make gateway-api-plugin-build" to make optimized build for production when you are sure it is ready for it. We use it to create releases
Running the plugin Locally¶
- Create ConfigMap argo-rollouts-config in namespace of Argo Rollouts controller. We will run it locally so its namespace will be default
- Run make local-build to make not optimized local build of plugin. Specify the path to this local build in the ConfigMap that we created before
file://<path to the local build>
- Install needing CRDs for Argo Rollouts and apply its needing manifest. For that you can run
After delete in cluster Argo Rollouts controller deployment as we will run controller locally
kubectl create namespace argo-rollouts kubectl apply -n argo-rollouts -f https://github.com/argoproj/argo-rollouts/releases/latest/download/install.yaml
- Run locally Argo Rollouts controller
cd ~/go/src/github.com/argoproj/argo-rollouts go run ./cmd/rollouts-controller/main.go
- If you did all right, Argo Rollouts controller will find your local build of plugin and will run it as RPC server locally. You have ability to debug plugin. Debugger of go has ability to attach to the local process and as we built our plugin without optimizations it also can map binary code with text code of plugin correctly so you can use breakpoints and it will work
Making releases¶
- Write in /RELEASE_NOTES.md the description of the future release
- On needing commit in main branch create locally tag
If you would like to make pre-release run
git tag release-v[0-9]+.[0-9]+.[0-9]+
git tag release-v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+
- Push tag to the remote repository
- Pushed tag will trigger needing workflow that will create corresponding tag v[0-9]+.[0-9]+.[0-9]+ or v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+ and will delete your tag so after pushing tag to the remote repository you need to delete it locally. When workflow will finish its work you can run git pull and you will see new tag
Running Unit Tests¶
To run unit tests:
make test