Files
charts/bitnami/kong/templates/metrics-script-configmap.yaml
Juan Ariza Toledano 1469a8aaea [bitnami/kong] Chart standardized (#9348)
* [bitnami/kong] Chart standardized

Signed-off-by: juan131 <juanariza@vmware.com>

* Include requested changes

Signed-off-by: juan131 <juan.ariza.1311993@gmail.com>

* [bitnami/kong] Update components versions

Signed-off-by: Bitnami Containers <containers@bitnami.com>

Co-authored-by: Bitnami Containers <containers@bitnami.com>
2022-03-11 13:54:07 +01:00

37 lines
1.5 KiB
YAML

{{- if .Values.metrics.enabled -}}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "common.names.fullname" . }}-metrics-scripts
namespace: {{ .Release.Namespace }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: server
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
data:
enable-metrics-plugin.sh: |-
#!/bin/bash
. /opt/bitnami/scripts/libos.sh
. /opt/bitnami/scripts/libkong.sh
info "Enabling prometheus plugin"
if curl --silent http://localhost:{{ .Values.kong.containerPorts.adminHttp }}/ | grep -Eo '"prometheus":false' > /dev/null; then
if ! curl --silent http://localhost:{{ .Values.kong.containerPorts.adminHttp }}/plugins -d name=prometheus; then
info "Issue enabling prometheus plugin, this could be due to a race condition with another kong node. Checking status"
fi
if curl http://localhost:{{ .Values.kong.containerPorts.adminHttp }}/ | grep -Eo '"prometheus":true' > /dev/null; then
info "Prometheus metrics plugin enabled"
else
error "Error enabling Prometheus plugin"
exit 1
fi
else
info "Prometheus plugin already enabled"
fi
{{- end }}