apiVersion: apps/v1
kind: Deployment

metadata:
  name: $COMPONENT
  labels:
    app.kubernetes.io/name: $COMPONENT
    app.kubernetes.io/instance: $COMPONENT
    app.kubernetes.io/version: $VERSION
    app.kubernetes.io/component: 5g
    app.kubernetes.io/part-of: ueransim
    app.kubernetes.io/managed-by: ueransim

spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: $COMPONENT
      app.kubernetes.io/instance: $COMPONENT
      app.kubernetes.io/version: $VERSION
      app.kubernetes.io/component: 5g
  template:
    metadata:
      labels:
        app.kubernetes.io/name: $COMPONENT
        app.kubernetes.io/instance: $COMPONENT
        app.kubernetes.io/version: $VERSION
        app.kubernetes.io/component: 5g
        app.kubernetes.io/part-of: ueransim
        app.kubernetes.io/managed-by: ueransim
    spec:
      hostname: ${COMPONENT}-1
      subdomain: ueransim
      containers:
      - name: main 
        image: $IMAGE
        imagePullPolicy: Always
        volumeMounts: 
          - name: ${COMPONENT}-cfg 
            mountPath: /UERANSIM/config/${COMPONENT}.yaml
            subPath: ${COMPONENT}.yaml
        env:
          - name: COMPONENT
            value: $COMPONENT
        securityContext:
          capabilities:
            add:
            - "NET_RAW" # enables "ping"
            - "NET_ADMIN" # enabled access to "/dev/net/tun" (not enough)
          privileged: true # HACK to enable "/dev/net/tun"
      volumes:
      - name: ${COMPONENT}-cfg
        configMap:
          name: $COMPONENT
