file:
  /opt/bitnami/grafana/data:
    filetype: directory
    exists: true
    mode: "2775"
  /opt/bitnami/grafana/data/plugins/{{ .Vars.plugins }}:
    filetype: directory
    exists: true
    mode: "2755"
command:
  grafana-cli-data-migration:
    exec: cd /opt/bitnami/grafana && grafana-cli admin data-migration encrypt-datasource-passwords
    exit-status: 0
    stdout:
      - /datasources.*already encrypted/
  {{- $uid := .Vars.containerSecurityContext.runAsUser }}
  {{- $gid := .Vars.podSecurityContext.fsGroup }}
  check-user-info:
    # The UID and GID should always be either the one specified as vars (always a bigger number that the default)
    # or the one randomly defined by openshift (larger values). Otherwise, the chart is still using the default value.
    exec: if [ $(id -u) -lt {{ $uid }} ] || [ $(id -G | awk '{print $2}') -lt {{ $gid }} ]; then exit 1; fi
    exit-status: 0
