[deployment] add ingresses and service monitors

This commit is contained in:
Artem Navoiev 2019-08-18 00:37:14 +03:00
parent 38711526d3
commit ce7798a6a2
10 changed files with 213 additions and 10 deletions

View file

@ -1,5 +1,5 @@
apiVersion: v1
appVersion: "1.0"
description: A Helm chart for Kubernetes
appVersion: 1.26.0
description: Victoria Metrics Helm chart for Kubernetes
name: victoria-metrics
version: 0.1.0
version: 0.2.0

View file

@ -40,6 +40,12 @@ spec:
port: http
initialDelaySeconds: 5
periodSeconds: 15
livenessProbe:
tcpSocket:
port: http
initialDelaySeconds: 5
periodSeconds: 15
timeoutSeconds: 5
resources:
{{ toYaml .Values.vminsert.resources | indent 12 }}
{{- if .Values.imagePullSecrets }}

View file

@ -0,0 +1,29 @@
{{- if and .Values.vminsert.enabled .Values.vminsert.ingress.enabled }}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
{{- if .Values.vminsert.ingress.annotations }}
annotations:
{{ toYaml .Values.vminsert.ingress.annotations | indent 4 }}
{{- end }}
labels:
{{- include "victoria-metrics.vminsert.labels" . | nindent 4 }}
{{ toYaml .Values.vminsert.ingress.extraLabels | indent 4 }}
name: {{ template "victoria-metrics.vminsert.fullname" . }}
spec:
rules:
{{- $serviceName := include "victoria-metrics.vminsert.fullname" . }}
{{- range .Values.vminsert.ingress.hosts }}
- host: {{ .name }}
http:
paths:
- path: {{ .path }}
backend:
serviceName: {{ $serviceName }}
servicePort: http
{{- end -}}
{{- if .Values.vminsert.ingress.tls }}
tls:
{{ toYaml .Values.vminsert.ingress.tls | indent 4 }}
{{- end -}}
{{- end -}}

View file

@ -0,0 +1,28 @@
{{- if and .Values.vminsert.enabled .Values.vminsert.serviceMonitor.enabled -}}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
{{- if .Values.vminsert.serviceMonitor.annotations }}
annotations:
{{ toYaml .Values.vminsert.serviceMonitor.annotations | indent 4 }}
{{- end }}
labels:
{{- include "victoria-metrics.vminsert.labels" . | nindent 4 }}
{{ toYaml .Values.vminsert.serviceMonitor.extraLabels | indent 4 }}
name: {{ template "victoria-metrics.vminsert.fullname" . }}
spec:
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
selector:
matchLabels:
{{- include "victoria-metrics.vminsert.matchLabels" . | nindent 6 }}
endpoints:
- port: http
{{- if .Values.vminsert.serviceMonitor.interval }}
interval: {{ .Values.vminsert.serviceMonitor.interval }}
{{- end }}
{{- if .Values.vminsert.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ .Values.vminsert.serviceMonitor.scrapeTimeout }}
{{- end }}
{{- end }}

View file

@ -41,6 +41,12 @@ spec:
port: http
initialDelaySeconds: 5
periodSeconds: 15
livenessProbe:
tcpSocket:
port: http
initialDelaySeconds: 5
periodSeconds: 15
timeoutSeconds: 5
volumeMounts:
- mountPath: {{ .Values.vmselect.cacheMountPath }}
name: cache-volume

View file

@ -0,0 +1,29 @@
{{- if and .Values.vmselect.enabled .Values.vmselect.ingress.enabled }}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
{{- if .Values.vmselect.ingress.annotations }}
annotations:
{{ toYaml .Values.vmselect.ingress.annotations | indent 4 }}
{{- end }}
labels:
{{- include "victoria-metrics.vmselect.labels" . | nindent 4 }}
{{ toYaml .Values.vmselect.ingress.extraLabels | indent 4 }}
name: {{ template "victoria-metrics.vmselect.fullname" . }}
spec:
rules:
{{- $serviceName := include "victoria-metrics.vmselect.fullname" . }}
{{- range .Values.vmselect.ingress.hosts }}
- host: {{ .name }}
http:
paths:
- path: {{ .path }}
backend:
serviceName: {{ $serviceName }}
servicePort: http
{{- end -}}
{{- if .Values.vmselect.ingress.tls }}
tls:
{{ toYaml .Values.vmselect.ingress.tls | indent 4 }}
{{- end -}}
{{- end -}}

View file

@ -0,0 +1,28 @@
{{- if and .Values.vmselect.enabled .Values.vmselect.serviceMonitor.enabled -}}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
{{- if .Values.vmselect.serviceMonitor.annotations }}
annotations:
{{ toYaml .Values.vmselect.serviceMonitor.annotations | indent 4 }}
{{- end }}
labels:
{{- include "victoria-metrics.vmselect.labels" . | nindent 4 }}
{{ toYaml .Values.vmselect.serviceMonitor.extraLabels | indent 4 }}
name: {{ template "victoria-metrics.vmselect.fullname" . }}
spec:
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
selector:
matchLabels:
{{- include "victoria-metrics.vmselect.matchLabels" . | nindent 6 }}
endpoints:
- port: http
{{- if .Values.vmselect.serviceMonitor.interval }}
interval: {{ .Values.vmselect.serviceMonitor.interval }}
{{- end }}
{{- if .Values.vmselect.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ .Values.vmselect.serviceMonitor.scrapeTimeout }}
{{- end }}
{{- end }}

View file

@ -43,6 +43,12 @@ spec:
port: http
initialDelaySeconds: 5
periodSeconds: 15
livenessProbe:
tcpSocket:
port: http
initialDelaySeconds: 5
periodSeconds: 15
timeoutSeconds: 5
volumeMounts:
- mountPath: {{ .Values.vmselect.cacheMountPath }}
name: cache-volume

View file

@ -0,0 +1,28 @@
{{- if and .Values.vmstorage.enabled .Values.vmstorage.serviceMonitor.enabled -}}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
{{- if .Values.vmstorage.serviceMonitor.annotations }}
annotations:
{{ toYaml .Values.vmstorage.serviceMonitor.annotations | indent 4 }}
{{- end }}
labels:
{{- include "victoria-metrics.vmstorage.labels" . | nindent 4 }}
{{ toYaml .Values.vmstorage.serviceMonitor.extraLabels | indent 4 }}
name: {{ template "victoria-metrics.vmstorage.fullname" . }}
spec:
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
selector:
matchLabels:
{{- include "victoria-metrics.vmstorage.matchLabels" . | nindent 6 }}
endpoints:
- port: http
{{- if .Values.vmstorage.serviceMonitor.interval }}
interval: {{ .Values.vmstorage.serviceMonitor.interval }}
{{- end }}
{{- if .Values.vmstorage.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ .Values.vmstorage.serviceMonitor.scrapeTimeout }}
{{- end }}
{{- end }}

View file

@ -28,8 +28,7 @@ vmselect:
## Ref: https://kubernetes.io/docs/user-guide/node-selection/
##
nodeSelector: {}
podAnnotations:
prometheus.io/scrape: "true"
podAnnotations: {}
replicaCount: 2
resources: {}
# limits:
@ -53,6 +52,21 @@ vmselect:
loadBalancerSourceRanges: []
servicePort: 8481
type: ClusterIP
ingress:
enabled: false
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: 'true'
extraLabels: {}
hosts: []
# - name: vmselect.local
# path: /select
tls: []
# - secretName: vmselect-ingress-tls
# hosts:
# - vmselect.local
statefulSet:
## Creates statefulset instead of deployment, useful when you want to keep the cache
enabled: false
@ -83,6 +97,12 @@ vmselect:
##
size: 2Gi
subPath: ""
serviceMonitor:
enabled: false
extraLabels: {}
annotations: {}
# interval: 15s
# scrapeTimeout: 5s
vminsert:
enabled: true
@ -105,8 +125,7 @@ vminsert:
## Ref: https://kubernetes.io/docs/user-guide/node-selection/
##
nodeSelector: {}
podAnnotations:
prometheus.io/scrape: "true"
podAnnotations: {}
replicaCount: 2
resources: {}
# limits:
@ -127,6 +146,26 @@ vminsert:
loadBalancerSourceRanges: []
servicePort: 8480
type: ClusterIP
ingress:
enabled: false
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: 'true'
extraLabels: {}
hosts: []
# - name: vminsert.local
# path: /insert
tls: []
# - secretName: vminsert-ingress-tls
# hosts:
# - vminsert.local
serviceMonitor:
enabled: false
extraLabels: {}
annotations: {}
# interval: 15s
# scrapeTimeout: 5s
vmstorage:
enabled: true
@ -215,9 +254,7 @@ vmstorage:
subPath: ""
podAnnotations: {
prometheus.io/scrape: "true"
}
podAnnotations: {}
replicaCount: 2
podManagementPolicy: OrderedReady
@ -241,3 +278,9 @@ vmstorage:
vminsertPort: 8400
vmselectPort: 8401
terminationGracePeriodSeconds: 60
serviceMonitor:
enabled: false
extraLabels: {}
annotations: {}
# interval: 15s
# scrapeTimeout: 5s