# Copyright Broadcom, Inc. All Rights Reserved.
# SPDX-License-Identifier: APACHE-2.0

http:
  http://127.0.0.1:{{ .Vars.containerPorts.http }}/api/v2/trees:
    status: 200
    body:
      - /vib_test/
  http://127.0.0.1:{{ .Vars.containerPorts.management }}/q/metrics:
    status: 200
    body:
      - /nessie_storage_persist/
  http://nessie:{{ .Vars.service.server.ports.http }}/api/v2/trees:
    status: 200
    body:
      - /vib_test/
  http://nessie-management:{{ .Vars.service.management.ports.http }}/q/metrics:
    status: 200
    body:
      - /nessie_storage_persist/

command:
  {{- $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
  check-configured-env-vars:
    exec: env
    exit-status: 0
    stdout:
      - /QUARKUS_LOG_LEVEL.*{{ .Vars.configOverrides.quarkus.log.level }}/
      {{- if not .Vars.usePasswordFiles }}
      # The secret configuration should be set via env
      - /QUARKUS_LOG_FILE_LEVEL.*{{ .Vars.secretConfigOverrides.quarkus.log.file.level }}/
      {{- end }}

{{- if .Vars.usePasswordFiles }}
# The secret configuration should be mounted as a file
file:
  /bitnami/nessie/secrets/configuration/QUARKUS_LOG_FILE_LEVEL:
    exists: true
    filetype: symlink
    contents:
      - /{{ .Vars.secretConfigOverrides.quarkus.log.file.level }}/
{{- end }}
