apiVersion: pingcap.com/v1alpha1
kind: TidbNGMonitoring
metadata:
  name: main-cluster-monitoring
spec:

  ## tidb cluster to be monitored
  ## ** now only support monitoring one tidb cluster **
  clusters:
  - name: advanced-tidb
    namespace: default
    ## ClusterDomain is the domain of TidbCluster object
    # clusterDomain: cluster.local

  ## ConfigUpdateStrategy determines how the configuration change is applied to the cluster.
  ## Valid values are `InPlace` and `RollingUpdate`
  ##   UpdateStrategy `InPlace` will update the ConfigMap of configuration in-place and an extra rolling update of the
  ##   cluster component is needed to reload the configuration change.
  ##   UpdateStrategy `RollingUpdate` will create a new ConfigMap with the new configuration and rolling update the
  ##   related components to use the new ConfigMap, that is, the new configuration will be applied automatically.
  configUpdateStrategy: RollingUpdate

  ## Persistent volume reclaim policy applied to the PV consumed, default to `Retain`.
  ## Note that the reclaim policy Recycle may not be supported by some storage types, e.g. local.
  ## Ref: https://kubernetes.io/docs/tasks/administer-cluster/change-pv-reclaim-policy/
  pvReclaimPolicy: Retain

  ## ImagePullPolicy of 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

  ## Specify pod priorities of pods in TidbNGMonitoring, default to empty.
  ## Can be overwritten by component settings.
  ## Ref: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/
  # priorityClassName: system-cluster-critical

  ## Use the node network namespace, default to false
  ## Ref: https://kubernetes.io/docs/concepts/policy/pod-security-policy/#host-namespaces
  # hostNetwork: false

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

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

  ###########################
  # Components              #
  ###########################

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

    ## version of ng-monitoring
    version: nightly
    
    ## Base image of the component
    baseImage: pingcap/ng-monitoring

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

    ## ng-monitoring configuration
    # config: |
    #   [log]
    #     level = "DEBUG"

    ## Annotations of ng monitoring pods
    # annotations:
    #   node.kubernetes.io/instance-type: some-vm-type
    #   topology.kubernetes.io/region: some-region

    ## Labels of ng monitoring pods
    # labels: {}

    ## 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
    ##   - HEADLESS_SERVICE_NAME
    ##   - POD_NAME
    ## 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

    ## NodeSelector of ng monitoring pods
    ## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
    # nodeSelector:
    #   node-role.kubernetes.io/ngm: true

    ## Tolerations are applied to ng monitoring pods, allowing (but do not require) pods 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: ngm

    ## Affinity for pod scheduling, will be overwritten by each cluster component's specific affinity setting
    ## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
    # affinity: {}

    ## TopologySpreadConstraints for pod scheduling, will be overwritten by each cluster component's specific spread constraints setting
    ## Ref: pkg/apis/pingcap/v1alpha1/types.go#TopologySpreadConstraint
    # topologySpreadConstraints:
    # - topologyKey: topology.kubernetes.io/zone

    ## Custom sidecar containers can be injected into the ng monitoring pods,
    ## which can act as a logging/tracing agent or for any other use case
    # additionalContainers:
    # - name: myCustomContainer
    #   image: ubuntu

    ## custom additional volumes in ng monitoring pods
    # additionalVolumes:
    # # specify volume types that are supported by Kubernetes, Ref: https://kubernetes.io/docs/concepts/storage/persistent-volumes/#types-of-persistent-volumes
    # - name: nfs
    #   nfs:
    #     server: 192.168.0.2
    #     path: /nfs

    ## custom additional volume mounts in ng monitoring pods
    # additionalVolumeMounts:
    # # this must match `name` in `additionalVolumes`
    # - name: nfs
    #   mountPath: /nfs

    ## defines additional volumes for which PVCs will be created by StatefulSet controller
    # storageVolumes:
    #   # this will be suffix of PVC names in VolumeClaimTemplates of NG Monitoring StatefulSet
    # - name: volumeName
    #   # specify this to use special storageClass for this volume, default to component-level `storageClassName`
    #   storageClassName: local-storage
    #   # storage request of PVC
    #   storageSize: 1Gi
    #   # mount path of the PVC
    #   mountPath: /some/path

    ## 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

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