Skip to content

Instantly share code, notes, and snippets.

@SeanHood
Last active September 21, 2019 13:20
Show Gist options
  • Save SeanHood/27c3180a09c0c48ad4a1b534be995b80 to your computer and use it in GitHub Desktop.
Save SeanHood/27c3180a09c0c48ad4a1b534be995b80 to your computer and use it in GitHub Desktop.
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: tvmosaic
namespace: dvb
labels:
app: tvmosaic
annotations:
flux.weave.works/automated: "true"
flux.weave.works/tag.tvmosaic: semver:~1.0
spec:
strategy:
rollingUpdate:
maxUnavailable: 0
type: RollingUpdate
selector:
matchLabels:
app: tvmosaic
revisionHistoryLimit: 2
template:
metadata:
labels:
app: tvmosaic
spec:
containers:
- name: tvmosaic
image: dvblogic/tvmosaic:1.0.0.17707
imagePullPolicy: Always
securityContext:
privileged: true
volumeMounts:
- mountPath: /dev/bus/usb
name: devbususb
- mountPath: /opt/TVMosaic
name: tvmosaic-data
ports:
- containerPort: 9270
name: http-command
protocol: TCP
- containerPort: 9271
name: http-stream
protocol: TCP
livenessProbe:
httpGet:
path: /web
port: 9270
readinessProbe:
httpGet:
path: /web
port: 9270
resources:
limits:
cpu: 1000m
memory: 512Mi
requests:
cpu: 10m
memory: 128Mi
- name: sidecar
image: nginx:1.16
volumeMounts:
- name: nginx-conf
mountPath: /etc/nginx/
ports:
- containerPort: 80
name: http
protocol: TCP
volumes:
- name: devbususb
hostPath:
path: /dev/bus/usb
- name: tvmosaic-data
hostPath:
path: /data/tvmosaic
- name: nginx-conf
configMap:
name: nginx-conf
items:
- key: nginx.conf
path: nginx.conf
# ---
# apiVersion: v1
# kind: Service
# metadata:
# name: tvmosaic-stream
# namespace: dvb
# labels:
# app: tvmosaic
# spec:
# type: LoadBalancer
# selector:
# app: tvmosaic
# ports:
# - name: http-command
# port: 9270
# protocol: TCP
# - name: http-stream
# port: 9271
# protocol: TCP
---
apiVersion: v1
kind: Service
metadata:
name: tvmosaic
namespace: dvb
labels:
app: tvmosaic
spec:
type: ClusterIP
selector:
app: tvmosaic
ports:
- name: http-command
port: 80
protocol: TCP
- name: http-stream
port: 9271
protocol: TCP
---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: tvmosaic-ingress
namespace: dvb
annotations:
traefik.ingress.kubernetes.io/rule-type: PathPrefix
labels:
app: tvmosaic
spec:
rules:
- host: tvmosaic.cluster
http:
paths:
- path: /
backend:
serviceName: tvmosaic
servicePort: 80
- path: /stream
backend:
serviceName: tvmosaic
servicePort: 9271
---
apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-conf
namespace: dvb
data:
nginx.conf: |
events {
worker_connections 1024;
accept_mutex off;
}
http {
default_type application/octet-stream;
sendfile on;
server {
listen 80;
location / {
proxy_set_header Accept-Encoding "";
sub_filter_types application/json text/xml;
sub_filter ':9271/' '/';
sub_filter_once on;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://localhost:9270/;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment