apiVersion: api/v1
kind: Plan
name: endless-oltp-upgrade-cc-rolling-update
#type: ONE_SHOT
schedule: "@weekly"
tags: []
testbed:
  generateName: endless-oltp-upgrade-cc-rolling-update-
  reclaimPolicy:
    gcStrategy:
      onFailure:
        artifact:
          monitor: true
          log: true
        reserveEnv:
          durationOnWorkingHour: '{{meta.parameters.onFailureReserveDurationOnWorkingHour}}'
  items:
  - name: tiup
    type: WORKLOAD_NODE
    spec:
      artifact:
        artifactPaths:
        - /root/result/
      container:
        name: node
        image: hub.pingcap.net/qa/base-image
        imagePullPolicy: Always
        resources:
          requests:
            memory: 2Gi
            cpu: 1000m
            storage: 100Gi

        securityContext:
          capabilities:
            add: ["SYS_ADMIN", "SYS_PTRACE", "NET_ADMIN"]
        volumeMount:
          mountPath: "/tiup"

  - name: pd
    type: WORKLOAD_NODE
    spec:
      artifact:
        artifactPaths:
        - /tiup/deploy/pd-12379/log
      container:
        name: node
        image: hub.pingcap.net/qa/base-image
        imagePullPolicy: Always
        resources:
          requests:
            memory: 4Gi
            cpu: 2000m
            storage: 100Gi

        securityContext:
          capabilities:
            add: ["SYS_ADMIN", "SYS_PTRACE", "NET_ADMIN"]
        volumeMount:
          mountPath: "/tiup"

  - name: tikv1
    type: WORKLOAD_NODE
    spec:
      artifact:
        artifactPaths:
        - /tiup/deploy/tikv-30160/log
      container:
        name: node
        image: hub.pingcap.net/qa/base-image
        imagePullPolicy: Always
        storageClassName: fast-disks
        resources:
          requests:
            memory: 16Gi
            cpu: 8000m
            storage: 300Gi

        securityContext:
          capabilities:
            add: ["SYS_ADMIN", "SYS_PTRACE", "NET_ADMIN"]
        volumeMount:
          mountPath: "/tiup"

  - name: tikv2
    type: WORKLOAD_NODE
    spec:
      artifact:
        artifactPaths:
        - /tiup/deploy/tikv-30160/log
      container:
        name: node
        image: hub.pingcap.net/qa/base-image
        imagePullPolicy: Always
        storageClassName: fast-disks
        resources:
          requests:
            memory: 16Gi
            cpu: 8000m
            storage: 300Gi

        securityContext:
          capabilities:
            add: ["SYS_ADMIN", "SYS_PTRACE", "NET_ADMIN"]
        volumeMount:
          mountPath: "/tiup"

  - name: tikv3
    type: WORKLOAD_NODE
    spec:
      artifact:
        artifactPaths:
        - /tiup/deploy/tikv-30160/log
      container:
        name: node
        image: hub.pingcap.net/qa/base-image
        imagePullPolicy: Always
        storageClassName: fast-disks
        resources:
          requests:
            memory: 16Gi
            cpu: 8000m
            storage: 300Gi

        securityContext:
          capabilities:
            add: ["SYS_ADMIN", "SYS_PTRACE", "NET_ADMIN"]
        volumeMount:
          mountPath: "/tiup"

  - name: tikv4
    type: WORKLOAD_NODE
    spec:
      artifact:
        artifactPaths:
        - /tiup/deploy/tikv-30160/log
      container:
        name: node
        image: hub.pingcap.net/qa/base-image
        imagePullPolicy: Always
        storageClassName: fast-disks
        resources:
          requests:
            memory: 16Gi
            cpu: 8000m
            storage: 300Gi

        securityContext:
          capabilities:
            add: ["SYS_ADMIN", "SYS_PTRACE", "NET_ADMIN"]
        volumeMount:
          mountPath: "/tiup"

  - name: tikv5
    type: WORKLOAD_NODE
    spec:
      artifact:
        artifactPaths:
        - /tiup/deploy/tikv-30160/log
      container:
        name: node
        image: hub.pingcap.net/qa/base-image
        imagePullPolicy: Always
        storageClassName: fast-disks
        resources:
          requests:
            memory: 16Gi
            cpu: 8000m
            storage: 300Gi

        securityContext:
          capabilities:
            add: ["SYS_ADMIN", "SYS_PTRACE", "NET_ADMIN"]
        volumeMount:
          mountPath: "/tiup"

  - name: tidb
    type: WORKLOAD_NODE
    spec:
      artifact:
        artifactPaths:
        - /tiup/deploy/tidb-14000/log
      container:
        name: node
        image: hub.pingcap.net/qa/base-image
        imagePullPolicy: Always
        resources:
          requests:
            memory: 8Gi
            cpu: 4000m
            storage: 100Gi

        securityContext:
          capabilities:
            add: ["SYS_ADMIN", "SYS_PTRACE", "NET_ADMIN"]
        volumeMount:
          mountPath: "/tiup"

  - name: wkload
    type: WORKLOAD_NODE
    spec:
      artifact:
        artifactPaths:
        - /root/wkload/workloads/run_workload.log
      container:
        name: node
        image: hub-new.pingcap.net/patrick/betting_image
        imagePullPolicy: Always
        resources:
          requests:
            memory: 4Gi
            cpu: 2000m
            storage: 100Gi

              # securityContext:
              #     capabilities:
              #         add: ["SYS_ADMIN", "SYS_PTRACE", "NET_ADMIN"]
        volumeMount:
          mountPath: "/tiup"

steps:
- name: CC-ROLLING-UPDATE
  caseName: oltp_tikv_cc_smooth_rolling_update
  arguments:
  - name: version
    value: '{{meta.parameters.tiup_target_version}}'
  - name: tiup
    value: '{{testbed.tiup}}'
  - name: wkload
    value: '{{testbed.wkload}}'
  - name: pd
    value: '{{testbed.pd}}'
  - name: tidb
    value: '{{testbed.tidb}}'
  - name: tikv1
    value: '{{testbed.tikv1}}'
  - name: tikv2
    value: '{{testbed.tikv2}}'
  - name: tikv3
    value: '{{testbed.tikv3}}'
  - name: tikv4
    value: '{{testbed.tikv4}}'
  - name: tikv5
    value: '{{testbed.tikv5}}'

