apiVersion: apps/v1
kind: Deployment
metadata:
  name: pu-sys-usercenter-v1x0x1
  labels:
    app: pu-sys-usercenter-v1x0x1
spec:
  replicas: 1
  selector:
    matchLabels:
      app: pu-sys-usercenter-v1x0x1
  template:
    metadata:
      labels:
        app: pu-sys-usercenter-v1x0x1
    spec:
      hostname: pu-sys-usercenter-v1x0x1
      containers:
        - name: pu-sys-usercenter-v1x0x1
          image: dockerhub.daline.com.cn/pu_sys_usercenter:1.0.1.last
          imagePullPolicy: Always
          volumeMounts:
            - name: localtime
              mountPath: /etc/localtime
              readOnly: true
          ports:
            - containerPort: 80
              name: "http"
          resources:
            requests:
              memory: 512Mi
            limits:
              memory: 2048Mi
          env:
            - name: "TZ"
              value: "Asia/Shanghai"
            - name: "AUTHLIB_INSECURE_TRANSPORT"
              value: "1"
            - name: "SERVE"
              value: "1"
            - name: "IN_K8S"
              value: "1"
            - name: "GLB_ENV"
              value: "1"
            # ldap config
            - name: "LDAP_URL"
              value: "ldap://glb-openldap:389"
            - name: "LDAP_BASE"
              value: "ou=user,dc=daline,dc=com"
            - name: "LDAP_BIND_DN"
              value: "cn=admin,dc=daline,dc=com"
            - name: "LDAP_BIND_PASSWORD"
              value: "Hell0DAL"
            # log config
            - name: "LOG_LEVEL"
              value: "debug"
            - 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: localtime
          hostPath:
            path: "/etc/localtime"

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

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