Skip to content

Commit

Permalink
Take into account worker and master images for locust (#222)
Browse files Browse the repository at this point in the history
  • Loading branch information
st3veV authored Sep 23, 2022
1 parent 6f3af1f commit 9ddac64
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
1 change: 0 additions & 1 deletion docs/user-flow.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ curl -X POST http://${KANGAL_PROXY_ADDRESS}/load-test \
-F masterImage=hellofresh/kangal-jmeter-master:5.4.1 \
-F workerImage=hellofresh/kangal-jmeter-worker:5.4.1
```
**Note:** For locust only master image will be taken into account!!

## Check
Check the status of the load test.
Expand Down
4 changes: 2 additions & 2 deletions pkg/backends/locust/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ func (b *Backend) Sync(ctx context.Context, loadTest loadTestV1.LoadTest, report
}
}

masterJob := newMasterJob(loadTest, configMap, secret, reportURL, b.masterResources, b.podAnnotations, b.nodeSelector, b.podTolerations, b.image, b.logger)
masterJob := newMasterJob(loadTest, configMap, secret, reportURL, b.masterResources, b.podAnnotations, b.nodeSelector, b.podTolerations, loadTest.Spec.MasterConfig, b.logger)
_, err = b.kubeClientSet.
BatchV1().
Jobs(loadTest.Status.Namespace).
Expand All @@ -199,7 +199,7 @@ func (b *Backend) Sync(ctx context.Context, loadTest loadTestV1.LoadTest, report
return err
}

workerJob := newWorkerJob(loadTest, configMap, secret, masterService, b.workerResources, b.podAnnotations, b.nodeSelector, b.podTolerations, b.image, b.logger)
workerJob := newWorkerJob(loadTest, configMap, secret, masterService, b.workerResources, b.podAnnotations, b.nodeSelector, b.podTolerations, loadTest.Spec.WorkerConfig, b.logger)
_, err = b.kubeClientSet.
BatchV1().
Jobs(loadTest.Status.Namespace).
Expand Down
8 changes: 4 additions & 4 deletions pkg/backends/locust/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ func newMasterJob(

ownerRef := metaV1.NewControllerRef(&loadTest, loadTestV1.SchemeGroupVersion.WithKind("LoadTest"))

imageRef := fmt.Sprintf("%s:%s", loadTest.Spec.MasterConfig.Image, loadTest.Spec.MasterConfig.Tag)
imageRef := fmt.Sprintf("%s:%s", image.Image, image.Tag)
if imageRef == ":" {
imageRef = fmt.Sprintf("%s:%s", image.Image, image.Tag)
imageRef = fmt.Sprintf("%s:%s", loadTest.Spec.MasterConfig.Image, loadTest.Spec.MasterConfig.Tag)
logger.Warn("Loadtest.Spec.MasterConfig is empty; using default image", zap.String("imageRef", imageRef))
}

Expand Down Expand Up @@ -227,9 +227,9 @@ func newWorkerJob(

ownerRef := metaV1.NewControllerRef(&loadTest, loadTestV1.SchemeGroupVersion.WithKind("LoadTest"))

imageRef := fmt.Sprintf("%s:%s", loadTest.Spec.MasterConfig.Image, loadTest.Spec.MasterConfig.Tag)
imageRef := fmt.Sprintf("%s:%s", image.Image, image.Tag)
if imageRef == ":" {
imageRef = fmt.Sprintf("%s:%s", image.Image, image.Tag)
imageRef = fmt.Sprintf("%s:%s", loadTest.Spec.MasterConfig.Image, loadTest.Spec.MasterConfig.Tag)
logger.Warn("Loadtest.Spec.MasterConfig is empty; using default image", zap.String("imageRef", imageRef))
}

Expand Down

0 comments on commit 9ddac64

Please sign in to comment.