Skip to content

Commit

Permalink
Add K8s Gosbench Jinja template
Browse files Browse the repository at this point in the history
Dynamically add more workers for tests.
Also increased the amount of workers Prometheus scans for to 40.
  • Loading branch information
mulbc committed Jun 10, 2020
1 parent ca46573 commit 2f18abe
Show file tree
Hide file tree
Showing 3 changed files with 226 additions and 0 deletions.
Empty file modified k8s/gosbench.yaml
100755 → 100644
Empty file.
188 changes: 188 additions & 0 deletions k8s/gosbench_template.yaml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
# This is a Jinja template file with dynamic worker count.
# You can generate a valid YAML config with this for example with j2cli https://github.com/kolypto/j2cli
# NUMWORKERS=3 j2 k8s/gosbench_template.yaml.j2 > /tmp/gosbench.yaml
---
apiVersion: v1
kind: ConfigMap
data:
config.yml: |-
s3_config:
- access_key: 8MKI7yLHF2L5Z07rabTZ
secret_key: Y7quDBT3az/emhiDOiQR18hZLKzFaKUjOU4YyPCP
region: eu-central-1
endpoint: https://172.30.196.58:443
skipSSLverify: true

# For generating annotations when we start/stop testcases
# https://grafana.com/docs/http_api/annotations/#create-annotation
grafana_config:
endpoint: http://grafana
username: admin
password: grafana

tests:
- name: EverythingWorks
read_weight: 20
write_weight: 80
delete_weight: 0
list_weight: 0
objects:
size_min: 5
size_max: 100
part_size: 0
# distribution: constant, random, sequential
size_distribution: random
unit: KB
number_min: 100
number_max: 100
# distribution: constant, random, sequential
number_distribution: constant
buckets:
number_min: 1
number_max: 10
# distribution: constant, random, sequential
number_distribution: constant
# Name prefix for buckets and objects
bucket_prefix: gosbench1-
object_prefix: obj
# End after a set amount of time
# Runtime in time.Duration - do not forget the unit please
# stop_with_runtime: 60s # Example with 60 seconds runtime
stop_with_runtime:
# End after a set amount of operations (per worker)
stop_with_ops: 3000
# Number of s3 performance test servers to run in parallel
workers: {{ NUMWORKERS }}
# Set wheter workers share the same buckets or not
# If set to True - bucket names will have the worker # appended
workers_share_buckets: True
# Number of requests processed in parallel by each worker
parallel_clients: 3
# Remove all generated buckets and its content after run
clean_after: True
- name: EverythingWorksAgain
read_weight: 20
write_weight: 80
delete_weight: 0
list_weight: 0
objects:
size_min: 5
size_max: 100
part_size: 0
# distribution: constant, random, sequential
size_distribution: random
unit: KB
number_min: 100
number_max: 100
# distribution: constant, random, sequential
number_distribution: constant
buckets:
number_min: 1
number_max: 10
# distribution: constant, random, sequential
number_distribution: constant
# Name prefix for buckets and objects
bucket_prefix: gosbench1-
object_prefix: obj
# End after a set amount of time
# Runtime in time.Duration - do not forget the unit please
# stop_with_runtime: 60s # Example with 60 seconds runtime
stop_with_runtime:
# End after a set amount of operations (per worker)
stop_with_ops: 3000
# Number of s3 performance test servers to run in parallel
workers: {{ NUMWORKERS }}
# Set wheter workers share the same buckets or not
# If set to True - bucket names will have the worker # appended
workers_share_buckets: True
# Number of requests processed in parallel by each worker
parallel_clients: 3
# Remove all generated buckets and its content after run
clean_after: True
metadata:
name: gosbench-config
labels:
app: gosbench-monitoring
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: gosbench-server
labels:
app: gosbench
spec:
replicas: 1
selector:
matchLabels:
app: gosbench
template:
metadata:
labels:
app: gosbench
spec:
containers:
- name: server
image: quay.io/mulbc/gosbench-server
imagePullPolicy: Always
command: ['./main', '-c', '/app/config/config.yml']
ports:
- containerPort: 2000
volumeMounts:
- name: gosbench-config
mountPath: /app/config
volumes:
- name: gosbench-config
configMap:
name: gosbench-config
---
apiVersion: v1
kind: Service
metadata:
name: gosbench-server
labels:
app: gosbench
spec:
type: NodePort
ports:
- port: 2000
targetPort: 2000
selector:
app: gosbench
{% for worker in range(NUMWORKERS | int) %}
---
apiVersion: batch/v1
kind: Job
metadata:
name: gosbench-worker{{ worker+1 }}
labels:
app: gosbench-worker{{ worker+1 }}
spec:
template:
metadata:
labels:
app: gosbench
spec:
containers:
- name: gosbench-worker
image: quay.io/mulbc/gosbench-worker
imagePullPolicy: Always
command: ['./main', '-d', '-s', 'gosbench-server:2000']
ports:
- containerPort: 8888
restartPolicy: Never
---
apiVersion: v1
kind: Service
metadata:
name: gosbench-worker{{ worker+1 }}
labels:
app: gosbench-worker{{ worker+1 }}
spec:
type: NodePort
ports:
- port: 8888
targetPort: 8888
selector:
job-name: gosbench-worker{{ worker+1 }}
{% endfor %}
...
38 changes: 38 additions & 0 deletions k8s/monitoring.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,44 @@ data:
- targets:
- gosbench-worker1:8888
- gosbench-worker2:8888
- gosbench-worker3:8888
- gosbench-worker4:8888
- gosbench-worker5:8888
- gosbench-worker6:8888
- gosbench-worker7:8888
- gosbench-worker8:8888
- gosbench-worker9:8888
- gosbench-worker10:8888
- gosbench-worker11:8888
- gosbench-worker12:8888
- gosbench-worker13:8888
- gosbench-worker14:8888
- gosbench-worker15:8888
- gosbench-worker16:8888
- gosbench-worker17:8888
- gosbench-worker18:8888
- gosbench-worker19:8888
- gosbench-worker20:8888
- gosbench-worker21:8888
- gosbench-worker22:8888
- gosbench-worker23:8888
- gosbench-worker24:8888
- gosbench-worker25:8888
- gosbench-worker26:8888
- gosbench-worker27:8888
- gosbench-worker28:8888
- gosbench-worker29:8888
- gosbench-worker30:8888
- gosbench-worker31:8888
- gosbench-worker32:8888
- gosbench-worker33:8888
- gosbench-worker34:8888
- gosbench-worker35:8888
- gosbench-worker36:8888
- gosbench-worker37:8888
- gosbench-worker38:8888
- gosbench-worker39:8888
- gosbench-worker40:8888
metadata:
name: prom-config
labels:
Expand Down

0 comments on commit 2f18abe

Please sign in to comment.