local name = 'large-txn'; local namespace = 'test-txn'; local tidb_branch = 'master'; local case_image = 'hub.pingcap.net/qa/case-large-txn'; [ { apiVersion: "batch/v1", kind: "Job", metadata: { name: name+"-case", namespace: namespace, labels: { app: "large-txn" } }, spec: { backoffLimit: 0, template: { spec: { restartPolicy: "Never", containers: [ { name: "large-txn", image: case_image, imagePullPolicy: "Always", command: [ "go", "test", "-timeout", "3h", "-v", "-p", "1", "./tests/..." ], env: [ { name: "LARGE_TXN_HOST", value: name + "-tidb" }, ] } ] } } } }, { apiVersion: "pingcap.com/v1alpha1", kind: "TidbCluster", metadata: { name: name, namespace: namespace, labels: { "app": "large-txn", }, }, spec: { imagePullPolicy: "Always", pvReclaimPolicy: "Delete", schedulerName: "tidb-scheduler", pd: { image: "hub.pingcap.net/qa/pd:"+tidb_branch, replicas: 1, requests: { storage: "10Gi", }, config: {}, }, tikv: { image: "hub.pingcap.net/qa/tikv:"+tidb_branch, replicas: 3, requests: { storage: "40Gi", }, config: {}, }, tidb: { image: "hub.pingcap.net/qa/tidb:"+tidb_branch, replicas: 1, service: { type: "NodePort", }, }, } }, { apiVersion: 'v1', kind: 'ConfigMap', metadata: { name: name+'-tidb', namespace: namespace, labels: { app: 'large-txn' } }, data: { 'config-file': ||| [performance] txn-total-size-limit = 10737418240 |||, 'startup-script': ||| #!/bin/sh # This script is used to start tidb containers in kubernetes cluster # Use DownwardAPIVolumeFiles to store informations of the cluster: # https://kubernetes.io/docs/tasks/inject-data-application/downward-api-volume-expose-pod-information/#the-downward-api # # runmode="normal/debug" # set -uo pipefail ANNOTATIONS="/etc/podinfo/annotations" if [[ ! -f "${ANNOTATIONS}" ]] then echo "${ANNOTATIONS} does't exist, exiting." exit 1 fi source ${ANNOTATIONS} 2>/dev/null runmode=${runmode:-normal} if [[ X${runmode} == Xdebug ]] then echo "entering debug mode." tail -f /dev/null fi ARGS="--store=tikv \ --host=0.0.0.0 \ --path=${CLUSTER_NAME}-pd:2379 \ --config=/etc/tidb/tidb.toml " if [[ X${BINLOG_ENABLED:-} == Xtrue ]] then ARGS="${ARGS} --enable-binlog=true" fi SLOW_LOG_FILE=${SLOW_LOG_FILE:-""} if [[ ! -z "${SLOW_LOG_FILE}" ]] then ARGS="${ARGS} --log-slow-query=${SLOW_LOG_FILE:-}" fi echo "start tidb-server ..." echo "/tidb-server ${ARGS}" exec /tidb-server ${ARGS} ||| }, }, { apiVersion: 'pingcap.com/v1alpha1', kind: 'TidbMonitor', metadata: { name: name, labels: { "app": "large-txn", }, }, spec: { clusters: [ { name: name, namespace: namespace }, ], persistent: false, reserveDays: 7, initializer: { baseImage: 'pingcap/tidb-monitor-initializer', version: 'v3.0.5' }, reloader: { baseImage: 'pingcap/tidb-monitor-reloader', version: 'v1.0.1' }, prometheus: { logLevel: 'info', baseImage: 'prom/prometheus', version: 'v2.11.1', }, grafana: { baseImage: 'grafana/grafana', version: '6.0.1', }, imagePullPolicy: 'IfNotPresent' }, }, ]