http:
  http://localhost:{{ .Vars.containerPorts.console }}:
    status: 200
command:
  {{- $auth := printf "'%s' '%s'" .Vars.auth.rootUser .Vars.auth.rootPassword }}
  {{- $minio_cfg_name := printf "minio%s" (randAlpha 5) }}
  {{- $minio_bucket := printf "bucket%s" (randAlpha 5 | toLower) }}
  {{- $minio_endpoint := printf "http://minio:%d" .Vars.service.ports.api }}
  mc-make-bucket:
    exec: mc config host add {{ $minio_cfg_name }} {{ $minio_endpoint }} {{ $auth }} && mc mb {{ $minio_cfg_name }}/{{ $minio_bucket }} && mc ls {{ $minio_cfg_name }}
    exit-status: 0
    stdout:
      - "{{ $minio_bucket }}/"
  mc-list-buckets:
    exec: mc admin info local
    exit-status: 0
    stdout:
      - /Network.*OK/
      - /Drives.*OK/
  {{- $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
  {{ if .Vars.serviceAccount.automountServiceAccountToken }}
  check-sa:
    exec: cat /var/run/secrets/kubernetes.io/serviceaccount/token | cut -d '.' -f 2 | xargs -I '{}' echo '{}====' | fold -w 4 | sed '$ d' | tr -d '\n' | base64 -d
    exit-status: 0
    stdout:
    - /serviceaccount.*name.*{{.Env.BITNAMI_APP_NAME }}/
  {{ end }}
file:
  {{ .Vars.persistence.mountPath }}:
    filetype: directory
    exists: true
    mode: "2775"
    owner: root
