apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: config-service-mock
  name: config-service-mock
  namespace: shared-provider-manager
spec:
  replicas: 2
  selector:
    matchLabels:
      app: config-service-mock
  template:
    metadata:
      labels:
        app: config-service-mock
    spec:
      containers:
      - image: 385595570414.dkr.ecr.us-east-1.amazonaws.com/dbaas/config-service-mock
        imagePullPolicy: Always
        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
      volumes:
      - name: config
        configMap:
          name: config-service-mock-cm
          items:
          - key: cluster-config
            path: cluster.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: shared-provider-manager
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: shared-provider-manager
data:
  cluster-config: |
    {
      "version": "v5.2.1",
      "configMeta": {
        "id": "base",
        "gitCommitId": "TEST",
        "configVersion": 1
      },
      "components": [
        {
          "image": {
            "baseImage": "gcr.io/pingcap-public/dbaas/pd",
            "tag": null
          },
          "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\"]"
        },
        {
          "image": {
            "baseImage": "gcr.io/pingcap-public/dbaas/tidb",
            "tag": null
          },
          "component": "tidb",
          "instanceType": "",
          "config": "max-server-connections = 50\nmem-quota-query = 536870912\nnew_collations_enabled_on_first_bootstrap = true\nenable-telemetry = false\nsecurity.enable-sem = false"
        },
        {
          "image": {
            "baseImage": "gcr.io/pingcap-public/dbaas/tikv",
            "tag": null
          },
          "component": "tikv",
          "instanceType": "",
          "config": "server.grpc-concurrency = 3\nserver.grpc-memory-pool-quota = \"2G\"\nserver.concurrent-send-snap-limit = 6\nserver.concurrent-recv-snap-limit = 6\nrocksdb.info-log-max-size = \"100MB\"\nrocksdb.info-log-keep-log-file-num = 5\nraftdb.info-log-max-size = \"100MB\"\nraftdb.info-log-keep-log-file-num = 5\nstorage.io-rate-limit.max-bytes-per-sec = 131072000\nstorage.reserve-space = \"0GB\""
        },
        {
          "image": {
            "baseImage": "gcr.io/pingcap-public/dbaas/tiflash",
            "tag": null
          },
          "component": "tiflash",
          "instanceType": "",
          "config": "mark_cache_size = 0\nminmax_index_cache_size = 0\ndelta_index_cache_size = 0\nmax_memory_usage = 5368709120\nmax_memory_usage_for_all_queries = 5368709120\nstorage.io_rate_limit.max_bytes_per_sec = 131072000\nstorage.main.dir = [\"/data0/db\"]\nstorage.main.capacity = [ 10737418240 ]\n[profiles.default]\ndt_segment_limit_rows = 400000\ndt_segment_limit_size = 419430400\ndt_segment_force_merge_delta_rows = 160000\ndt_segment_force_merge_delta_size = 167772160\ndt_segment_stop_write_delta_rows = 400000\ndt_segment_stop_write_delta_size = 419430400\nmax_memory_usage = 5368709120"
        }
      ]
    }
  buckup-config: |
    {
      "version": "v5.2.1",
      "configMeta": {
        "id": "base",
        "gitCommitId": "TEST",
        "configVersion": 1
      },
      "image": {
        "baseImage": "gcr.io/pingcap-public/dbaas/br",
        "tag": null
      },
      "config": {}
    }
  restore-config: |
    {
      "version": "v5.2.1",
      "configMeta": {
        "id": "base",
        "gitCommitId": "TEST",
        "configVersion": 1
      },
      "image": {
        "baseImage": "gcr.io/pingcap-public/dbaas/br",
        "tag": null
      },
      "config": {}
    }
