-
Notifications
You must be signed in to change notification settings - Fork 0
/
worker-pool.yaml
66 lines (64 loc) · 1.65 KB
/
worker-pool.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
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: worker-pool
name: worker-pool
spec:
replicas: 1
selector:
matchLabels:
app: worker
template:
metadata:
labels:
app: worker
spec:
containers:
- name: worker
image: benhid/rediswq:0.1.0
imagePullPolicy: Always
env:
- name: REDIS_HOST
value: <redis-host>
- name: REDIS_PORT
value: "<redis-port>"
# When DinD, instruct Docker to use the network connection
# instead of the default /var/run/docker.sock socket.
- name: DOCKER_HOST
value: tcp://localhost:2375
- name: dind-daemon
image: docker:20.10.23-dind
imagePullPolicy: Always
securityContext:
privileged: true
env:
# Disabling TLS is not recommended for production use.
- name: DOCKER_TLS_CERTDIR
value: ""
volumeMounts:
- name: dind-storage
mountPath: /var/lib/docker
volumes:
- name: dind-storage
emptyDir: { }
---
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
name: scaled-worker-pool
spec:
scaleTargetRef:
name: worker-pool
pollingInterval: 60
cooldownPeriod: 60
minReplicaCount: 1
maxReplicaCount: 50
triggers:
- type: redis
metadata:
address: <redis-host>:<redis-port>
listName: job
listLength: "5" # Average target value to trigger scaling actions.
databaseIndex: "0" # optional
enableTLS: "false" # optional