apiVersion: devtier.pingcap-inc/v1alpha1
kind: TiDBCluster
metadata:
  name: tidbcluster-sample
spec:
  #######################
  # Basic Configuration #
  #######################

  ## TiDB cluster version
  version: "v5.4.0"

  ## Time zone of TiDB cluster Pods
  timezone: UTC

  ## serviceAccount specifies the service account for PD/TiDB/TiKV/TiFlash components in this TiDBCluster
  # serviceAccount: tidb

  ## ImagePullPolicy of TiDB cluster Pods
  ## Ref: https://kubernetes.io/docs/concepts/configuration/overview/#container-images
  # imagePullPolicy: IfNotPresent

  ## If private registry is used, imagePullSecrets may be set
  ## You can also set this in service account
  ## Ref: https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod
  # imagePullSecrets:
  # - name: secretName

  ## Annotations of TiDB cluster pod.
  # annotations:
  #   node.kubernetes.io/instance-type: some-vm-type
  #   topology.kubernetes.io/region: some-region

  ## NodeSelector of TiDB cluster pod
  ## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
  # nodeSelector:
  #   node-role.kubernetes.io/tidb: true

  ## Tolerations are applied to TiDB cluster pod, allowing (but do not require) pod to be scheduled onto nodes with matching taints.
  ## Ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/
  # tolerations:
  #   - effect: NoSchedule
  #     key: dedicated
  #     operator: Equal
  #     value: tidb

  ## if true, this tidb cluster is paused and will not be synced by the controller
  # paused: false

  ## SchedulerName of TiDB cluster pods.
  ## If specified, the pods will be scheduled by the specified scheduler.
  ## Can be overwritten by component settings.
  # schedulerName: default-scheduler

  ## Optional duration in seconds the pod needs to terminate gracefully. May be decreased in delete request.
  ## Ref: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#hook-handler-execution
  # terminationGracePeriodSeconds: 30

  ## The storageClassName of the persistent volume for PD data storage.
  # storageClassName: ""

  ## set a different tidb client TLS cert secret name for TiDB Dashboard than the default ${clusterName}-tidb-client-secret
  ## only useful when TLS is enabled for TiDB server
  ## Ref: https://docs.pingcap.com/tidb-in-kubernetes/stable/enable-tls-for-mysql-client
  # tlsClientSecretName: custom-tidb-client-secret-name


  ## prob tidb-server readiness
  ## valid type values:
  ##   - `tcp`, which uses Kubernetes TCPSocketAction to prob the 4000 tcp port of the pod
  ##   - `command`, which uses curl to access the /status path on port 10080 of the pod
  ## This is supported from TiDB Operator v1.1.7
  # readinessProbe:
  #   # The `command` type is only supported after tidb v4.0.9, ref: https://github.com/pingcap/tidb/pull/20694
  #   type: command

  ## when enabled, TiDB will accept TLS encrypted connections from MySQL client
  ## Ref: https://docs.pingcap.com/tidb-in-kubernetes/stable/enable-tls-for-mysql-client
  # tlsClient:
  #   enabled: true

  ###########################
  # TiDB Cluster Components #
  ###########################

  pd:
    ##########################
    # Basic PD Configuration #
    ##########################

    ## Base image of the component
    baseImage: pingcap/pd

    ## pd-server config template config map name
    ## Ref: https://docs.pingcap.com/tidb/stable/pd-configuration-file
    configTemplate: "pd-config-template"

    ## describes the compute resource requirements and limits.
    ## Ref: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/
    requests:
      storage: 10Gi
    #   cpu: 1000m
    #   memory: 1Gi
    # limits:
    #   cpu: 2000m
    #   memory: 2Gi

    #############################
    # Advanced PD Configuration #
    #############################

    ## List of environment variables to set in the container
    ## Note that the following env names cannot be used and will be overwritten by TiDB Operator builtin envs
    ##   - NAMESPACE
    ##   - TZ
    ##   - SERVICE_NAME
    ##   - PEER_SERVICE_NAME
    ##   - HEADLESS_SERVICE_NAME
    ##   - SET_NAME
    ##   - HOSTNAME
    ##   - CLUSTER_NAME
    ##   - POD_NAME
    ##   - BINLOG_ENABLED
    ##   - SLOW_LOG_FILE
    ## Ref: https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/
    # env:
    # - name: MY_ENV_1
    #   value: value1
    # - name: MY_ENV_2
    #   valueFrom:
    #     fieldRef:
    #       fieldPath: status.myEnv2

    ## SecurityContext holds pod-level security attributes and common container settings.
    ## Ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
    # securityContext:
    #   sysctls:
    #   - name: net.core.somaxconn
    #     value: "32768"

  tidb:
    ############################
    # Basic TiDB Configuration #
    ############################

    ## Base image of the component
    baseImage: pingcap/tidb

    ## tidb-server config template config map name
    ## Ref: https://docs.pingcap.com/tidb/stable/tidb-configuration-file
    configTemplate: "tidb-config-template"

    ## describes the compute resource requirements.
    ## Ref: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/
    # requests:
    #   cpu: 1000m
    #   memory: 1Gi
    # limits:
    #   cpu: 2000m
    #   memory: 2Gi


    ###############################
    # Advanced TiDB Configuration #
    ###############################

    ## List of environment variables to set in the container
    ## Note that the following env names cannot be used and will be overwritten by TiDB Operator builtin envs
    ##   - NAMESPACE
    ##   - TZ
    ##   - SERVICE_NAME
    ##   - PEER_SERVICE_NAME
    ##   - HEADLESS_SERVICE_NAME
    ##   - SET_NAME
    ##   - HOSTNAME
    ##   - CLUSTER_NAME
    ##   - POD_NAME
    ##   - BINLOG_ENABLED
    ##   - SLOW_LOG_FILE
    ## Ref: https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/
    # env:
    # - name: MY_ENV_1
    #   value: value1
    # - name: MY_ENV_2
    #   valueFrom:
    #     fieldRef:
    #       fieldPath: status.myEnv2

    ## SecurityContext holds pod-level security attributes and common container settings.
    ## Ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
    # securityContext:
    #   sysctls:
    #   - name: net.ipv4.tcp_keepalive_time
    #     value: "300"
    #   - name: net.ipv4.tcp_keepalive_intvl
    #     value: "75"
    #   - name: net.core.somaxconn
    #     value: "32768"

  tikv:
    ############################
    # Basic TiKV Configuration #
    ############################

    ## Base image of the component
    baseImage: pingcap/tikv

    ## tikv-server config template config map name
    ## Ref: https://docs.pingcap.com/tidb/stable/tikv-configuration-file
    configTemplate: "tikv-config-template"

    ## describes the compute resource requirements.
    ## Ref: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/
    requests:
      storage: 10Gi
    #   cpu: 1000m
    #   memory: 1Gi
    # limits:
    #   cpu: 2000m
    #   memory: 2Gi
    #   # settings `storage` here will add `--capacity` arg to tikv-server
    #   storage: 10Gi

    ###############################
    # Advanced TiKV Configuration #
    ###############################

    ## List of environment variables to set in the container
    ## Note that the following env names cannot be used and will be overwritten by TiDB Operator builtin envs
    ##   - NAMESPACE
    ##   - TZ
    ##   - SERVICE_NAME
    ##   - PEER_SERVICE_NAME
    ##   - HEADLESS_SERVICE_NAME
    ##   - SET_NAME
    ##   - HOSTNAME
    ##   - CLUSTER_NAME
    ##   - POD_NAME
    ##   - BINLOG_ENABLED
    ##   - SLOW_LOG_FILE
    ## Ref: https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/
    # env:
    # - name: MY_ENV_1
    #   value: value1
    # - name: MY_ENV_2
    #   valueFrom:
    #     fieldRef:
    #       fieldPath: status.myEnv2

    ## SecurityContext holds pod-level security attributes and common container settings.
    ## Ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
    # securityContext:
    #   sysctls:
    #   - name: net.ipv4.tcp_keepalive_time
    #     value: "300"
    #   - name: net.ipv4.tcp_keepalive_intvl
    #     value: "75"
    #   - name: net.core.somaxconn
    #     value: "32768"

  ## TiFlash is the columnar storage extension of TiKV
  ## Ref: https://pingcap.com/docs/tidb-in-kubernetes/stable/deploy-tiflash/
  # tiflash:
  #   ###############################
  #   # Basic TiFlash Configuration #
  #   ###############################
  #   baseImage: pingcap/tiflash
  #   # limits:
  #   #   cpu: 2000m
  #   #   memory: 2Gi

  #   ##################################
  #   # Advanced TiFlash Configuration #
  #   ##################################
  #   securityContext: {}
  #   env: []

  #   # TOML format configuration
  #   # Ref: https://docs.pingcap.com/tidb/dev/tiflash-configuration
  #   # configure the configuration file for TiFlash process
  #   configTemplate: "tiflash-config-template"
  #   # configure the configuration file for TiFlash Proxy process
  #   proxyConfigTemplate: "tiflash-proxy-config-template"
