Add gitlab-runner-scaler#6499
Conversation
1abaa5f to
7af19df
Compare
7af19df to
b58aaae
Compare
Signed-off-by: Fira Curie <fira42073@gmail.com>
b58aaae to
b650bc3
Compare
| meta := &gitlabRunnerMetadata{ | ||
| ProjectID: "12345", | ||
| TargetPipelineQueueLength: 5, | ||
| TriggerIndex: 0, |
There was a problem hiding this comment.
It's something quite small but, could we use TriggerIndex: 1 ? 0 is the default value so just using 1 we can also check that the TriggerIndex is correctly reflected in the metric name
| @@ -0,0 +1,503 @@ | |||
| //go:build e2e | |||
There was a problem hiding this comment.
Reading the e2e test, it waits a PAT so I guess that we need to create an e2e account to run it. Does it have any special requirement? Does it make sense to use gitlab.com instead of spin up a dummy gitlab instance in the cluster during the e2e test? https://docs.gitlab.com/charts/installation/deployment.html
There was a problem hiding this comment.
I actually already tried doing that, and it's a bit too complicated
#5616 (comment)
I think it's best to create a gitlab.com account, since it would only require phone verification to run pipelines, and that's it. Repos will be cleaned up automatically as well as part of e2e tests.
| apiVersion: apps/v1 | ||
| kind: Deployment | ||
| metadata: | ||
| name: {{.DeploymentName}} | ||
| namespace: {{.TestNamespace}} | ||
| labels: | ||
| app: gitlab-runner | ||
| spec: | ||
| replicas: 0 | ||
| selector: | ||
| matchLabels: | ||
| app: gitlab-runner | ||
| template: | ||
| metadata: | ||
| labels: | ||
| app: gitlab-runner | ||
| spec: | ||
| terminationGracePeriodSeconds: 90 | ||
| containers: | ||
| - name: gitlab-runner | ||
| image: busybox | ||
| command: ["/bin/sh", "-c", "trap 'echo SIGTERM received; exit 0' SIGTERM; while true; do sleep 30; done"] |
There was a problem hiding this comment.
Does it make sense creating a real runner using their runner image to check that the job is dequeued? https://hub.docker.com/r/gitlab/gitlab-runner/tags
There was a problem hiding this comment.
I sat down and tried doing that this evening, but then realized that we actually already kind of had this discussion here.
Gitlab already does have a mechanism of autoscaling (creating runner per job)

don't worry about the token in the image, it's been rotated already.
So I think doesn't make sense to manage that using keda. Again, please correct me if I'm wrong, maybe I simply don't quite understand the usecase here.
| testSONotActivated(t, kc) | ||
|
|
||
| testSOScaleOut(t, kc, projectID) | ||
| testSOScaleIn(t, kc, projectID) |
There was a problem hiding this comment.
Let's use the same name as the majority of the tests:
| testSONotActivated(t, kc) | |
| testSOScaleOut(t, kc, projectID) | |
| testSOScaleIn(t, kc, projectID) | |
| testActivation(t, kc) | |
| testScaleOut(t, kc, projectID) | |
| testScaleIn(t, kc, projectID) |
|
|
||
| metric := GenerateMetricInMili(metricName, float64(queueLen)) | ||
|
|
||
| return []external_metrics.ExternalMetricValue{metric}, queueLen >= s.metadata.TargetPipelineQueueLength, nil |
There was a problem hiding this comment.
TargetPipelineQueueLength shouldn't be used here. It is used for the target, for the activation we need to include another parameter ActivationTargetPipelineQueueLength with default value 0 and use it with >
return []external_metrics.ExternalMetricValue{metric}, queueLen > s.metadata.ActivationTargetPipelineQueueLength, nil| gitlabAPIURL: {{.GitlabAPIURL}} | ||
| projectID: "{{.ProjectID}}" | ||
| targetPipelineQueueLength: "{{.TargetPipelineQueueLength}}" | ||
| labels: "e2eSOtester" |
There was a problem hiding this comment.
The activation parameter is left here for the activation test
|
|
||
| func testSONotActivated(t *testing.T, kc *kubernetes.Clientset) { |
There was a problem hiding this comment.
During the activation test, we have to add an item in the queue and check that the activation value blocks the scaling until the item count in the queue is higher
| } | ||
|
|
||
| // setConfigValueURL is a function that sets the value of the url.URL field | ||
| func setConfigValueURL(valFromConfig string, field reflect.Value) error { |
Signed-off-by: Fira Curie <fira42073@gmail.com>
9f9ad27 to
a2ccae7
Compare
Signed-off-by: Fira Curie <fira42073@gmail.com>
3fc095e to
f92b18c
Compare
|
/run-e2e gitlab |
|
We need gitlab PAT for this to work, have you had a chance to add it? |
I see, nope. We need to work on that, adding this #6499 (comment) for reference, thanks for letting us know! |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
|
Do we need to create a gitlab account for this? I can create an account for KEDA if needed |
|
Hi, @JorTurFer! We do indeed need a gitlab account. We would also need to verify the phone number to use the shared runners. I guess gitlab asks for verification to prevent spam of its resources. |
|
Is it feasible to use Gitlab directly in cluster? we can install it as part of e2e test using the helm chart -> https://docs.gitlab.com/charts/ (or maybe it's not). If the Gitlab account is needed in any case, I'll create it |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
|
@fira42073 any update here? |
|
Hi! Not really. I think we have already discussed in the issue the possibility of selfhosting gitlab. While it is possible, I assume it might be too cumbersome to do so. See #5616 (comment) If you have a better idea, I'm open to suggestions. |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
|
This issue has been automatically closed due to inactivity. |
Provide a description of what has been changed
Checklist
Fixes #5616