# Default values for victoria-logs.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

# -- Print chart notes
printNotes: true

podDisruptionBudget:
  # -- See `kubectl explain poddisruptionbudget.spec` for more. Ref: [https://kubernetes.io/docs/tasks/run-application/configure-pdb/](https://kubernetes.io/docs/tasks/run-application/configure-pdb/)
  enabled: false
  #  minAvailable: 1
  #  maxUnavailable: 1
  extraLabels: {}

server:
  # -- Enable deployment of server component. Deployed as StatefulSet
  enabled: true
  # -- Server container name
  name: server
  image:
    # -- Image repository
    repository: victoriametrics/victoria-logs
    # -- Image tag
    tag: "v0.4.2-victorialogs"
    # -- Image pull policy
    pullPolicy: IfNotPresent
  # -- Name of Priority Class
  priorityClassName: ""
  # -- Overrides the full name of server component
  fullnameOverride:
  # -- Data retention period in month
  retentionPeriod: 1
  # Extra command line arguments for container of component
  extraArgs:
    envflag.enable: "true"
    envflag.prefix: VM_
    loggerFormat: json

  # Additional hostPath mounts
  extraHostPathMounts:
    []
     #- name: certs-dir
     #  mountPath: /etc/kubernetes/certs
     #  subPath: ""
     #  hostPath: /etc/kubernetes/certs
     #  readOnly: true

  # Extra Volumes for the pod
  extraVolumes:
    []
    #- name: example
    #  configMap:
    #   name: example

  # Extra Volume Mounts for the container
  extraVolumeMounts:
    []
    # - name: example
    #   mountPath: /example

  extraContainers:
    []
    #- name: config-reloader
    #  image: reloader-image

  initContainers:
    []

  # -- Node tolerations for server scheduling to nodes with taints. Ref: [https://kubernetes.io/docs/concepts/configuration/assign-pod-node/](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/)
  tolerations:
    []
    # - key: "key"
    #   operator: "Equal|Exists"
    #   value: "value"
    #   effect: "NoSchedule|PreferNoSchedule"

  # -- Pod's node selector. Ref: [https://kubernetes.io/docs/user-guide/node-selection/](https://kubernetes.io/docs/user-guide/node-selection/)
  nodeSelector: {}

  # -- Pod affinity
  affinity: {}

  # -- Env variables
  # -- Additional environment variables (ex.: secret tokens, flags) https://github.com/VictoriaMetrics/VictoriaMetrics#environment-variables
  env: []
  # -- Container workdir
  containerWorkingDir: ""

  ## Use an alternate scheduler, e.g. "stork".
  ## ref: https://kubernetes.io/docs/tasks/administer-cluster/configure-multiple-schedulers/
  ##
  # schedulerName:

  persistentVolume:
    # -- Create/use Persistent Volume Claim for server component. Empty dir if false
    enabled: false

    # -- Array of access modes. Must match those of existing PV or dynamic provisioner. Ref: [http://kubernetes.io/docs/user-guide/persistent-volumes/](http://kubernetes.io/docs/user-guide/persistent-volumes/)
    accessModes:
      - ReadWriteOnce
    # -- Persistant volume annotations
    annotations: {}

    # -- StorageClass to use for persistent volume. Requires server.persistentVolume.enabled: true. If defined, PVC created automatically
    storageClass: ""

    # -- Existing Claim name. If defined, PVC must be created manually before volume will be bound
    existingClaim: ""

    # -- Bind Persistent Volume by labels. Must match all labels of targeted PV.
    matchLabels: {}

    # -- Mount path. Server data Persistent Volume mount root path.
    mountPath: /storage
    # -- Mount subpath
    subPath: ""
    # -- Size of the volume. Should be calculated based on the logs you send and retention policy you set.
    size: 3Gi

  # -- Sts/Deploy additional labels
  extraLabels: {}
  # -- Pod's additional labels
  podLabels: {}
  # -- Pod's annotations
  podAnnotations: {}
  # -- Pod's management policy
  podManagementPolicy: OrderedReady

  # -- Resource object. Ref: [http://kubernetes.io/docs/user-guide/compute-resources/](http://kubernetes.io/docs/user-guide/compute-resources/
  resources:
    {}
    # limits:
    #   cpu: 500m
    #   memory: 512Mi
    # requests:
    #   cpu: 500m
    #   memory: 512Mi

  # Indicates whether the Container is ready to service requests. If the readiness probe fails, the endpoints controller removes the Pod's IP address from the endpoints of all Services that match the Pod. The default state of readiness before the initial delay is Failure. If a Container does not provide a readiness probe, the default state is Success.
  readinessProbe:
    httpGet:
      path: /health
      port: http
    initialDelaySeconds: 5
    periodSeconds: 15
    timeoutSeconds: 5
    failureThreshold: 3

  # Indicates whether the Container is running. If the liveness probe fails, the kubelet kills the Container, and the Container is subjected to its restart policy. If a Container does not provide a liveness probe, the default state is Success.
  livenessProbe:
    httpGet:
      scheme: HTTP
      path: /health
      port: 9428
    initialDelaySeconds: 30
    periodSeconds: 30
    timeoutSeconds: 5
    failureThreshold: 10

  # Indicates whether the Container is done with potentially costly initialization. If set it is executed first. If it fails Container is restarted. If it succeeds liveness and readiness probes takes over.
  startupProbe: {}
    #tcpSocket:
    #  port: http
    #failureThreshold: 30
    #periodSeconds: 15
    #successThreshold: 1
    #timeoutSeconds: 5

  # -- Security context to be added to server pods
  securityContext:
    allowPrivilegeEscalation: false
    capabilities:
      drop:
        - ALL
    readOnlyRootFilesystem: true

  # -- Pod's security context. Ref: [https://kubernetes.io/docs/tasks/configure-pod-container/security-context/](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/)
  podSecurityContext:
    fsGroup: 2000
    runAsNonRoot: true
    runAsUser: 1000

  ingress:
    # -- Enable deployment of ingress for server component
    enabled: false
    # -- Ingress annotations
    annotations:
    #   kubernetes.io/ingress.class: nginx
    #   kubernetes.io/tls-acme: 'true'

    # -- Ingress extra labels
    extraLabels: {}
    # -- Array of host objects

    hosts: []
    #   - name: vmselect.local
    #     path: /select
    #     port: http

    # -- Array of TLS objects
    tls: []
    #   - secretName: vmselect-ingress-tls
    #     hosts:
    #       - vmselect.local
    # For Kubernetes >= 1.18 you should specify the ingress-controller via the field ingressClassName
    # See https://kubernetes.io/blog/2020/04/02/improvements-to-the-ingress-api-in-kubernetes-1.18/#specifying-the-class-of-an-ingress
    # ingressClassName: nginx
    # -- pathType is only for k8s >= 1.1=
    pathType: Prefix

  service:
    # -- Service annotations
    annotations: {}
    # -- Service labels
    labels: {}
    # -- Service ClusterIP
    clusterIP: ""
    # -- Service External IPs. Ref: [https://kubernetes.io/docs/user-guide/services/#external-ips]( https://kubernetes.io/docs/user-guide/services/#external-ips)
    externalIPs: []
    # -- Service load balacner IP
    loadBalancerIP: ""
    # -- Load balancer source range
    loadBalancerSourceRanges: []
    # -- Service port
    servicePort: 9428
    # -- Node port
    # nodePort: 30000
    # -- Service type
    type: ClusterIP
    # Ref: https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/#preserving-the-client-source-ip
    # externalTrafficPolicy: "local"
    # healthCheckNodePort: 0

  statefulSet:
    # -- Creates statefulset instead of deployment, useful when you want to keep the cache
    enabled: true
    # -- Deploy order policy for StatefulSet pods
    podManagementPolicy: OrderedReady
    # Headless service for statefulset
    service:
      # -- Headless service annotations
      annotations: {}
      # -- Headless service labels
      labels: {}
      # -- Headless service port
      servicePort: 9428
      # Ref: https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/#preserving-the-client-source-ip
      # externalTrafficPolicy: "local"
      # healthCheckNodePort: 0
  # -- Pod's termination grace period in seconds
  terminationGracePeriodSeconds: 60
  serviceMonitor:
    # -- Enable deployment of Service Monitor for server component. This is Prometheus operator object
    enabled: false
    # -- Service Monitor labels
    extraLabels: {}
    # -- Service Monitor annotations
    annotations: {}
    # -- Commented. Prometheus scrape interval for server component
#    interval: 15s
    # -- Commented. Prometheus pre-scrape timeout for server component
#    scrapeTimeout: 5s
    # -- Commented. HTTP scheme to use for scraping.
#    scheme: https
    # -- Commented. TLS configuration to use when scraping the endpoint
#    tlsConfig:
#      insecureSkipVerify: true
    # -- Service Monitor relabelings
    relabelings: []

fluent-bit:
  # -- Enable deployment of fluent-bit
  enabled: false

  daemonSetVolumes:
    - name: varlog
      hostPath:
        path: /var/log
    - name: varlibdockercontainers
      hostPath:
        path: /var/lib/docker/containers

  daemonSetVolumeMounts:
    - name: varlog
      mountPath: /var/log
    - name: varlibdockercontainers
      mountPath: /var/lib/docker/containers
      readOnly: true

  resources: {}

  config:
    # -- Note that Host must be replaced to match your VictoriaLogs service name
    # Default format is: {{release_name}}-victoria-logs-single-server
    outputs: |
      [OUTPUT]
          Name http
          Match kube.*
          Host {{ .Release.Name }}-victoria-logs-single-server
          port 9428
          compress gzip
          uri /insert/jsonline?_stream_fields=stream,kubernetes_pod_name,kubernetes_container_name&_msg_field=log&_time_field=date
          format json_lines
          json_date_format iso8601
          header AccountID 0
          header ProjectID 0
    filters: |
      [FILTER]
          Name kubernetes
          Match kube.*
          Merge_Log On
          Keep_Log On
          K8S-Logging.Parser On
          K8S-Logging.Exclude On
      [FILTER]
          Name                nest
          Match               *
          Wildcard            pod_name
          Operation lift
          Nested_under kubernetes
          Add_prefix   kubernetes_

# Add extra specs dynamically to this chart
extraObjects: []
