apiVersion: v1
kind: Pod
metadata:
  name: pod-name
  namespace: namespace-name
  labels:
    user: CICV
spec:
  nodeName: node-name
  dnsPolicy: None
  dnsConfig:
    nameservers:
      - 10.16.11.1
      - 10.16.11.2
  hostAliases:
    - ip: 10.14.85.239
      hostnames:
        - simulation004
    - ip: 10.14.85.237
      hostnames:
        - gpu001
  initContainers:
    - name: initAlgorithmImageContainer
      image: algorithm-image
      imagePullPolicy: Always
      command: [ 'sh', '-c', 'echo algorithm image downloaded && sleep 2' ]
  containers:
    - name: vtd-container
      image: vtd-image
      imagePullPolicy: Never
      command: [ "/Controller/VTDController", "vtd-command", "kafka-topic" ]
      env:
        - name: PodName
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
        - name: LM_LICENSE_FILE
          value: 27500@10.14.85.247
        - name: SIMULATION_CLOUD_IP
          value: simulation-cloud-ip
        - name: KAFKA_IP
          value: kafka-ip
        - name: MINIO_IP
          value: minio-ip
        - name: MINIO_ACCESS_KEY
          value: minio-access-key
        - name: MINIO_SECRET_KEY
          value: minio-secret-key
        - name: KAFKA_PARTITION
          value: kafka-partition
        - name: KAFKA_OFFSET
          value: kafka-offset
        - name: CPU_ORDER
          value: cpu-order
      volumeMounts:
        - name: nvidia0
          mountPath: /dev/nvidia0
        - name: nvidiactl
          mountPath: /dev/nvidiactl
      securityContext:
        privileged: true
    - name: algorithm-container
      image: algorithm-image
      imagePullPolicy: Always
      command: [ "/bin/sh", "-c", "/run.sh; touch /tmp/hello.txt;while true;do /bin/echo $(date +%T) >> /tmp/hello.txt; sleep 600; done;" ]
    - name: carsim-container
      image: carsim-image
      imagePullPolicy: Always
      command: [ "carsim-command" ]
      env:
        - name: LICENSE_IP
          value: 10.14.85.247
        - name: SIM_FILE
          value: /root/result/simfile.sim
        - name: PATH_DLL
          value: /root/libcarsim.so
        - name: ENDPOINT
          value: minio-ip
        - name: ACCESSKEYID
          value: minio-access-key
        - name: SECRETACCESSKEY
          value: minio-secret-key
        - name: BUCKETNAME
          value: minio-bucket
        - name: LOG_DIR
          value: log
        - name: PAR_PATH
          value: par-path
        - name: LOG_PATH
          value: log/carsim.log
      ports:
        - name: carsimport
          containerPort: 8888
#      resources:
#        requests:
#          cpu: "1"
#          memory: "2Gi"
  restartPolicy: Never
  volumes:
    - name: nvidia0
      hostPath:
        path: /dev/nvidia0
    - name: nvidiactl
      hostPath:
        path: /dev/nvidiactl
