file:
  {{ .Vars.loki.dataDir }}/conf/loki.yaml:
    mode: "0644"
    filetype: file
    exists: true
    owner: root
    contains:
    - "memcachedchunks:{{ .Vars.memcachedchunks.service.ports.memcached }}"
    - "memcachedfrontend:{{ .Vars.memcachedfrontend.service.ports.memcached }}"
    - "memcachedindexqueries:{{ .Vars.memcachedindexqueries.service.ports.memcached }}"
    - /http_listen_port.*{{ .Vars.loki.containerPorts.http }}/
http:
  # As we need to make several API requests, we'll use different services (and pods)
  # to at the same time test most of them are working properly. For those services not used here,
  # we suppose they are running as expected given that all follow the same arch
  http://grafana-loki-distributor:{{ .Vars.distributor.service.ports.http }}/services:
    status: 200
    body:
    - "!Stopping"
    - "!Terminated"
    - "!Failed"
  http://grafana-loki-ingester:{{ .Vars.ingester.service.ports.http }}/config:
    status: 200
    body:
    - /advertise_port.*{{ .Vars.loki.containerPorts.gossipRing }}/
  http://grafana-loki-compactor:{{ .Vars.compactor.service.ports.http }}/compactor/ring:
    status: 200
    body:
    - ACTIVE
addr:
  tcp://grafana-loki-gossip-ring:{{ .Vars.loki.gossipRing.service.ports.http }}:
    reachable: true
command:
  check-logcli:
    exec: logcli instant-query --addr=http://grafana-loki-querier:{{ .Vars.querier.service.ports.http }} '{app="grafana-loki"}'
    exit-status: 0
  {{- $uid := .Vars.querier.containerSecurityContext.runAsUser }}
  {{- $gid := .Vars.querier.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
