From 9799f2048d36adea79e3ad421c9b873375bd532f Mon Sep 17 00:00:00 2001 From: Amath SARR Date: Wed, 3 Jul 2019 18:08:32 +0100 Subject: [PATCH] [stable/kong] add nginx custom template feature via config map (#15079) * [stable/kong] added custom nginx template injection capability via config map Signed-off-by: Amath Sarr * [stable/kong] bump version Signed-off-by: Amath Sarr * [stable/kong] added missing space in comment Signed-off-by: Amath Sarr * [stable/kong] bump app version to 0.14.0 Signed-off-by: Amath Sarr * [stable/kong] removed configurable configmap and extra pod ports not necessary anymore Signed-off-by: Amath Sarr * [stable/kong] remove metrics for controller cause it's hardly used and expose metric port in other kong pods Signed-off-by: Amath Sarr --- stable/kong/Chart.yaml | 2 +- .../config-custom-server-blocks.yaml | 29 +++++++++++++++++++ stable/kong/templates/deployment.yaml | 13 +++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 stable/kong/templates/config-custom-server-blocks.yaml diff --git a/stable/kong/Chart.yaml b/stable/kong/Chart.yaml index bb6aafd19fb3..95fd7e9b6054 100644 --- a/stable/kong/Chart.yaml +++ b/stable/kong/Chart.yaml @@ -10,5 +10,5 @@ maintainers: name: kong sources: - https://github.com/Kong/kong -version: 0.13.0 +version: 0.14.0 appVersion: 1.2 diff --git a/stable/kong/templates/config-custom-server-blocks.yaml b/stable/kong/templates/config-custom-server-blocks.yaml new file mode 100644 index 000000000000..f737209c5895 --- /dev/null +++ b/stable/kong/templates/config-custom-server-blocks.yaml @@ -0,0 +1,29 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: kong-default-custom-server-blocks + labels: + app: {{ template "kong.name" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +data: + servers.conf: | + # Prometheus metrics server + server { + server_name kong_prometheus_exporter; + listen 0.0.0.0:9542; # can be any other port as well + access_log off; + location /metrics { + default_type text/plain; + content_by_lua_block { + local prometheus = require "kong.plugins.prometheus.exporter" + prometheus:collect() + } + } + location /nginx_status { + internal; + access_log off; + stub_status; + } + } \ No newline at end of file diff --git a/stable/kong/templates/deployment.yaml b/stable/kong/templates/deployment.yaml index fcc21b3de0f9..42a8a4d6f963 100644 --- a/stable/kong/templates/deployment.yaml +++ b/stable/kong/templates/deployment.yaml @@ -136,6 +136,8 @@ spec: {{- include "kong.license" . | nindent 8 }} {{- end }} {{- include "kong.env" . | indent 8 }} + - name: KONG_NGINX_HTTP_INCLUDE + value: /kong/servers.conf {{- if .Values.postgresql.enabled }} - name: KONG_PG_HOST value: {{ template "kong.postgresql.fullname" . }} @@ -174,6 +176,9 @@ spec: {{- end}} protocol: TCP {{- end }} + - name: metrics + containerPort: 9542 + protocol: TCP {{- if .Values.enterprise.enabled }} {{- if .Values.manager.http.enabled }} - name: manager @@ -224,6 +229,9 @@ spec: protocol: TCP {{- end }} {{- end }} + volumeMounts: + - name: custom-nginx-template-volume + mountPath: /kong readinessProbe: {{ toYaml .Values.readinessProbe | indent 10 }} livenessProbe: @@ -240,3 +248,8 @@ spec: {{- end }} tolerations: {{ toYaml .Values.tolerations | indent 8 }} + volumes: + - name: custom-nginx-template-volume + configMap: + name: kong-default-custom-server-blocks +