## Global Docker image parameters
## Please, note that this will override the image parameters, including dependencies, configured to use the global value
## Current available global Docker image parameters: imageRegistry, imagePullSecrets and storageClass
##
# global:
#   imageRegistry: myRegistryName
#   imagePullSecrets:
#     - myRegistryKeySecretName
#   storageClass: myStorageClass

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

## Bitnami InfluxDB image
## ref: https://hub.docker.com/r/bitnami/influxdb/tags/
##
image:
  registry: docker.io
  repository: bitnami/influxdb
  tag: 1.8.3-debian-10-r0

  ## Specify a imagePullPolicy. Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
  ## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images
  ##
  pullPolicy: IfNotPresent
  ## Optionally specify an array of imagePullSecrets (secrets must be manually created in the namespace)
  ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
  ##
  # pullSecrets:
  #   - myRegistryKeySecretName

  ## Set to true if you would like to see extra information on logs
  ## ref:  https://github.com/bitnami/minideb-extras/#turn-on-bash-debugging
  ##
  debug: false

## String to partially override influxdb.fullname template (will maintain the release name)
##
# nameOverride:

## String to fully override influxdb.fullname template
##
# fullnameOverride:

## Kubernetes Cluster Domain
##
clusterDomain: cluster.local

## InfluxDB architecture. Allowed values: standalone or high-availability
##
architecture: standalone

## Database to be created on first run
## ref: https://github.com/bitnami/bitnami-docker-influxdb#creating-a-database-on-first-run
##
database: my_database

## Enable/disable authentication
## ref: https://github.com/bitnami/bitnami-docker-influxdb#allowing-empty-passwords
##
authEnabled: true

## InfluxDB admin credentials
##
adminUser:
  name: admin
  pwd:
  usePasswordFile: false
## InfluxDB credentials for user with 'admin' privileges on the db specified at 'database' parameter
##
user:
  name:
  pwd:
  usePasswordFile: false
## InfluxDB credentials for user with 'read' privileges on the db specified at 'database' parameter
##
readUser:
  name:
  pwd:
  usePasswordFile: false
## InfluxDB credentials for user with 'write' privileges on the db specified at 'database' parameter
##
writeUser:
  name:
  pwd:
  usePasswordFile: false

## Secret with InfluxDB credentials
## NOTE: This will override the users/passwords defined at adminUser, user, readUser and writeUser
##
# existingSecret:

## InfluxDB backend parameters
##
influxdb:
  ## InfluxDB Configuration
  ## Specify content for influxdb.conf
  ## Alternatively, you can put your influxdb.conf under the files/conf/ directory
  ##
  # configuration: |-
  #   reporting-disabled = false
  #   bind-address = "127.0.0.1:8088"
  #   [meta]
  #   dir = "/bitnami/influxdb/meta"
  #   ...

  ## ConfigMap with InfluxDB configuration
  ## NOTE: This will override influxdb.configuration
  ##
  # existingConfiguration:

  ## initdb scripts
  ## Specify dictionary of scripts to be run at first boot
  ## Alternatively, you can put your scripts under the files/docker-entrypoint-initdb.d directory
  ##
  # initdbScripts:
  #   my_init_script.sh: |
  #      #!/bin/sh
  #      echo "Do something."

  ## ConfigMap with scripts to be run at first boot
  ## NOTE: This will override initdbScripts
  ##
  # initdbScriptsCM

  ## Secret with scripts to be run at first boot (in case it contains sensitive information)
  ## NOTE: This can work along initdbScripts or initdbScriptsCM
  ##
  # initdbScriptsSecret:

  ## An array to add extra environment variables
  ## For example:
  ## extraEnvVars:
  ##  - name: INFLUXDB_DATA_QUERY_LOG_ENABLED
  ##    value: "true"
  ##
  # extraEnvVars:

  ## Number of InfluxDB replicas to deploy
  ##
  replicaCount: 1

  ## Update strategy, can be set to RollingUpdate or OnDelete by default.
  ## ref: https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/#updating-statefulsets
  ##
  updateStrategy: RollingUpdate

  ## Pod Management Policy can be OrderedReady or Parallel
  ## ref: https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/#parallel-pod-management
  ##
  podManagementPolicy: OrderedReady

  ## Pod AntiAffinity
  ## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
  ##
  antiAffinity: soft

  ## Node Affinity. The value is evaluated as a template.
  ## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#node-affinity-beta-feature
  ##
  nodeAffinity: {}

  ## Node labels for pod assignment. Evaluated as a template.
  ## Ref: https://kubernetes.io/docs/user-guide/node-selection/
  ##
  nodeSelector: {}

  ## Tolerations for pod assignment. Evaluated as a template.
  ## Ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/
  ##
  tolerations: {}

  ## K8s Security Context for InfluxDB pods
  ## https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
  ##
  securityContext:
    enabled: true
    fsGroup: 1001
    runAsUser: 1001

  ## InfluxDB pods' resource requests and limits
  ## ref: http://kubernetes.io/docs/user-guide/compute-resources/
  ##
  resources:
    # We usually recommend not to specify default resources and to leave this as a conscious
    # choice for the user. This also increases chances charts run on environments with little
    # resources, such as Minikube. If you do want to specify resources, uncomment the following
    # lines, adjust them as necessary, and remove the curly braces after 'resources:'.
    limits: {}
    #   cpu: 100m
    #   memory: 128Mi
    requests: {}
    #   cpu: 100m
    #   memory: 128Mi

  ## InfluxDB pods' liveness and readiness probes
  ## ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-probes
  ##
  livenessProbe:
    enabled: true
    initialDelaySeconds: 180
    periodSeconds: 45
    timeoutSeconds: 30
    successThreshold: 1
    failureThreshold: 6
  readinessProbe:
    enabled: true
    initialDelaySeconds: 60
    periodSeconds: 45
    timeoutSeconds: 30
    successThreshold: 1
    failureThreshold: 6

  ## Container ports
  ##
  containerPorts:
    http: 8086
    rpc: 8088

  ## Service paramaters
  ##
  service:
    ## Service type
    ##
    type: ClusterIP
    ## InfluxDB HTTP Port
    ##
    port: 8086
    ## InfluxDB RPC Port
    ##
    rpcPort: 8088
    ## Specify the nodePort(s) value for the LoadBalancer and NodePort service types.
    ## ref: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport
    ##
    nodePorts:
      http: ""
      rpc: ""
    ## Set the LoadBalancer service type to internal only.
    ## ref: https://kubernetes.io/docs/concepts/services-networking/service/#internal-load-balancer
    ##
    # loadBalancerIP:
    ## Load Balancer sources
    ## https://kubernetes.io/docs/tasks/access-application-cluster/configure-cloud-provider-firewall/#restrict-access-for-loadbalancer-service
    ##
    # loadBalancerSourceRanges:
    # - 10.10.10.0/24
    ## Set the Cluster IP to use
    ## ref: https://kubernetes.io/docs/concepts/services-networking/service/#choosing-your-own-ip-address
    ##
    # clusterIP: None
    ## Provide any additional annotations which may be required
    ##
    annotations: {}

## InfluxDB Relay parameters
##
relay:
  ## Bitnami InfluxDB Relay image
  ## ref: https://hub.docker.com/r/bitnami/influxdb-relay/tags/
  ##
  image:
    registry: docker.io
    repository: bitnami/influxdb-relay
    tag: 0.20200717.0-scratch-r1
    ## Specify a imagePullPolicy. Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
    ## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images
    ##
    pullPolicy: IfNotPresent
    ## Optionally specify an array of imagePullSecrets (secrets must be manually created in the namespace)
    ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
    ##
    # pullSecrets:
    #   - myRegistryKeySecretName

  ## InfluxDB Relay Configuration
  ## Specify content for relay.toml
  ## Alternatively, you can put your relay.toml under the files/conf/ directory
  ##
  configuration: |-
    [[http]]
    # Name of the HTTP server, used for display purposes only.
    name = "relay-server"

    # TCP address to bind to, for HTTP server.
    bind-addr = "0.0.0.0:9096"

    # Array of InfluxDB instances to use as backends for Relay.
    output = [
        {{- $influxdbReplicaCount := int .Values.influxdb.replicaCount }}
        {{- $influxdbFullname := include "influxdb.fullname" . }}
        {{- $influxdbHeadlessServiceName := printf "%s-headless" (include "influxdb.fullname" .) }}
        {{- $releaseName := .Release.Namespace }}
        {{- $clusterDomain:= .Values.clusterDomain }}
        {{- range $e, $i := until $influxdbReplicaCount }}
        { name="{{ $influxdbFullname }}-{{ $i }}", location="http://{{ $influxdbFullname }}-{{ $i }}.{{ $influxdbHeadlessServiceName }}.{{ $releaseName }}.svc.{{ $clusterDomain }}:8086/write", timeout="10s"},
        {{- end }}
    ]

  ## ConfigMap with InfluxDB Relay configuration
  ## NOTE: This will override relay.configuration
  ##
  # existingConfiguration:

  ## Number of InfluxDB Relay replicas to deploy
  ##
  replicaCount: 1

  ## Update strategy, can be set to RollingUpdate or OnDelete by default.
  ## ref: https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/#updating-statefulsets
  ##
  updateStrategy: RollingUpdate

  ## Pod AntiAffinity
  ## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
  ##
  antiAffinity: soft

  ## Node Affinity. The value is evaluated as a template.
  ## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#node-affinity-beta-feature
  ##
  nodeAffinity: {}

  ## Node labels for pod assignment. Evaluated as a template.
  ## Ref: https://kubernetes.io/docs/user-guide/node-selection/
  ##
  nodeSelector: {}

  ## Tolerations for pod assignment. Evaluated as a template.
  ## Ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/
  ##
  tolerations: {}

  ## K8s Security Context for InfluxDB pods
  ## https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
  ##
  securityContext:
    enabled: true
    fsGroup: 1001
    runAsUser: 1001

  ## InfluxDB Relay pods' resource requests and limits
  ## ref: http://kubernetes.io/docs/user-guide/compute-resources/
  ##
  resources:
    # We usually recommend not to specify default resources and to leave this as a conscious
    # choice for the user. This also increases chances charts run on environments with little
    # resources, such as Minikube. If you do want to specify resources, uncomment the following
    # lines, adjust them as necessary, and remove the curly braces after 'resources:'.
    limits: {}
    #   cpu: 100m
    #   memory: 128Mi
    requests: {}
    #   cpu: 100m
    #   memory: 128Mi

  ## InfluxDB Relay pods' liveness and readiness probes
  ## ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-probes
  ##
  livenessProbe:
    enabled: true
    initialDelaySeconds: 30
    periodSeconds: 10
    timeoutSeconds: 5
    successThreshold: 1
    failureThreshold: 6
  readinessProbe:
    enabled: true
    initialDelaySeconds: 5
    periodSeconds: 10
    timeoutSeconds: 5
    successThreshold: 1
    failureThreshold: 6

  ## Container ports
  ##
  containerPorts:
    http: 9096

  ## Service paramaters
  ##
  service:
    ## Service type
    ##
    type: ClusterIP
    ## InfluxDB Relay HTTP port
    ##
    port: 9096
    ## Specify the nodePort value for the LoadBalancer and NodePort service types.
    ## ref: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport
    ##
    nodePort: ""
    ## Set the LoadBalancer service type to internal only.
    ## ref: https://kubernetes.io/docs/concepts/services-networking/service/#internal-load-balancer
    ##
    # loadBalancerIP:
    ## Load Balancer sources
    ## https://kubernetes.io/docs/tasks/access-application-cluster/configure-cloud-provider-firewall/#restrict-access-for-loadbalancer-service
    ##
    # loadBalancerSourceRanges:
    # - 10.10.10.0/24
    ## Set the Cluster IP to use
    ## ref: https://kubernetes.io/docs/concepts/services-networking/service/#choosing-your-own-ip-address
    ##
    # clusterIP: None
    ## Provide any additional annotations which may be required
    ##
    annotations: {}

## Ingress paramaters
##
ingress:
  ## Set to true to enable ingress record generation
  enabled: false

  ## Set this to true in order to add the corresponding annotations for cert-manager
  certManager: false

  ## Ingress annotations done as key:value pairs
  ## For a full list of possible ingress annotations, please see
  ## ref: https://github.com/kubernetes/ingress-nginx/blob/master/docs/annotations.md
  ##
  ## If tls is set to true, annotation ingress.kubernetes.io/secure-backends: "true" will automatically be set
  ## If certManager is set to true, annotation kubernetes.io/tls-acme: "true" will automatically be set
  annotations:
  #  kubernetes.io/ingress.class: nginx

  ## The list of hostnames to be covered with this ingress record.
  ## Most likely this will be just one host, but in the event more hosts are needed, this is an array
  hosts:
    - name: influxdb.local
      path: /

  ## The tls configuration for the ingress
  ## see: https://kubernetes.io/docs/concepts/services-networking/ingress/#tls
  # tls:
  # - hosts:
  #   - influxdb.local
  #   secretName: influxdb.local-tls

  secrets:
  ## If you're providing your own certificates, please use this to add the certificates as secrets
  ## key and certificate should start with -----BEGIN CERTIFICATE----- or
  ## -----BEGIN RSA PRIVATE KEY-----
  ##
  ## name should line up with a tlsSecret set further up
  ## If you're using cert-manager, this is unneeded, as it will create the secret for you if it is not set
  ##
  ## It is also possible to create and manage the certificates outside of this helm chart
  ## Please see README.md for more information
  # - name: influxdb.local-tls
  #   key:
  #   certificate:

## Prometheus metrics
## ref: https://docs.influxdata.com/influxdb/v1.7/administration/server_monitoring/#influxdb-metrics-http-endpoint
##
metrics:
  enabled: false
  service:
    ## Service type
    ##
    type: ClusterIP
    ## InfluxDB Prometheus port
    ##
    port: 9122
    ## Specify the nodePort value for the LoadBalancer and NodePort service types.
    ## ref: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport
    ##
    nodePort: ""
    ## Set the LoadBalancer service type to internal only.
    ## ref: https://kubernetes.io/docs/concepts/services-networking/service/#internal-load-balancer
    ##
    # loadBalancerIP:
    ## Load Balancer sources
    ## https://kubernetes.io/docs/tasks/access-application-cluster/configure-cloud-provider-firewall/#restrict-access-for-loadbalancer-service
    ##
    # loadBalancerSourceRanges:
    # - 10.10.10.0/24
    ## Set the Cluster IP to use
    ## ref: https://kubernetes.io/docs/concepts/services-networking/service/#choosing-your-own-ip-address
    ##
    # clusterIP: None
    ## Annotations for the Prometheus metrics service
    ##
    annotations:
      prometheus.io/scrape: "true"
      prometheus.io/port: "{{ .Values.influxdb.service.port }}"
      prometheus.io/path: "/metrics"

  ## Prometheus Operator ServiceMonitor configuration
  ##
  serviceMonitor:
    enabled: false
    ## Namespace in which Prometheus is running
    ##
    # namespace: monitoring

    ## Interval at which metrics should be scraped.
    ## ref: https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#endpoint
    ##
    # interval: 10s

    ## Timeout after which the scrape is ended
    ## ref: https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#endpoint
    ##
    # scrapeTimeout: 10s

    ## ServiceMonitor selector labels
    ## ref: https://github.com/bitnami/charts/tree/master/bitnami/prometheus-operator#prometheus-configuration
    ##
    # selector:
    #   prometheus: my-prometheus

## NetworkPolicy paramaters
##
networkPolicy:
  enabled: false

  ## The Policy model to apply. When set to false, only pods with the correct
  ## client labels will have network access to the ports InfluxDB is listening
  ## on. When true, InfluxDB will accept connections from any source
  ## (with the correct destination port).
  ##
  allowExternal: true

## Persistence paramaters
##
persistence:
  enabled: true
  ## A manually managed Persistent Volume and Claim
  ## If defined, PVC must be created manually before volume will be bound
  ## The value is evaluated as a template
  ##
  # existingClaim:
  ## Persistent Volume Storage Class
  ## If defined, storageClassName: <storageClass>
  ## If set to "-", storageClassName: "", which disables dynamic provisioning
  ## If undefined (the default) or set to null, no storageClassName spec is
  ## set, choosing the default provisioner.
  ##
  # storageClass: "-"
  ## Persistent Volume Access Mode
  ##
  accessModes:
    - ReadWriteOnce
  ## Persistent Volume Claim size
  ##
  size: 8Gi

## Init Container paramaters
## Change the owner and group of the persistent volume mountpoint to 'runAsUser:fsGroup'
## values from the securityContext section.
##
volumePermissions:
  enabled: false
  ## Bitnami Minideb image
  ## ref: https://hub.docker.com/r/bitnami/minideb/tags/
  ##
  image:
    registry: docker.io
    repository: bitnami/minideb
    tag: buster
    ## Specify a imagePullPolicy. Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
    ## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images
    ##
    pullPolicy: Always
    ## Optionally specify an array of imagePullSecrets (secrets must be manually created in the namespace)
    ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
    ##
    # pullSecrets:
    #   - myRegistryKeySecretName
  ## Init container Security Context
  ## Note: the chown of the data folder is done to securityContext.runAsUser
  ## and not the below volumePermissions.securityContext.runAsUser
  ## When runAsUser is set to special value "auto", init container will try to chwon the
  ## data folder to autodetermined user&group, using commands: `id -u`:`id -G | cut -d" " -f2`
  ## "auto" is especially useful for OpenShift which has scc with dynamic userids (and 0 is not allowed).
  ## You may want to use this volumePermissions.securityContext.runAsUser="auto" in combination with
  ## pod securityContext.enabled=false and shmVolume.chmod.enabled=false
  ##
  securityContext:
    runAsUser: 0

## InfluxDB backup parameters
##
backup:
  enabled: false
  ## Directory where backups are stored
  ##
  directory: "/backups"
  ## Retention time in days for backups
  ##
  retentionDays: 10
  ## Cronjob configuration
  ## This cronjob is used to create InfluxDB backups
  ##
  cronjob:
    ## Schedule in Cron format to save snapshots
    ## See https://en.wikipedia.org/wiki/Cron
    ##
    schedule: "0 2 * * *"
    ## Number of successful finished jobs to retain
    ##
    historyLimit: 1
    ## Pod annotations
    ## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/
    ##
    podAnnotations: {}
    ## K8s Security Context for Backup Cronjob pods
    ## https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
    ##
    securityContext:
      enabled: true
      fsGroup: 1001
      runAsUser: 1001
  ## Storage providers where to upload backups
  ##
  uploadProviders:
    ## Google Storage Bucket configuration
    ##
    google:
      enabled: false
      secret: ""
      secretKey: "key.json"
      existingSecret: ""
      bucketName: "gs://bucket/influxdb"
      ## Bitnami Google Cloud SDK image
      ## ref: https://hub.docker.com/r/bitnami/google-cloud-sdk/tags/
      ##
      image:
        registry: docker.io
        repository: bitnami/google-cloud-sdk
        tag: 0.312.0-debian-10-r1

        ## Specify a imagePullPolicy. Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
        ## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images
        ##
        pullPolicy: IfNotPresent
        ## Optionally specify an array of imagePullSecrets (secrets must be manually created in the namespace)
        ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
        ##
        # pullSecrets:
        #   - myRegistryKeySecretName
    ## Azure Storage Container configuration
    ##
    azure:
      enabled: false
      secret: ""
      secretKey: "connection-string"
      existingSecret: ""
      containerName: "influxdb-container"
      ## Bitnami Azure CLI image
      ## ref: https://hub.docker.com/r/bitnami/azure-cli/tags/
      ##
      image:
        registry: docker.io
        repository: bitnami/azure-cli
        tag: 2.12.1-debian-10-r2

        ## Specify a imagePullPolicy. Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
        ## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images
        ##
        pullPolicy: IfNotPresent
        ## Optionally specify an array of imagePullSecrets (secrets must be manually created in the namespace)
        ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
        ##
        # pullSecrets:
        #   - myRegistryKeySecretName
