apiVersion: apps/v1
kind: Deployment
metadata:
  name: plugin-deploy
  labels:
    app: plugin-app
spec:
  replicas: 1
  selector:
    matchLabels:
      app: plugin-app
  template:
    metadata:
      labels:
        app: plugin-app
        pool: WEX5
      annotations:
        sidecar.istio.io/inject: 'false'
        traffic.sidecar.istio.io/excludeOutboundIPRanges: 0.0.0.0/0
    spec:
      nodeSelector:
        node-role.kubernetes.io/pool: 
      tolerations:
      - key: node-role.kubernetes.io/pool
        value: 'true'
        effect: NoExecute
      volumes:
      - name: model-cache-volume
        hostPath:
          path: /model-cache
      - name: model-volume
        emptyDir: {}
      - name: model-user-volume
        emptyDir: {}
      - name: conf-volume
        emptyDir: {}
      - name: dist-volume
        emptyDir: {}
      - name: storage-volume
        emptyDir: {}
      - name: storage-nas-volume
        persistentVolumeClaim:
          claimName: test-storage-nas
      - name: storage2-nas-volume
        persistentVolumeClaim:
          claimName: test-storage2-nas
      - name: logs-volume
        emptyDir: {}
      containers:
      - name: app-init
        image: hub.newdao.local/justep/app-init:1.0
        imagePullPolicy: Always
        env:
        - name: POOL_TYPE
          value: WEX5
        - name: SERVICE_MODE
          value: 'false'
        - name: DEPLOY_TYPE
          value: test
        - name: INGRESS_PROTOCOL
          value: http
        - name: INGRESS_PORT
          value: 80
        - name: CLOUD_OPT_CREDENTIAL_TOKEN
          value: MDdmNDBiOTFiNjFkZWE2ZTFjZDcyZT
        - name: NAMESPACE_PREFIX
          valueFrom:
            configMapKeyRef:
              name: basic.conf
              key: NAMESPACE_PREFIX
        - name: CONSOLE_NAMESPACE
          valueFrom:
            configMapKeyRef:
              name: basic.conf
              key: CONSOLE_NAMESPACE
        - name: COMMON_NAMESPACE
          valueFrom:
            configMapKeyRef:
              name: basic.conf
              key: COMMON_NAMESPACE
        - name: IDE_JOB_NAMESPACE
          valueFrom:
            configMapKeyRef:
              name: basic.conf
              key: IDE_JOB_NAMESPACE
        - name: IDE_NAMESPACE
          valueFrom:
            configMapKeyRef:
              name: basic.conf
              key: IDE_NAMESPACE
        - name: TEST_NAMESPACE
          valueFrom:
            configMapKeyRef:
              name: basic.conf
              key: TEST_NAMESPACE
        - name: PROD_NAMESPACE
          valueFrom:
            configMapKeyRef:
              name: basic.conf
              key: PROD_NAMESPACE
        - name: BASE_DOMAIN
          valueFrom:
            configMapKeyRef:
              name: basic.conf
              key: APP_DOMAIN
        - name: REDIS_HOST
          valueFrom:
            secretKeyRef:
              name: redis-secret
              key: REDIS_HOST
        - name: REDIS_PORT
          valueFrom:
            secretKeyRef:
              name: redis-secret
              key: REDIS_PORT
        - name: REDIS_PASSWD
          valueFrom:
            secretKeyRef:
              name: redis-secret
              key: REDIS_PASSWD
        - name: NEXUS_HOST
          valueFrom:
            secretKeyRef:
              name: nexus3-secret
              key: NEXUS_HOST
        - name: NEXUS_USER
          valueFrom:
            secretKeyRef:
              name: nexus3-secret
              key: NEXUS_USER
        - name: NEXUS_PASSWD
          valueFrom:
            secretKeyRef:
              name: nexus3-secret
              key: NEXUS_PASSWD
        - name: MINIO_ACCESS_KEY
          valueFrom:
            secretKeyRef:
              name: minio-secret
              key: MINIO_ACCESS_KEY
        - name: MINIO_SECRET_KEY
          valueFrom:
            secretKeyRef:
              name: minio-secret
              key: MINIO_SECRET_KEY
        - name: POD_NAME
          valueFrom:
            fieldRef:
              apiVersion: v1
              fieldPath: metadata.name
        - name: POD_IP
          valueFrom:
            fieldRef:
              apiVersion: v1
              fieldPath: status.podIP
        - name: NAMESPACE
          valueFrom:
            fieldRef:
              apiVersion: v1
              fieldPath: metadata.namespace
        volumeMounts:
        - mountPath: /usr/local/x5/model-cache
          name: model-cache-volume
        - mountPath: /usr/local/x5/model
          name: model-volume
        - mountPath: /usr/local/x5/model-user
          name: model-user-volume
        - mountPath: /usr/local/x5/conf
          name: conf-volume
        - mountPath: /usr/local/x5/logs
          name: logs-volume
        - mountPath: /dist
          name: dist-volume
        - mountPath: /storage
          name: storage-volume
        - mountPath: /_volume/storage
          name: storage-nas-volume
        - mountPath: /_volume/storage2
          name: storage2-nas-volume
        resources:
          requests:
            cpu: 1m
            memory: 1Mi
          limits:
            cpu: '1'
            memory: 1Gi
      - name: migration
        image: hub.newdao.local/justep/migration:1.0
        imagePullPolicy: Always
        env:
        - name: NAMESPACE_PREFIX
          valueFrom:
            configMapKeyRef:
              name: basic.conf
              key: NAMESPACE_PREFIX
        - name: COMMON_NAMESPACE
          valueFrom:
            configMapKeyRef:
              name: basic.conf
              key: COMMON_NAMESPACE
        volumeMounts:
        - mountPath: /usr/local/x5/model-cache
          name: model-cache-volume
        - mountPath: /usr/local/x5/model
          name: model-volume
        - mountPath: /usr/local/x5/model-user
          name: model-user-volume
        - mountPath: /usr/local/x5/conf
          name: conf-volume
        - mountPath: /usr/local/x5/logs
          name: logs-volume
        - mountPath: /dist
          name: dist-volume
        - mountPath: /storage
          name: storage-volume
        - mountPath: /_volume/storage
          name: storage-nas-volume
        - mountPath: /_volume/storage2
          name: storage2-nas-volume
        resources:
          requests:
            cpu: 1m
            memory: 1Mi
          limits:
            cpu: '1'
            memory: 512Mi
      - name: gateway
        image: hub.newdao.local/justep/kong:2.7.1
        imagePullPolicy: Always
        env:
        - name: PGDB_IS_CUSTOM
          value: 'false'
        - name: PIPE_NAME
          value: agent-pipe
        - name: NAMESPACE_PREFIX
          valueFrom:
            configMapKeyRef:
              name: basic.conf
              key: NAMESPACE_PREFIX
        - name: COMMON_NAMESPACE
          valueFrom:
            configMapKeyRef:
              name: basic.conf
              key: COMMON_NAMESPACE
        ports:
        - containerPort: 80
          name: http-port
          protocol: TCP
        - containerPort: 8443
          name: https-port
          protocol: TCP
        - containerPort: 8001
          name: mgmt-port
          protocol: TCP
        volumeMounts:
        - mountPath: /usr/local/x5/model-cache
          name: model-cache-volume
        - mountPath: /usr/local/x5/model
          name: model-volume
        - mountPath: /usr/local/x5/model-user
          name: model-user-volume
        - mountPath: /usr/local/x5/conf
          name: conf-volume
        - mountPath: /usr/local/x5/logs
          name: logs-volume
        - mountPath: /dist
          name: dist-volume
        - mountPath: /storage
          name: storage-volume
        - mountPath: /_volume/storage
          name: storage-nas-volume
        - mountPath: /_volume/storage2
          name: storage2-nas-volume
        resources:
          requests:
            cpu: 1m
            memory: 1Mi
          limits:
            cpu: '1'
            memory: 512Mi
      - name: tomcat
        image: hub.newdao.local/justep/tomcat:8
        imagePullPolicy: Always
        env:
        - name: JAVA_OPTS
          value: -XX:MaxRAMPercentage=75.0 -XX:MaxMetaspaceSize=300m -Djava.security.egd=file:/dev/./urandom
        - name: INGRESS_PROTOCOL
          value: http
        - name: INGRESS_PORT
          value: 80
        - name: NAMESPACE_PREFIX
          valueFrom:
            configMapKeyRef:
              name: basic.conf
              key: NAMESPACE_PREFIX
        - name: CONSOLE_NAMESPACE
          valueFrom:
            configMapKeyRef:
              name: basic.conf
              key: CONSOLE_NAMESPACE
        - name: COMMON_NAMESPACE
          valueFrom:
            configMapKeyRef:
              name: basic.conf
              key: COMMON_NAMESPACE
        - name: DEPLOY_TYPE
          value: test
        ports:
        - containerPort: 8080
          protocol: TCP
        volumeMounts:
        - mountPath: /usr/local/x5/model-cache
          name: model-cache-volume
        - mountPath: /usr/local/x5/model
          name: model-volume
        - mountPath: /usr/local/x5/model-user
          name: model-user-volume
        - mountPath: /usr/local/x5/conf
          name: conf-volume
        - mountPath: /usr/local/x5/logs
          name: logs-volume
        - mountPath: /dist
          name: dist-volume
        - mountPath: /storage
          name: storage-volume
        - mountPath: /_volume/storage
          name: storage-nas-volume
        - mountPath: /_volume/storage2
          name: storage2-nas-volume
        resources:
          requests:
            cpu: 250m
            memory: 1Gi
          limits:
            cpu: '2'
            memory: 2Gi
      - name: java-runtime
        image: hub.newdao.local/justep/java-runtime:8-jre
        imagePullPolicy: Always
        env: null
        volumeMounts:
        - mountPath: /usr/local/x5/model-cache
          name: model-cache-volume
        - mountPath: /usr/local/x5/model
          name: model-volume
        - mountPath: /usr/local/x5/model-user
          name: model-user-volume
        - mountPath: /usr/local/x5/conf
          name: conf-volume
        - mountPath: /usr/local/x5/logs
          name: logs-volume
        - mountPath: /dist
          name: dist-volume
        - mountPath: /storage
          name: storage-volume
        - mountPath: /_volume/storage
          name: storage-nas-volume
        - mountPath: /_volume/storage2
          name: storage2-nas-volume
        resources:
          requests:
            cpu: 1m
            memory: 1Mi
          limits:
            cpu: '1'
            memory: 1024Mi
      - name: node-runtime
        image: hub.newdao.local/justep/node-runtime:12
        imagePullPolicy: Always
        env: null
        volumeMounts:
        - mountPath: /usr/local/x5/model-cache
          name: model-cache-volume
        - mountPath: /usr/local/x5/model
          name: model-volume
        - mountPath: /usr/local/x5/model-user
          name: model-user-volume
        - mountPath: /usr/local/x5/conf
          name: conf-volume
        - mountPath: /usr/local/x5/logs
          name: logs-volume
        - mountPath: /dist
          name: dist-volume
        - mountPath: /storage
          name: storage-volume
        - mountPath: /_volume/storage
          name: storage-nas-volume
        - mountPath: /_volume/storage2
          name: storage2-nas-volume
        resources:
          requests:
            cpu: 1m
            memory: 1Mi
          limits:
            cpu: '1'
            memory: 1Gi
      - name: bin-runtime
        image: hub.newdao.local/justep/bin-runtime:1.0
        imagePullPolicy: Always
        env: null
        volumeMounts:
        - mountPath: /usr/local/x5/model-cache
          name: model-cache-volume
        - mountPath: /usr/local/x5/model
          name: model-volume
        - mountPath: /usr/local/x5/model-user
          name: model-user-volume
        - mountPath: /usr/local/x5/conf
          name: conf-volume
        - mountPath: /usr/local/x5/logs
          name: logs-volume
        - mountPath: /dist
          name: dist-volume
        - mountPath: /storage
          name: storage-volume
        - mountPath: /_volume/storage
          name: storage-nas-volume
        - mountPath: /_volume/storage2
          name: storage2-nas-volume
        resources:
          requests:
            cpu: 1m
            memory: 1Mi
          limits:
            cpu: '1'
            memory: 1Gi
      - name: comp-dotnet-runtime
        image: hub.newdao.local/justep/dotnet-runtime:5
        imagePullPolicy: Always
        env: null
        volumeMounts:
        - mountPath: /usr/local/x5/model-cache
          name: model-cache-volume
        - mountPath: /usr/local/x5/model
          name: model-volume
        - mountPath: /usr/local/x5/model-user
          name: model-user-volume
        - mountPath: /usr/local/x5/conf
          name: conf-volume
        - mountPath: /usr/local/x5/logs
          name: logs-volume
        - mountPath: /dist
          name: dist-volume
        - mountPath: /storage
          name: storage-volume
        - mountPath: /_volume/storage
          name: storage-nas-volume
        - mountPath: /_volume/storage2
          name: storage2-nas-volume
        resources:
          requests:
            cpu: 1m
            memory: 1Mi
          limits:
            cpu: '1'
            memory: 1024Mi
      - name: comp-nginx-runtime
        image: hub.newdao.local/justep/nginx-runtime:1.15
        imagePullPolicy: Always
        env: null
        volumeMounts:
        - mountPath: /usr/local/x5/model-cache
          name: model-cache-volume
        - mountPath: /usr/local/x5/model
          name: model-volume
        - mountPath: /usr/local/x5/model-user
          name: model-user-volume
        - mountPath: /usr/local/x5/conf
          name: conf-volume
        - mountPath: /usr/local/x5/logs
          name: logs-volume
        - mountPath: /dist
          name: dist-volume
        - mountPath: /storage
          name: storage-volume
        - mountPath: /_volume/storage
          name: storage-nas-volume
        - mountPath: /_volume/storage2
          name: storage2-nas-volume
        resources:
          requests:
            cpu: 1m
            memory: 1Mi
          limits:
            cpu: '1'
            memory: 512Mi
      - name: comp-ubuntu-runtime
        image: hub.newdao.local/justep/ubuntu-runtime:18.04
        imagePullPolicy: Always
        env: null
        volumeMounts:
        - mountPath: /usr/local/x5/model-cache
          name: model-cache-volume
        - mountPath: /usr/local/x5/model
          name: model-volume
        - mountPath: /usr/local/x5/model-user
          name: model-user-volume
        - mountPath: /usr/local/x5/conf
          name: conf-volume
        - mountPath: /usr/local/x5/logs
          name: logs-volume
        - mountPath: /dist
          name: dist-volume
        - mountPath: /storage
          name: storage-volume
        - mountPath: /_volume/storage
          name: storage-nas-volume
        - mountPath: /_volume/storage2
          name: storage2-nas-volume
        resources:
          requests:
            cpu: 1m
            memory: 1Mi
          limits:
            cpu: '1'
            memory: 512Mi
