-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproxy-sidecar.yaml
More file actions
90 lines (88 loc) · 1.96 KB
/
proxy-sidecar.yaml
File metadata and controls
90 lines (88 loc) · 1.96 KB
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
apiVersion: v1
kind: Service
metadata:
name: app-svc
labels:
app: app
spec:
type: LoadBalancer
selector:
app: app
ports:
- name: http
port: 8080
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: app
labels:
app: app
spec:
selector:
matchLabels:
app: app
template:
metadata:
labels:
app: app
spec:
containers:
- name: app
image: nginx:latest
initContainers:
- name: proxy
image: memcached:alpine
restartPolicy: Always
args: ["-o", "proxy_config=routelib,proxy_arg=/etc/config.lua", "-vv"]
ports:
- containerPort: 11211
volumeMounts:
- name: proxy-config
mountPath: /etc/config.lua
subPath: config.lua
resources:
limits:
memory: "128Mi"
requests:
cpu: "50m"
memory: "32Mi"
livenessProbe:
tcpSocket:
port: 11211
readinessProbe:
tcpSocket:
port: 11211
volumes:
- name: proxy-config
configMap:
name: proxy-config
---
apiVersion: v1
kind: ConfigMap
metadata:
name: proxy-config
labels:
app: app
data:
config.lua: |
pools{
set_all = {
{ backends = { "memcached-0.memcached-headless.cache.svc.cluster.local:11211" } },
{ backends = { "memcached-1.memcached-headless.cache.svc.cluster.local:11211" } },
{ backends = { "memcached-2.memcached-headless.cache.svc.cluster.local:11211" } },
},
}
routes{
-- get command polls all servers and returns first response
cmap = {
get = route_allfastest{
children = "set_all",
miss = true, -- failover on miss
},
},
-- by default, send commands everywhere. ie; touch/set/delete
default = route_allsync{
children = "set_all",
},
}