This brief guide is addressed to developers aiming to extend this repository.
- Customize benchmarks-dedicated CronJob files
- Change the Docker images to be used
- Add additional results writers
- Add new benchmarks
- Run benchmarks locally
- Git credentials Secret for private repository
Customize benchmarks-dedicated CronJob files
Every benchmark has a dedicated YAML folder under yaml/benchmarks
.
It is sufficient to edit whatever file under its folder without the need of applying anything immediately: Kustomize will automatically merge and apply all the YAML specified by command line files upong launching benchmarks-dedicated CronJob files.
As described in the Docker images section, there are currentl two Docker images being used:
A Kubernetes CronJob launches periodic jobs in Docker containers. The base CronJob file of this repository
yaml/base/kubemarks-pkb-cronjob.yaml
mainly executes PerfKit Benchmarker, which in turn needs to launch benchmarks in Docker containers so that the Kubernetes scheduler can allocate those onto pods.marcomicera/kubemarks-cronjob
andmarcomicera/kubemarks-pkb
are the Docker images launched by the CronJob and PerfKit Benchmarker, respectively.
The first (marcomicera/kubemarks-cronjob
) is defined in the base CronJob file yaml/base/kubemarks-pkb-cronjob.yaml
.
The second image (marcomicera/kubemarks-pkb
) is defined in the PKB_IMAGE
variable of the PKB's starting script scripts/pkb/start.sh
.
Since the second must be launched by the former, one must build and upload the (marcomicera/kubemarks-cronjob
) image with its build and upload script upon changing the name of the image launched by PerfKit Benchmarker (marcomicera/kubemarks-pkb
).
All Dockerfiles can be found in the docker
folder.
PerfKit Benchmarker can be easily extended with additional results writers.
It is enough to add a SamplePublisher
child class in perfkitbenchmarker/publisher.py
and add it to the list of publishers (SampleCollector
's class method _PublishersFromFlags()
).
Results publishers must be enabled by means of flags, which are declared at the beginning of that very same file.
PerfKit Benchmarker is finally launched by the PKB's starting script, which holds a PKB_FLAGS
variable containing all the flags to be passed to PerfKit Benchmarker.
New benchmarks must be integrated in PerfKit Benchmarker: guidelines on how to do so are available in its CONTRIBUTING.md
file.
-
Start
minikube
on your local machine:$ minikube start
-
Add the current user to the
docker
group:$ newgrp docker
-
To use a local Docker image:
- Run a local Docker registry:
$ docker run -d -p 5000:5000 --restart=always --name registry registry:2
- Build the Docker image:
$ docker build -t kubemarks-pkb docker/kubemarks-pkb/ && docker tag kubemarks-pkb:latest marcomicera/kubemarks-pkb
- Run a local Docker registry:
When you're done:
- Stop the local Docker registry:
$ docker container stop registry
- Remove its container:
$ docker container rm -v registry
- Stop
minikube
;$ minikube stop