replicaCount: 1

image:
  repository: capacity-planner
  pullPolicy: IfNotPresent
  tag: ""

imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""

serviceAccount:
  create: true
  annotations: {}
  name: ""

podAnnotations: {}
podLabels: {}

podSecurityContext:
  runAsNonRoot: true
  fsGroup: 65532
  seccompProfile:
    type: RuntimeDefault

securityContext:
  allowPrivilegeEscalation: false
  capabilities:
    drop:
    - ALL
  readOnlyRootFilesystem: true
  runAsGroup: 65532
  runAsUser: 65532

config:
  apiVersion: capacity-planner.tidbcloud.com/v1alpha1
  kind: CapacityPlannerConfiguration
  controller:
    leaderElection: true
    syncPeriod: 30s
  server:
    health:
      bindAddress: ":8081"
  metrics:
    bindAddress: "0"
  storage:
    path: /var/lib/capacity-planner/metrics
    retention: 1h
  query:
    bindAddress: "0"
    timeout: 10s
    maxSamples: 50000
    maxPoints: 11000
  records:
    dir: /var/lib/capacity-planner/records
  scrapers:
    interval: 15s
    metricsServer:
      maxAge: 2m
      resources:
        cpu: cpu
        memory: memory
    podWatcher:
      metrics:
      - name: pod_status_running
        jsonPath: .status.phase
        matchValue: Running
      - name: pod_status_ready
        jsonPath: .status.conditions[?(@.type=="Ready")].status
        matchValue: "True"
    podMetrics:
      timeout: 10s
      maxBodySize: 32MiB
      concurrency: 16
      metrics:
      - tidb_server_query_total
  rules:
    interval: 15s
    engine:
      timeout: 10s
      maxSamples: 50000
      lookbackDelta: 5m
    records:
    - record: pod:tidb_server_query:rate1m
      expr: |
        sum by (namespace, group, component, pod) (
          rate(tidb_server_query_total[1m])
        )
  logging:
    development: false
    encoder: json
    level: info
    stacktraceLevel: error
    timeEncoding: rfc3339nano

# Safety ceilings for node-backed local state. Retention remains owned by the
# TSDB and the follow-up archive uploader.
storageVolumes:
  metrics:
    sizeLimit: 2Gi
  records:
    sizeLimit: 2Gi

resources:
  requests:
    cpu: 100m
    memory: 128Mi

nodeSelector: {}
tolerations: []
affinity: {}

tierTemplates:
  config: |-
    templates:
      tidb-node:
        matchers:
        - name: cpu
          type: Resource
          resource:
            name: cpu
            variants: ["3257m", "7220m", "15200m"]
        - name: memory
          type: Resource
          resource:
            name: memory
            variants: ["13115Mi", "13114Mi", "28041Mi"]
        params:
        - name: nodespec
          matcher: cpu
          values: ["4C16G", "8C16G", "16C32G"]
        - name: cpurequest
          matcher: cpu
          values: ["3257m", "7220m", "15200m"]
        - name: memrequest
          matcher: memory
          values: ["13115Mi", "13114Mi", "28041Mi"]
        - name: cpulimit
          matcher: cpu
          values: ["3920m", "7910m", "15890m"]
        - name: memlimit
          matcher: memory
          values: ["14079Mi", "14078Mi", "29326Mi"]
        - name: gomemlimit
          matcher: memory
          values: ["11263MiB", "11262MiB", "23460MiB"]
        available:
        - name: cpu
          matcher: cpu
          percentages: [100, 100, 100]
        - name: memory
          matcher: memory
          percentages: [100, 100, 100]
        costs:
        - name: cpu
          matcher: cpu
          values: [40, 80, 160]
        - name: memory
          matcher: memory
          values: [16, 16, 32]
        template: |
          metadata:
            labels:
              tags.tidbcloud.com/node-spec: "{{nodespec}}"
          spec:
            template:
              spec:
                overlay:
                  pod:
                    spec:
                      nodeSelector:
                        node-spec: "{{nodespec}}"
                      containers:
                      - name: tidb
                        resources:
                          requests:
                            cpu: "{{cpurequest}}"
                            memory: "{{memrequest}}"
                          limits:
                            cpu: "{{cpulimit}}"
                            memory: "{{memlimit}}"
                        env:
                        - name: GOMEMLIMIT
                          value: "{{gomemlimit}}"
