apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: video-storage
  namespace: contoso-hypermarket
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi

---

apiVersion: apps/v1
kind: Deployment
metadata:
  name: rtsp-stream-aisle
  namespace: contoso-hypermarket
spec:
  replicas: 1
  selector:
    matchLabels:
      app: rtsp-stream-aisle
  template:
    metadata:
      labels:
        app: rtsp-stream-aisle
    spec:
      initContainers:
        - name: init-samples
          image: mcr.microsoft.com/cbl-mariner/base/core:2.0
          command: 
          - sh
          - -c
          - |
            tdnf update -y
            tdnf install wget -y
            wget -O /samples/sample.mp4 https://download.microsoft.com/download/b89058d8-f51e-4cb9-a4e0-ec6a85a39863/supermarket-aisle.mp4 --no-check-certificate 
          volumeMounts:
          - name: video-storage
            mountPath: /samples
      containers:
      - name: rtsp-stream-aisle
        image: kerberos/virtual-rtsp:latest
        ports:
        - containerPort: 8554
        env:
        - name: SOURCE_URL
          value: "file:///samples/sample.mp4"
        volumeMounts:
        - mountPath: /samples
          name: video-storage
      volumes:
      - name: video-storage
        persistentVolumeClaim:
          claimName: video-storage

---

apiVersion: v1
kind: Service
metadata:
  name: rtsp-stream-aisle
  namespace: contoso-hypermarket
spec:
  selector:
    app: rtsp-stream-aisle
  ports:
    - protocol: TCP
      port: 8554
      targetPort: 8554  
  type: LoadBalancer

---

apiVersion: apps/v1
kind: Deployment
metadata:
  name: rtsp-stream-zoom
  namespace: contoso-hypermarket
spec:
  replicas: 1
  selector:
    matchLabels:
      app: rtsp-stream-zoom
  template:
    metadata:
      labels:
        app: rtsp-stream-zoom
    spec:
      initContainers:
        - name: init-samples
          image: mcr.microsoft.com/cbl-mariner/base/core:2.0
          command: 
          - sh
          - -c
          - |
            tdnf update -y
            tdnf install wget -y
            wget -O /samples/sample.mp4 https://download.microsoft.com/download/b89058d8-f51e-4cb9-a4e0-ec6a85a39863/supermarket-zoom.mp4 --no-check-certificate
          volumeMounts:
          - name: video-storage
            mountPath: /samples
      containers:
      - name: rtsp-stream-zoom
        image: kerberos/virtual-rtsp:latest
        ports:
        - containerPort: 8554
        env:
        - name: SOURCE_URL
          value: "file:///samples/sample.mp4"
        volumeMounts:
        - mountPath: /samples
          name: video-storage
      volumes:
      - name: video-storage
        persistentVolumeClaim:
          claimName: video-storage

---

apiVersion: v1
kind: Service
metadata:
  name: rtsp-stream-zoom
  namespace: contoso-hypermarket
spec:
  selector:
    app: rtsp-stream-zoom
  ports:
    - protocol: TCP
      port: 8555
      targetPort: 8554  
  type: LoadBalancer