-
Notifications
You must be signed in to change notification settings - Fork 5
/
master-deployment.yaml
135 lines (123 loc) · 3.05 KB
/
master-deployment.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
kind: Template
apiVersion: v1
labels:
template: "locust"
metadata:
name: locust-master
objects:
- kind: Service
apiVersion: v1
metadata:
name: locust
namespace: ${NAMESPACE}
spec:
selector:
app: locust-master
ports:
- name: "communication"
protocol: TCP
port: 5557
- name: "communication-plus-1"
protocol: TCP
port: 5558
- name: "web-ui"
protocol: TCP
port: 8089
type: LoadBalancer
- apiVersion: route.openshift.io/v1
kind: Route
metadata:
name: app
spec:
port:
targetPort: web-ui
to:
kind: Service
name: locust
weight: 100
wildcardPolicy: None
- kind: DeploymentConfig
apiVersion: v1
metadata:
name: locust-master
namespace: ${NAMESPACE}
spec:
replicas: 1
template:
metadata:
labels:
app: locust-master
spec:
containers:
- name: locust-master
image: ${LOCUST_IMAGE}
env:
- name: CONFIG_HASH
value: TO_BE_CHANGED
- name: ATTACKED_HOST
valueFrom:
configMapKeyRef:
name: host-url
key: ATTACKED_HOST
- name: LOCUST_MODE
value: MASTER
- name: LOCUST_OPTS
value: --print-stats -P=8089
resources:
limits:
cpu: "100m"
memory: "256Mi"
ports:
- name: comm
containerPort: 5557
- name: comm-plus-1
containerPort: 5558
- name: web-ui
containerPort: 8089
volumeMounts:
- name: locust-scripts
mountPath: /locust
readOnly: true
dnsPolicy: ClusterFirst
restartPolicy: Always
securityContext:
privileged: false
volumes:
- name: locust-scripts
configMap:
name: script-file
- kind: ConfigMap
apiVersion: v1
metadata:
name: script-file
namespace: ${NAMESPACE}
data:
locustfile.py: |
from locust import HttpLocust, TaskSet, task
class UserTasks(TaskSet):
@task
def index(self):
self.client.get("/")
@task
def stats(self):
self.client.get("/stats/requests")
class WebsiteUser(HttpLocust):
task_set = UserTasks
- kind: ConfigMap
apiVersion: v1
metadata:
name: host-url
namespace: ${NAMESPACE}
data:
ATTACKED_HOST: http://locust-master:8089
parameters:
- name: NAMESPACE
displayName: Namespace
description: Namespace where the Locust is running
value: locust
required: true
- name: LOCUST_IMAGE
displayName: Locust docker image
description: Name of the image to be used.
value: grubykarol/locust:0.13.5-python3.8-alpine3.11
required: true