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

http:
  https://kong:{{ .Vars.service.ports.proxyHttps }}:
    # The proxy does respond but the route is not registered
    status: 404
    allow-insecure: true
  https://kong:{{ .Vars.service.ports.adminHttps }}:
    status: 200
    allow-insecure: true
file:
  /opt/bitnami/kong/conf/kong.conf:
    exists: true
    filetype: file
    mode: '0644'
    contents:
      - /pg_user.*{{ .Vars.postgresql.auth.username }}/
      - /pg_database.*{{ .Vars.postgresql.auth.database }}/
      - /pg_password.*{{ .Vars.postgresql.auth.password }}/
  /opt/bitnami/kong/server/nginx-kong.conf:
    exists: true
    filetype: file
    mode: '0644'
    contents:
      - /listen.*{{ .Vars.kong.containerPorts.proxyHttp }}/
      - /listen.*{{ .Vars.kong.containerPorts.adminHttp }}/
      - /listen.*{{ .Vars.kong.containerPorts.proxyHttps }}.*ssl/
      - /listen.*{{ .Vars.kong.containerPorts.adminHttps }}.*ssl/
command:
  {{- $uid := .Vars.containerSecurityContext.runAsUser }}
  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 }} ]; then exit 1; fi
    exit-status: 0
