kind: Deployment
apiVersion: apps/v1
metadata:
  name: volcano-controllers
  namespace: volcano-system
  labels:
    app: volcano-controller
spec:
  replicas: 1
  selector:
    matchLabels:
      app: volcano-controller
  template:
    metadata:
      labels:
        app: volcano-controller
      ##### For Kubernetes versions lower than 1.19, seccomp is used with annotations.
      annotations:
        seccomp.security.alpha.kubernetes.io/pod: runtime/default
    spec:
      affinity:
        podAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
          - labelSelector:
              matchExpressions:
              - key: app
                operator: In
                values:
                - "npu-operator"
            topologyKey: "kubernetes.io/hostname"
            namespaceSelector: {}
      nodeSelector:
        masterselector: dls-master-node
      serviceAccount: volcano-controllers
      securityContext:
        fsGroup: 9000
        ##### For Kubernetes version 1.19 and above, seccomp is used with securityContext:seccompProfile
        seccompProfile:
          type: RuntimeDefault
      initContainers:
        - name: init-permission
          image: "FILLED_BY_OPERATOR"
          command:
            - sh
            - -c
            - |
              sudo 
              chown 9000:9000 /var/log/mindx-dl /var/log/mindx-dl/volcano-controller
              chmod 750 /var/log/mindx-dl/volcano-controller
          volumeMounts:
            - mountPath: /var/log/mindx-dl/volcano-controller
              name: device-volcanocontroller
          securityContext:
            runAsUser: 0
            runAsGroup: 0
      containers:
        - name: volcano-controllers
          image: "FILLED_BY_OPERATOR"
          imagePullPolicy: "Always"
          command: [ "/bin/ash" ]
          args: ["FILLED_BY_OPERATOR"]
          resources:
            requests:
              memory: 3Gi
              cpu: 2000m
            limits:
              memory: 3Gi
              cpu: 2000m
          securityContext:
            allowPrivilegeEscalation: false
            readOnlyRootFilesystem: true
            runAsUser: 9000
            runAsGroup: 9000
            capabilities:
              drop: [ "ALL" ]
          volumeMounts:
            - name: device-volcanocontroller
              mountPath: /var/log/mindx-dl/volcano-controller
            - name: localtime
              mountPath: /etc/localtime
              readOnly: true
      volumes:
        - name: device-volcanocontroller
          hostPath:
            path: /var/log/mindx-dl/volcano-controller
        - name: localtime
          hostPath:
            path: /etc/localtime