kind: ConfigMap
apiVersion: v1
metadata:
  name: tcms-config
  namespace: test-infra
data:
  config.yaml: |
    base-url: "https://tcms.pingcap.net"
    redis-addr: "tcms-redis.test-infra:6379"
    argo:
      endpoint: "http://172.16.4.180:31714"
    meilisearch:
      endpoint: "http://tcms-meilisearch.test-infra:7700"
---
apiVersion: apps/v1
kind: Deployment
metadata:
  namespace: test-infra
  name: tcms
  labels:
    app: tcms
spec:
  selector:
    matchLabels:
      app: tcms
  replicas: 2
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: tcms
      annotations:
        app.kubernetes.io/managed-by: test-infra
    spec:
      tolerations:
      - effect: NoSchedule
        key: dedicated
        operator: Equal
        value: test-infra
      nodeSelector:
        resourcepool: default
      containers:
      - name: main
        image: hub.pingcap.net/qa/tcms:638d8f88
        command: ["/apps/tcms"]
        args:
        - --config=/etc/config/config.yaml
        - --secret=/etc/secret-config
        resources:
          requests:
            cpu: "4"
            memory: 4Gi
          limits:
            cpu: "4"
            memory: 4Gi
        livenessProbe:
          httpGet:
            path: /ping
            port: 80
          initialDelaySeconds: 2
          periodSeconds: 5
        readinessProbe:
          httpGet:
            path: /ping
            port: 80
          initialDelaySeconds: 2
          periodSeconds: 5
        ports:
          - containerPort: 80
            name: tcms
        volumeMounts:
          - name: timezone
            mountPath: /etc/localtime
          - name: config
            mountPath: /etc/config
            readOnly: true
          - name: secret-config
            mountPath: /etc/secret-config
            readOnly: true
      volumes:
        - name: timezone
          hostPath:
            path: /usr/share/zoneinfo/Asia/Shanghai
        - name: config
          configMap:
            name: tcms-config
        - name: secret-config
          secret:
            secretName: tcms-secret-config
      restartPolicy: Always
---
apiVersion: v1
kind: Service
metadata:
  namespace: test-infra
  name: tcms
spec:
  type: NodePort
  selector:
    app: tcms
  ports:
    - port: 80
      targetPort: 80
      nodePort: 30006
