-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for the Cloud output #86
Conversation
9de10ba
to
7fb851a
Compare
6dd7a4f
to
29f772a
Compare
184d838
to
4ed219b
Compare
fdc0e54
to
0cdcc9d
Compare
var ( | ||
secrets corev1.SecretList | ||
secretOpts = &client.ListOptions{ | ||
// TODO: find out a better way to get namespace here | ||
Namespace: "k6-operator-system", | ||
LabelSelector: labels.SelectorFromSet(map[string]string{ | ||
"k6cloud": "token", | ||
}), | ||
} | ||
) | ||
if err := r.List(ctx, &secrets, secretOpts); err != nil { | ||
log.Error(err, "Failed to load k6 Cloud token") | ||
return res, err | ||
} | ||
|
||
if len(secrets.Items) < 1 { | ||
err := fmt.Errorf("There are no secrets to hold k6 Cloud token") | ||
log.Error(err, err.Error()) | ||
return res, err | ||
} | ||
|
||
if t, ok := secrets.Items[0].Data["token"]; !ok { | ||
err := fmt.Errorf("The secret doesn't have a field token for k6 Cloud") | ||
log.Error(err, err.Error()) | ||
return res, err | ||
} else { | ||
token = string(t) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we consider trying to load the token from other sources as well? For instance we typically don't use k8s secrets, instead we use Vault with a side car to mount a secrets volume for the container. In our case, with Vault, we were hoping to use the file configuration (https://k6.io/docs/cloud/integrations/token/#authentication-with-a-config-file). Is it possible to look for the other methods of providing a token as documented at the link above, then also look for k8s secret? While the env var approach is certainly not as secure, it does come in handy for testing...however, at the very least file config support would be appreciated. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @brian-groux-hs! Sorry for such a delay in response.
Yes, I definitely would like to have alternative options to load secrets here. I wasn't sure what people might use so you just gave me an answer to that, thank you 😄 I'm not sure at the moment if operator should try to load everything one by one as you describe or be a separate configuration option though...
Either way, I won't be able to add it right now but noted in TODO. I'll probably create a separate issue for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Related issue: #103
d4ab53e
to
aec7aed
Compare
8f29aa0
to
5061106
Compare
No matter the status of the pods, FinishJobs must be able to a) finalize the cloud output test and b) proceed to the next stage of controller.
5061106
to
f08da61
Compare
This PR adds basic support for the Cloud output. If token is set and arguments contain
--out cloud
, the test will generate a new test run on the Cloud and send metrics to the Cloud. In other aspects, operator should behave as before.Things of note:
"runner": "true"
to be able to distinguish between them and initializing podCurrent issues / things to improve:
thresholds are absent (a blocker on the cloud side)was resolvedIt'd be best to see to #83 before merging this PR.
Fixes #9