### 一个 tiup 负载节点
---
generateName: testbed-
items:
  - name: tiup
    type: WORKLOAD_NODE # 测试资源类型: WORKLOAD_NODE
    spec:
      container:
        name: node
        image: hub.pingcap.net/qa/base-image
        imagePullPolicy: IfNotPresent
        resources:
          requests:
            # NOTE: 目前对 tiup 的支持是将 pod 当做虚拟机使用，如果节点占用内存接近 request.memory 时，可能会导致 pod 被 oom killed，导致测试集群无法恢复(因为 tiup 用的 ssh key，systemd service 等被删除)
            # Workaround 是: 1. 对于中控机节点，适当调大 requests.memory 值 (中控机上跑了 haproxy，会有一定的资源占用)
            # 2. 对于 component 节点，配置 requests.memory 的同时也配置 tiup 拓扑里的 resource_control, 保证每个节点的 request.memory > resource_control.memory_limit (此时内存占用过高时，component 进程会被 systemd killed 而不会影响到 pod)
            # resource_control 的配置方式见： https://github.com/pingcap/tiup/blob/01843be5957ee189ff8cad0bb8cf2f0669cf3ddc/embed/examples/cluster/topology.example.yaml?_pjax=%23js-repo-pjax-container%2C%20div%5Bitemtype%3D%22http%3A%2F%2Fschema.org%2FSoftwareSourceCode%22%5D%20main%2C%20%5Bdata-pjax-container%5D#L19-L28
            memory: 32Gi
            cpu: 8000m
        securityContext:
          capabilities:
            add: ["SYS_ADMIN", "SYS_PTRACE", "NET_ADMIN"]

  - name: workload
    type: WORKLOAD_NODE # 测试资源类型: WORKLOAD_NODE
    spec:
        container:
            name: go-tpc
            image: hub.pingcap.net/qa/go-tpc:v1.0.7
            imagePullPolicy: IfNotPresent
            command: # 让 go-tpc 节点不会因为执行完退出
                - tail
                - "-f"
                - "/dev/null"
            resources:
                requests:
                    memory: 1Gi # 申请 64Mi 内存
                    cpu: 1000m # 1 vCPU core

  - name: downstream
    type: MYSQL_NODE
    spec:
        image: docker.io/mysql:8
        port: 3306
        env:
            MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
            MYSQL_ROOT_HOST: "%"
        resources:
            requests:
                memory: 4Gi
                cpu: 1000m
                storage: 10Gi
        volumeMount:
            mountPath: "/var/lib/mysql" # mountPath of "storage" request
