[stable/kong] Options to install Prometheus plugin with ServiceMonitor (#14346)

* Options to install Prometheus plugin with ServiceMonitor

Signed-off-by: Roman Komkov <r.komkov@gmail.com>

* Changes after code review

Signed-off-by: Roman Komkov <roman.komkov@4finance.com>

* Removed ingressController and plugin dependency.

Signed-off-by: Roman Komkov <roman.komkov@4finance.com>

* Version bumped

Signed-off-by: Roman Komkov <roman.komkov@4finance.com>

* Remove helm-hook annotations

Signed-off-by: Roman Komkov <roman.komkov@4finance.com>

* Remove trailing whitespace

Signed-off-by: Roman Komkov <roman.komkov@4finance.com>
This commit is contained in:
Roman
2019-08-19 15:55:31 -07:00
committed by Kubernetes Prow Robot
parent f2f5e9ba1a
commit 75c2526783
6 changed files with 50 additions and 8 deletions
+1 -1
View File
@@ -12,5 +12,5 @@ maintainers:
name: kong
sources:
- https://github.com/Kong/kong
version: 0.15.2
version: 0.16.0
appVersion: 1.2
+10 -5
View File
@@ -110,6 +110,9 @@ and their default values.
| podDisruptionBudget.enabled | Enable PodDisruptionBudget for Kong | `false` |
| podDisruptionBudget.maxUnavailable | Represents the minimum number of Pods that can be unavailable (integer or percentage) | `50%` |
| podDisruptionBudget.minAvailable | Represents the number of Pods that must be available (integer or percentage) | |
| serviceMonitor.enabled | Create ServiceMonitor for Prometheus Operator | false |
| serviceMonitor.interval | Scrapping interval | 10s |
| serviceMonitor.namespace | Where to create ServiceMonitor | |
### Admin/Proxy listener override
@@ -118,12 +121,12 @@ the value provided by you as opposed to constructing a listen variable
from fields like `proxy.http.containerPort` and `proxy.http.enabled`. This allows
you to be more prescriptive when defining listen directives.
**Note:** Overriding `env.proxy_listen` and `env.admin_listen` will potentially cause
`admin.containerPort`, `proxy.http.containerPort` and `proxy.tls.containerPort` to become out of sync,
**Note:** Overriding `env.proxy_listen` and `env.admin_listen` will potentially cause
`admin.containerPort`, `proxy.http.containerPort` and `proxy.tls.containerPort` to become out of sync,
and therefore must be updated accordingly.
I.E. updatating to `env.proxy_listen: 0.0.0.0:4444, 0.0.0.0:4443 ssl` will need
`proxy.http.containerPort: 4444` and `proxy.tls.containerPort: 4443` to be set in order
I.E. updatating to `env.proxy_listen: 0.0.0.0:4444, 0.0.0.0:4443 ssl` will need
`proxy.http.containerPort: 4444` and `proxy.tls.containerPort: 4443` to be set in order
for the service definition to work properly.
### Kong-specific parameters
@@ -171,7 +174,7 @@ kong:
key: kong
name: postgres
```
For complete list of Kong configurations please check https://getkong.org/docs/latest/configuration/.
@@ -377,6 +380,7 @@ The custom resources are:
You can can learn about kong ingress custom resource definitions [here](https://github.com/Kong/kubernetes-ingress-controller/blob/master/docs/custom-resources.md).
| Parameter | Description | Default |
| ---------------------------------- | ------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
| enabled | Deploy the ingress controller, rbac and crd | false |
@@ -389,3 +393,4 @@ You can can learn about kong ingress custom resource definitions [here](https://
| podDisruptionBudget.enabled | Enable PodDisruptionBudget for ingress controller | `false` |
| podDisruptionBudget.maxUnavailable | Represents the minimum number of Pods that can be unavailable (integer or percentage) | `50%` |
| podDisruptionBudget.minAvailable | Represents the number of Pods that must be available (integer or percentage) | |
@@ -1,7 +1,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-kong-default-custom-server-blocks
name: {{ template "kong.fullname" . }}-default-custom-server-blocks
labels:
app: {{ template "kong.name" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
+1 -1
View File
@@ -264,7 +264,7 @@ spec:
volumes:
- name: custom-nginx-template-volume
configMap:
name: {{ .Release.Name }}-kong-default-custom-server-blocks
name: {{ template "kong.fullname" . }}-default-custom-server-blocks
{{- if (and (not .Values.ingressController.enabled) (eq .Values.env.database "off")) }}
- name: kong-custom-dbless-config-volume
configMap:
+29
View File
@@ -0,0 +1,29 @@
{{- if and ( .Capabilities.APIVersions.Has "monitoring.coreos.com/v1" ) .Values.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "kong.fullname" . }}
{{- if .Values.serviceMonitor.namespace }}
namespace: {{ .Values.serviceMonitor.namespace }}
{{- end }}
labels:
app: {{ template "kong.name" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
spec:
endpoints:
- targetPort: metrics
scheme: http
{{- if .Values.serviceMonitor.interval }}
interval: {{ .Values.serviceMonitor.interval }}
{{- end }}
jobLabel: {{ .Release.Name }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
selector:
matchLabels:
app: {{ template "kong.name" . }}
release: {{ .Release.Name }}
{{- end }}
+8
View File
@@ -396,6 +396,7 @@ ingressController:
podDisruptionBudget:
enabled: false
maxUnavailable: "50%"
# We pass the dbless (declarative) config over here.
dblessConfig:
# Either Kong's configuration is managed from an existing ConfigMap (with Key: kong.yml)
@@ -411,3 +412,10 @@ dblessConfig:
# - name: example
# paths:
# - "/example"
serviceMonitor:
# Specifies whether ServiceMonitor for Prometheus operator should be created
enabled: false
# interval: 10s
# Specifies namespace, where ServiceMonitor should be installed
# namespace: monitoring