apiVersion: apps/v1
kind: Deployment
metadata:
  name: starling-drones-vicon
  labels:
    app: starling
    platform: pixhawk

spec:
  selector:
    matchLabels:
      app: starling
  template:
    metadata:
      name: starling-drone-vicon
      labels:
        app: starling
        platform: pixhawk

    spec:
      hostNetwork: true
      shareProcessNamespace: true
      tolerations:
        - key: "starling.dev/type"
          operator: "Equal"
          value: "vehicle"
          effect: "NoSchedule"

      containers:

        - name: starling-mavros
          image: uobflightlabstarling/starling-mavros:latest
          imagePullPolicy: Always
          securityContext:
            privileged: true
          env:
          - name: MAVROS_TGT_FIRMWARE
            value: "px4"
          - name: MAVROS_TGT_SYSTEM
            value: "auto" # Look up on system /etc/drone.config
          - name: ROS_HOSTNAME # Required for ROS1 bridge in hostNetwork mode
            value: "localhost" # ROS1 will ping HOSTNAME, defaults to system hostname
          - name: ROS_MASTER_URI
            value: "http://localhost:11311"
          volumeMounts:
          - mountPath: /dev/px4fmu
            name: ttypx4
          - mountPath: /etc/starling/vehicle.config
            name: vehicleconfig
            readOnly: true

        - name: starling-vicon
          image: uobflightlabstarling/starling-vicon:latest
          imagePullPolicy: Always
          ports:
          - containerPort: 51001
            protocol: UDP
          volumeMounts:
          - mountPath: /etc/starling/vehicle.config
            name: vehicleconfig
            readOnly: true

      volumes:
      - name: ttypx4
        hostPath:
          path: /dev/px4fmu
      - name: vehicleconfig
        hostPath:
          path: /etc/starling/vehicle.config
          type: File

      nodeSelector:
        kubernetes.io/arch: arm64
        starling.dev/type: vehicle
