grafana / flagger-k6-webhook

Using k6 to do load testing of the canary before rolling out traffic
Apache License 2.0
24 stars 9 forks source link

K6_CLOUD_TOKEN should be configurable per run #101

Open zerok opened 9 months ago

zerok commented 9 months ago

Right now it looks like K6_CLOUD_TOKEN can only be set globally for the whole process. This way, means that right now every canary that uses the same load balancer also has to upload data to the same k6 cloud instance:

flowchart LR
    canary1-->k6-loadtester
    canary2-->k6-loadtester
    canary3-->k6-loadtester
    k6-loadtester-->k6-cloud1

If we wanted to have different k6 cloud instances receive data from different canaries, we'd need to set up multiple k6-loadtester instances:

flowchart LR
    canary1-->k6-loadtester1
    canary2-->k6-loadtester2
    canary3-->k6-loadtester3
    k6-loadtester1-->k6-cloud1
    k6-loadtester2-->k6-cloud2
    k6-loadtester3-->k6-cloud3

It would be great if that token could also be injected by the webhook call itself so that multiple k6 cloud projects could be used for different canary tests while still using only a single webhook-handler instance.

flowchart LR
    canary1-->k6-loadtester
    canary2-->k6-loadtester
    canary3-->k6-loadtester
    k6-loadtester-->k6-cloud1
    k6-loadtester-->k6-cloud2
    k6-loadtester-->k6-cloud3