
apiVersion: apps/v1
kind: Deployment
metadata:
  name: pu-articleserver-v1x0x1
  labels:
    app: pu-articleserver-v1x0x1
spec:
  replicas: 1
  selector:
    matchLabels:
      app: pu-articleserver-v1x0x1
  template:
    metadata:
      labels:
        app: pu-articleserver-v1x0x1
    spec:
      hostname: pu-articleserver-v1x0x1
      hostAliases:
        - ip: "101.132.135.79"
          hostnames:
            - "api-glb.daline.com.cn"
      containers:
        - name: pu-articleserver-v1x0x1
          image: dockerhub.daline.com.cn/pu_articleserver_9a1b009:1.0.1
          volumeMounts:
            - name: nfs-store
              mountPath: /var/store/nfs
            - name: http-store
              mountPath: /var/store/http
            - name: localtime
              mountPath: /etc/localtime
              readOnly: true
          ports:
            - containerPort: 80
              name: "http"
            - containerPort: 81
              name: "websocket"
          env:
            - name: "TZ"
              value: "Asia/Shanghai"
            - name: "SERVE"
              value: "1"
            - name: "IN_K8S"
              value: "1"
            - name: "AUTHOR"
              value: "kun.z"
            - name: "GIT_COMMIT"
              value: "9a1b009a69c6dc5df54d66bb56abba37c8bb6857"
            - name: "DAL_ENV"
              value: "dev"
            - name: "DAL_SPACE"
              value: "westfutu"
            # log config
            - name: "LOG_LEVEL"
              value: "info"
            - name: "LOG_DIR"
              value: "/var/log/daline"
            # file storage config
            - 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/dev/westfutu/kun.z/pu_articleserver/1_0_1/"
            - name: "RUN_MODE"
              value: "run"
      volumes:
        - name: nfs-store
          nfs:
            server: 369df4abd8-qmf27.cn-shanghai.nas.aliyuncs.com
            path: "/home/NFSData/dev/westfutu/kun.z/"
        - name: http-store
          nfs:
            server: 369df4abd8-qmf27.cn-shanghai.nas.aliyuncs.com
            path: "/home/NFSData/FileServer/files/dev/westfutu/kun.z/"
        - name: localtime
          hostPath:
            path: "/etc/localtime"

---
apiVersion: v1
kind: Service
metadata:
  labels:
    app: pu-articleserver-v1x0x1
  name: pu-articleserver-v1x0x1
spec:
  ports:
    - port: 80
      targetPort: 80
      name: "http"
    - port: 81
      targetPort: 81
      name: "websocket"
  selector:
    app: pu-articleserver-v1x0x1

---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: pu-articleserver-v1x0x1
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /$2
    nginx.ingress.kubernetes.io/proxy-body-size: 0m
spec:
  ingressClassName: nginx
  rules:
  - host: api-new.westfutu.com
    http:
      paths:
      - path: /westfutu/pu-articleserver-v1x0x1(/|$)(.*)
        pathType: Prefix
        backend:
          service:
            name: pu-articleserver-v1x0x1
            port:
              number: 80

---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: pu-articleserver-v1x0x1-ws
spec:
  ingressClassName: nginx
  rules:
  - host: ws-westfutu-pu-articleserver-v1x0x1.new.westfutu.com
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: pu-articleserver-v1x0x1
            port:
              number: 81

