apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: utils-dca
  name: dca
  namespace: datakit
spec:
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: utils-dca
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: utils-dca
    spec:
      affinity: {}
      containers:
        - env:
            - name: DCA_CONSOLE_API_URL
              # 杭州 https://console-api.guance.com
              # 宁夏 https://aws-console-api.guance.com
              # 广州 https://cn4-console-api.guance.com
              # 俄勒冈 https://us1-console-api.guance.com
              value: https://console-api.guance.com
            - name: DCA_CONSOLE_WEB_URL
              value: https://console.guance.com
            - name: DCA_LOG_PATH
              value: "stdout"
            - name: DCA_LOG_LEVEL
              value: "info"
          image: pubrepo.guance.com/tools/dca:0.1.0
          imagePullPolicy: Always
          name: dca
          ports:
            - containerPort: 80
              name: http
              protocol: TCP
          resources:
            limits:
              cpu: 500m
              memory: 256Mi
            requests:
              cpu: 250m
              memory: 100Mi
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30

---
apiVersion: v1
kind: Service
metadata:
  name: dca
  namespace: datakit
spec:
  ports:
    - name: web
      port: 80
      protocol: TCP
      targetPort: 80
  selector:
    app: utils-dca
  sessionAffinity: None
  type: ClusterIP

---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: dca
  namespace: datakit
spec:
  rules:
    - host: dca.xxxx.com
      http:
        paths:
          - backend:
              service:
                name: dca
                port:
                  number: 80
            path: /
            pathType: Prefix
  # tls:
  #   - hosts:
  #       - dca.xxxx.com
  #     secretName: xxxx
