Skip to content

Instantly share code, notes, and snippets.

@brunnels
Last active July 14, 2023 09:05
Show Gist options
  • Save brunnels/b25db004d220d2d83f0ea54becc83da7 to your computer and use it in GitHub Desktop.
Save brunnels/b25db004d220d2d83f0ea54becc83da7 to your computer and use it in GitHub Desktop.
apiVersion: v1
kind: ConfigMap
metadata:
name: pulse-audio-config
namespace: gow
data:
default.pa: |-
.fail
load-module module-null-sink sink_name=sunshine
set-default-sink sunshine
load-module module-native-protocol-unix auth-anonymous=1 socket=/tmp/pulse/pulse-socket
client.conf: |-
default-sink = sink-sunshine-stereo
autospawn = no
daemon-binary = /bin/true
daemon.conf: |-
exit-idle-time = -1
flat-volumes = yes
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
labels:
pvc: retroarch
name: retroarch
namespace: gow
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 50Gi
# storageClassName: longhorn-retain
volumeMode: Filesystem
apiVersion: apps/v1
kind: Deployment
metadata:
name: retroarch
namespace: gow
labels:
app.kubernetes.io/instance: retroarch
app.kubernetes.io/name: retroarch
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/instance: retroarch
app.kubernetes.io/name: retroarch
strategy:
type: Recreate
template:
metadata:
labels:
app.kubernetes.io/instance: retroarch
app.kubernetes.io/name: retroarch
spec:
volumes:
- name: dev-input
hostPath:
path: /dev/input
- name: udev
hostPath:
path: /run/udev
- name: xorg
hostPath:
path: /tmp/.X11-unix
- name: var-log
hostPath:
path: /var/log
- name: audio-socket
hostPath:
path: /tmp/pulse
- name: home-retro
persistentVolumeClaim:
claimName: retroarch
- name: pulse-conf
configMap:
name: pulse-audio-config
items:
- key: default.pa
path: default.pa
- key: client.conf
path: client.conf
- key: daemon.conf
path: daemon.conf
# nodeSelector:
# nvidia.com/gtx970_gpu: "true"
# gpu.intel.com/i915: "true"
hostNetwork: true
initContainers:
- command:
- sh
- -c
- mkdir -p /home-retro/sunshine && chown 1000:1000 /home-retro/sunshine && mkdir -p /home-retro/retroarch && chown 1000:1000 /home-retro/retroarch
image: busybox:1.31.1
imagePullPolicy: IfNotPresent
name: mk-home-retro-dirs
volumeMounts:
- mountPath: /home-retro
name: home-retro
containers:
- name: xorg
image: gameonwhales/xorg:latest
securityContext:
privileged: true
env:
- name: DISPLAY
value: :99
- name: REFRESH_RATE
value: "60"
- name: RESOLUTION
value: "1920x1080"
volumeMounts:
- name: dev-input
mountPath: /dev/input
readOnly: true
- name: udev
mountPath: /run/udev
readOnly: true
- name: xorg
mountPath: /tmp/.X11-unix
- name: var-log
mountPath: /var/log
- name: pulseaudio
image: gameonwhales/pulseaudio:latest
volumeMounts:
- name: audio-socket
mountPath: /tmp/pulse
- name: pulse-conf
mountPath: /etc/pulse
- name: sunshine
image: gameonwhales/sunshine:latest
securityContext:
privileged: true
ports:
- containerPort: 48010
protocol: TCP
hostPort: 48010
- containerPort: 47984
protocol: TCP
hostPort: 47984
- containerPort: 47985
protocol: TCP
hostPort: 47985
- containerPort: 47986
protocol: TCP
hostPort: 47986
- containerPort: 47987
protocol: TCP
hostPort: 47987
- containerPort: 47988
protocol: TCP
hostPort: 47988
- containerPort: 47989
protocol: TCP
hostPort: 47989
- containerPort: 47990
protocol: TCP
hostPort: 47990
- containerPort: 47998
protocol: UDP
hostPort: 47998
- containerPort: 47999
protocol: UDP
hostPort: 47999
- containerPort: 48000
protocol: UDP
hostPort: 48000
readinessProbe:
failureThreshold: 3
periodSeconds: 10
successThreshold: 1
tcpSocket:
port: 47990
timeoutSeconds: 1
env:
- name: DISPLAY
value: :99
- name: LOG_LEVEL
value: info
- name: PULSE_SERVER
value: "/tmp/pulse/pulse-socket"
- name: SUNSHINE_PASS
value: admin
- name: SUNSHINE_USER
value: admin
- name: GOW_REQUIRED_DEVICES
value: "/dev/uinput /dev/input/event* /dev/dri/*"
- name: XDG_RUNTIME_DIR
value: "/tmp/.X11-unix"
volumeMounts:
- name: audio-socket
mountPath: /tmp/pulse
- name: udev
mountPath: /run/udev
readOnly: true
- name: xorg
mountPath: /tmp/.X11-unix
- name: home-retro
mountPath: /home/retro/
subPath: sunshine
- name: retroarch
securityContext:
privileged: true
env:
- name: DISPLAY
value: :99
- name: LOG_LEVEL
value: debug
- name: PULSE_SERVER
value: "/tmp/pulse/pulse-socket"
image: gameonwhales/retroarch:latest
volumeMounts:
- name: audio-socket
mountPath: /tmp/pulse
- name: dev-input
mountPath: /dev/input
readOnly: true
- name: udev
mountPath: /run/udev
readOnly: true
- name: xorg
mountPath: /tmp/.X11-unix
- name: home-retro
mountPath: /home/retro/
subPath: retroarch
apiVersion: v1
kind: Service
metadata:
name: retroarch-tcp
namespace: gow
spec:
externalTrafficPolicy: Cluster
type: LoadBalancer
ports:
- port: 48010
protocol: TCP
targetPort: 48010
name: sunshine
- port: 47984
protocol: TCP
targetPort: 47984
name: sunshine-tcp1
- port: 47985
protocol: TCP
targetPort: 47985
name: sunshine-tcp2
- port: 47986
protocol: TCP
targetPort: 47986
name: sunshine-tcp3
- port: 47987
protocol: TCP
targetPort: 47987
name: sunshine-tcp4
- port: 47988
protocol: TCP
targetPort: 47988
name: sunshine-tcp5
- port: 47989
protocol: TCP
targetPort: 47989
name: sunshine-tcp6
- port: 47990
protocol: TCP
targetPort: 47990
name: sunshine-tcp7
selector:
app.kubernetes.io/instance: retroarch
app.kubernetes.io/name: retroarch
---
apiVersion: v1
kind: Service
metadata:
name: retroarch-udp
namespace: gow
spec:
externalTrafficPolicy: Cluster
type: LoadBalancer
ports:
- port: 47998
protocol: UDP
targetPort: 47998
name: sunshine-udp1
- port: 47999
protocol: UDP
targetPort: 47999
name: sunshine-udp2
- port: 48000
protocol: UDP
targetPort: 48000
name: sunshine-udp3
selector:
app.kubernetes.io/instance: retroarch
app.kubernetes.io/name: retroarch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment