Files
movienight-backend/deploy/helm/movienight/templates/observability/vmagent.yaml
T

170 lines
6.0 KiB
YAML

{{- if and .Values.observability.enabled .Values.observability.vmagent.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "movienight.vmagentName" . }}
labels:
{{- include "movienight.componentLabels" (dict "root" . "component" "vmagent") | nindent 4 }}
{{- with .Values.global.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
data:
scrape.yaml: |
global:
scrape_interval: {{ .Values.observability.vmagent.scrapeInterval }}
scrape_timeout: {{ .Values.observability.vmagent.scrapeTimeout }}
scrape_configs:
{{- if .Values.backend.enabled }}
- job_name: {{ .Values.observability.vmagent.backendJobName | quote }}
metrics_path: /actuator/prometheus
static_configs:
- targets:
- {{ include "movienight.backendMetricsTarget" . | quote }}
labels:
app: {{ include "movienight.name" . | quote }}
release: {{ .Release.Name | quote }}
namespace: {{ .Release.Namespace | quote }}
{{- end }}
- job_name: {{ printf "%s-vmagent" (include "movienight.name" .) | quote }}
static_configs:
- targets:
- {{ printf "%s:%v" (include "movienight.vmagentName" .) .Values.observability.vmagent.service.port | quote }}
labels:
app: {{ include "movienight.name" . | quote }}
release: {{ .Release.Name | quote }}
namespace: {{ .Release.Namespace | quote }}
{{- if .Values.observability.victoriaMetrics.enabled }}
- job_name: {{ printf "%s-victoriametrics" (include "movienight.name" .) | quote }}
static_configs:
- targets:
- {{ printf "%s:%v" (include "movienight.victoriaMetricsName" .) .Values.observability.victoriaMetrics.service.port | quote }}
labels:
app: {{ include "movienight.name" . | quote }}
release: {{ .Release.Name | quote }}
namespace: {{ .Release.Namespace | quote }}
{{- end }}
{{- with .Values.observability.vmagent.extraScrapeConfigs }}
{{- toYaml . | nindent 6 }}
{{- end }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "movienight.vmagentName" . }}
labels:
{{- include "movienight.componentLabels" (dict "root" . "component" "vmagent") | nindent 4 }}
{{- with .Values.global.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
replicas: 1
selector:
matchLabels:
{{- include "movienight.componentSelectorLabels" (dict "root" . "component" "vmagent") | nindent 6 }}
template:
metadata:
labels:
{{- include "movienight.componentSelectorLabels" (dict "root" . "component" "vmagent") | nindent 8 }}
{{- with .Values.observability.vmagent.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.observability.vmagent.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
serviceAccountName: {{ include "movienight.serviceAccountName" . }}
{{- with .Values.global.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.observability.vmagent.podSecurityContext }}
securityContext:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: vmagent
image: "{{ .Values.observability.vmagent.image.repository }}:{{ .Values.observability.vmagent.image.tag }}"
imagePullPolicy: {{ .Values.observability.vmagent.image.pullPolicy }}
args:
- -promscrape.config=/etc/vmagent/scrape.yaml
- -remoteWrite.url={{ include "movienight.vmagentRemoteWriteURL" . }}
- -httpListenAddr=:{{ .Values.observability.vmagent.service.port }}
{{- with .Values.observability.vmagent.extraArgs }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.observability.vmagent.securityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
{{- end }}
ports:
- name: http
containerPort: {{ .Values.observability.vmagent.service.port }}
protocol: TCP
readinessProbe:
httpGet:
path: /-/ready
port: http
initialDelaySeconds: 5
periodSeconds: 10
timeoutSeconds: 5
livenessProbe:
httpGet:
path: /-/healthy
port: http
initialDelaySeconds: 10
periodSeconds: 30
timeoutSeconds: 5
{{- with .Values.observability.vmagent.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
volumeMounts:
- name: config
mountPath: /etc/vmagent
readOnly: true
- name: tmp
mountPath: /tmp
volumes:
- name: config
configMap:
name: {{ include "movienight.vmagentName" . }}
- name: tmp
emptyDir: {}
{{- with .Values.observability.vmagent.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.observability.vmagent.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.observability.vmagent.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ include "movienight.vmagentName" . }}
labels:
{{- include "movienight.componentLabels" (dict "root" . "component" "vmagent") | nindent 4 }}
{{- with .Values.global.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
type: {{ .Values.observability.vmagent.service.type }}
ports:
- name: http
port: {{ .Values.observability.vmagent.service.port }}
targetPort: http
protocol: TCP
selector:
{{- include "movienight.componentSelectorLabels" (dict "root" . "component" "vmagent") | nindent 4 }}
{{- end }}