apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: pu-printer-v1x0x1
  name: pu-printer-v1x0x1
  namespace: zhxy
spec:
  replicas: 1
  selector:
    matchLabels:
      app: pu-printer-v1x0x1
  template:
    metadata:
      labels:
        app: pu-printer-v1x0x1
    spec:
      hostAliases:
        - ip: "175.27.243.90"
          hostnames:
            - "printer.etongai.com"
      containers:
      - env:
        - name: TZ
          value: Asia/Shanghai
        - name: I18N
          value: cn
        - name: SERVE
          value: '1'
        - name: IN_K8S
          value: '1'
        - name: AUTHOR
          value: alex.c
        - name: GIT_COMMIT
          value: 7c6b73ce4c66cae31613310261449b1fbf97e1b6
        - name: DAL_ENV
          value: test
        - name: DAL_SPACE
          value: zhxy
        - name: LOG_LEVEL
          value: debug
        - name: LOG_DIR
          value: /var/log/daline
        - name: TEMP_FOLDER
          value: /tmp
        - name: NFS_FOLDER
          value: /var/store/nfs
        - name: HTTP_FOLDER
          value: /var/store/http
        - name: HTTP_BASE_URL
          value: /httpstore/alex.c/pu_printer/1_0_1/
        - name: HTTPSTORE_BASE_URL
          value: /httpstore/alex.c/pu_printer/1_0_1/
        - name: RUN_MODE
          value: run
        image: dockerhub.daline.com.cn/pu_printer_7c6b73c:1.0.1
        name: pu-printer-v1x0x1
        ports:
        - containerPort: 8080
          name: http
        - containerPort: 8081
          name: websocket
        volumeMounts:
        - mountPath: /dev/shm
          name: shm
        - mountPath: /var/log/daline
          name: nfs-log
        - mountPath: /var/store/nfs
          name: nfs-store
        - mountPath: /var/store/http
          name: http-store
        - mountPath: /etc/localtime
          name: localtime
          readOnly: true
      hostname: pu-printer-v1x0x1
      securityContext:
        fsGroup: 502
        runAsGroup: 502
        runAsUser: 1000
      volumes:
      - hostPath:
          path: /dev/shm
        name: shm
      - hostPath:
          path: /root/zhxy/log/alex.c/pu_printer/1_0_1/
        name: nfs-log
      - hostPath:
          path: /root/zhxy/alex.c/
        name: nfs-store
      - hostPath:
          path: /root/zhxy/nginx/www/httpstore/alex.c/
        name: http-store
      - hostPath:
          path: /etc/localtime
        name: localtime
---
apiVersion: v1
kind: Service
metadata:
  labels:
    app: pu-printer-v1x0x1
  name: pu-printer-v1x0x1
  namespace: zhxy
spec:
  ports:
  - name: http
    port: 80
    targetPort: 8080
  - name: websocket
    port: 81
    targetPort: 8081
  selector:
    app: pu-printer-v1x0x1
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    nginx.ingress.kubernetes.io/proxy-body-size: 0m
    nginx.ingress.kubernetes.io/rewrite-target: /$2
  name: pu-printer-v1x0x1
  namespace: zhxy
spec:
  ingressClassName: nginx
  rules:
  - host: api.etongai.com
    http:
      paths:
      - backend:
          service:
            name: pu-printer-v1x0x1
            port:
              number: 80
        path: /pu-printer-v1x0x1(/|$)(.*)
        pathType: Prefix
      - backend:
          service:
            name: pu-printer-v1x0x1
            port:
              number: 81
        path: /pu-printer-v1x0x1-ws(/|$)(.*)
        pathType: Prefix
