-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathwes-audio-server.yaml
94 lines (94 loc) · 2.63 KB
/
wes-audio-server.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
apiVersion: v1
kind: Service
metadata:
name: wes-audio-server
spec:
selector:
app: wes-audio-server
ports:
- name: pulseaudio
protocol: TCP
port: 4713
targetPort: 4713
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: wes-audio-server
spec:
selector:
matchLabels:
app: wes-audio-server
template:
metadata:
labels:
app: wes-audio-server
spec:
priorityClassName: wes-high-priority
nodeSelector:
resource.microphone: "true"
containers:
- name: wes-audio-server
image: waggle/wes-audio-server:0.3.0
imagePullPolicy: IfNotPresent
resources:
limits:
memory: 20Mi
requests:
cpu: 200m
memory: 20Mi
ports:
- containerPort: 4713
securityContext:
privileged: true
# NOTE The main purpose of this service is the multiplex the usb microphone
# so I use a liveness probe to tie the health of this service to whether a
# usb microphone is available.
#
# NOTE I am *not* using a readiness probe because I haven't found a way to
# get kuberetes to "hand off" ownership of the mic when updating the service.
# Basically, Kubernetes uses a readiness probe to decide when a Pod is ready
# to receive traffic. During an update it does a swicth:
#
# /[A]
# [svc]
# [B waiting for readiness probe...]
#
# [A terminating...]
# [svc]
# \[B ready!]
#
# Unfortunately, if "A" is kept alive in this case, it holds onto the mic causing
# it to appear busy. This may not be a big deal, but I just wanted to document how
# what's usually the right behavior affects this service a little differently.
livenessProbe:
exec:
command:
- "/bin/sh"
- "-c"
- "pactl list sources | grep -q 'USB Audio'"
initialDelaySeconds: 5
periodSeconds: 5
failureThreshold: 1
# TODO(sean) use device plugin to run on all devices with microphones
---
# NOTE this configmap will be mounted into plugins at /etc/asound.conf by runplugin
# so they expect a pulseaudio backend.
apiVersion: v1
kind: ConfigMap
metadata:
name: wes-audio-server-plugin-conf
data:
asound.conf: |
pcm.pulse {
type pulse
}
ctl.pulse {
type pulse
}
pcm.!default {
type pulse
}
ctl.!default {
type pulse
}