apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: config-service-mock
  name: config-service-mock
  namespace: tidb-admin
spec:
  replicas: 2
  selector:
    matchLabels:
      app: config-service-mock
  template:
    metadata:
      labels:
        app: config-service-mock
    spec:
      automountServiceAccountToken: false
      containers:
        - image: 385595570414.dkr.ecr.us-east-1.amazonaws.com/dbaas/config-service-mock
          imagePullPolicy: IfNotPresent
          name: config-service-mock
          ports:
            - containerPort: 8080
              protocol: TCP
          volumeMounts:
            - mountPath: /config
              name: config
          resources:
            requests:
              cpu: 100m
              memory: 100Mi
            limits:
              cpu: 100m
              memory: 100Mi
          securityContext:
            allowPrivilegeEscalation: false
      securityContext:
        runAsUser: 65532
      volumes:
        - name: config
          configMap:
            name: config-service-mock-cm
            items:
              - key: cluster-config-shared
                path: cluster-shared.json
              - key: buckup-config
                path: backup.json
              - key: restore-config
                path: restore.json
---
apiVersion: v1
kind: Service
metadata:
  labels:
    app: config-service-mock
  name: config-service-mock
  namespace: tidb-admin
spec:
  ports:
    - name: http
      port: 8080
      protocol: TCP
      targetPort: 8080
  selector:
    app: config-service-mock
  type: ClusterIP
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: config-service-mock-cm
  namespace: tidb-admin
data:
  cluster-config-shared: |
    {
      "version": "v5.4.0",
      "configMeta": {
        "id": "base",
        "gitCommitId": "TEST",
        "configVersion": 1
      },
      "components": [
        {
          "image": {
            "baseImage": "gcr.io/pingcap-public/dbaas/pd-arm64",
            "tag": "v5.4.0"
          },
          "component": "pd",
          "instanceType": "",
          "config": "dashboard.internal-proxy = true\ndashboard.enable-telemetry = false\nreplication.location-labels = [\"topology.kubernetes.io/region\", \"topology.kubernetes.io/zone\", \"kubernetes.io/hostname\"]\nreplication.max-replicas = 3\nschedule.hot-regions-reserved-days = 1"
        },
        {
          "image": {
            "baseImage": "gcr.io/pingcap-public/dbaas/tidb-arm64",
            "tag": "v5.4.0"
          },
          "component": "tidb",
          "instanceType": "",
          "config": "max-server-connections = 500\nmem-quota-query = 536870912\nnew_collations_enabled_on_first_bootstrap = true\nenable-telemetry = false\nsecurity.enable-sem = false\ntoken-limit = 250\nperformance.committer-concurrency = 32\ntikv-client.grpc-connection-count = 1\ntikv-client.copr-cache.capacity-mb = 250.0"
        },
        {
          "image": {
            "baseImage": "gcr.io/pingcap-public/dbaas/tikv-arm64",
            "tag": "v5.4.0"
          },
          "component": "tikv",
          "instanceType": "",
          "config": "storage.io-rate-limit.max-bytes-per-sec = 131072000\nstorage.reserve-space = \"20GB\"\nreadpool.unified.max-thread-count = 3\nserver.grpc-concurrency = 3\nquota.foreground-cpu-time = 1000"
        },
        {
          "image": {
            "baseImage": "gcr.io/pingcap-public/dbaas/tiflash-arm64",
            "tag": "v5.4.0"
          },
          "component": "tiflash",
          "instanceType": "",
          "config": "storage.io_rate_limit.max_bytes_per_sec = 131072000\nstorage.main.dir = [\"/data0/db\"]\ndt_enable_logical_split = false"
        }
      ]
    }
  buckup-config: |
    {
      "version": "v5.4.0",
      "configMeta": {
        "id": "base",
        "gitCommitId": "TEST",
        "configVersion": 1
      },
      "image": {
        "baseImage": "gcr.io/pingcap-public/dbaas/br-arm64",
        "tag": "v5.4.0"
      },
      "config": {}
    }
  restore-config: |
    {
      "version": "v5.4.0",
      "configMeta": {
        "id": "base",
        "gitCommitId": "TEST",
        "configVersion": 1
      },
      "image": {
        "baseImage": "gcr.io/pingcap-public/dbaas/br-arm64",
        "tag": "v5.4.0"
      },
      "config": {}
    }
