apiVersion: apps/v1
kind: Deployment
metadata:
  name: pu-sys-unitcenter-v1x0x1
  labels:
    app: pu-sys-unitcenter-v1x0x1
spec:
  replicas: 1
  selector:
    matchLabels:
      app: pu-sys-unitcenter-v1x0x1
  template:
    metadata:
      labels:
        app: pu-sys-unitcenter-v1x0x1
    spec:
      hostname: pu-sys-unitcenter-v1x0x1
      containers:
        - name: pu-sys-unitcenter-v1x0x1
          image: dockerhub.daline.com.cn/pu_sys_unitcenter:1.0.1.gj
          imagePullPolicy: Always
          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"
          resources:
            requests:
              memory: 256Mi
            limits:
              memory: 512Mi
          env:
            - name: "TZ"
              value: "Asia/Shanghai"
            - name: "SERVE"
              value: "1"
            - name: "IN_K8S"
              value: "1"
            - name: "GLB_ENV"
              value: "1"
            # 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/glb/pu_usercenter/1_0_1"
            # port config
      volumes:
        - name: nfs-store
          nfs:
            server: nfs.daline.com.cn
            path: "/home/NFSData/"
        - name: http-store
          nfs:
            server: nfs.daline.com.cn
            path: "/home/NFSData/FileServer/files/"
        - name: localtime
          hostPath:
            path: "/etc/localtime"

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

---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: pu-sys-unitcenter-v1x0x1
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /$2
spec:
  ingressClassName: nginx
  rules:
  - host: api-glb.daline.com.cn
    http:
      paths:
      - path: /pu-sys-unitcenter-v1x0x1(/|$)(.*)
        pathType: Prefix
        backend:
          service:
            name: pu-sys-unitcenter-v1x0x1
            port:
              number: 80
