added repo
This commit is contained in:
@@ -0,0 +1 @@
|
||||
1. ElastAlert 2 is now running against: {{ .Values.elasticsearch.host }}:{{ .Values.elasticsearch.port }}
|
||||
@@ -0,0 +1,36 @@
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "elastalert.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create a default fully qualified app name.
|
||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||
If release name contains chart name it will be used as a full name.
|
||||
*/}}
|
||||
{{- define "elastalert.fullname" -}}
|
||||
{{- if .Values.fullnameOverride -}}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
||||
{{- if contains $name .Release.Name -}}
|
||||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create the name of the service account to use
|
||||
*/}}
|
||||
{{- define "elastalert.serviceAccountName" -}}
|
||||
{{- if .Values.serviceAccount.create -}}
|
||||
{{ default (include "elastalert.fullname" .) .Values.serviceAccount.name }}
|
||||
{{- else -}}
|
||||
{{ default "default" .Values.serviceAccount.name }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,18 @@
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Kubernetes standard labels
|
||||
*/}}
|
||||
{{- define "common.labels.standard" -}}
|
||||
app.kubernetes.io/name: {{ include "common.names.name" . }}
|
||||
helm.sh/chart: {{ include "common.names.chart" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Labels to use on deploy.spec.selector.matchLabels and svc.spec.selector
|
||||
*/}}
|
||||
{{- define "common.labels.matchLabels" -}}
|
||||
app.kubernetes.io/name: {{ include "common.names.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,60 @@
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "common.names.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create chart name and version as used by the chart label.
|
||||
*/}}
|
||||
{{- define "common.names.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create a default fully qualified app name.
|
||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||
If release name contains chart name it will be used as a full name.
|
||||
*/}}
|
||||
{{- define "common.names.fullname" -}}
|
||||
{{- if .Values.fullnameOverride -}}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
||||
{{- if contains $name .Release.Name -}}
|
||||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "common.names.servicename" -}}
|
||||
{{- $name := include "common.names.fullname" . | trunc 53 -}}
|
||||
{{- printf "%s-%s" $name "metrics" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "common.names.configname" -}}
|
||||
{{- $name := include "common.names.fullname" . | trunc 53 -}}
|
||||
{{- printf "%s-%s" $name "config" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Allow the release namespace to be overridden for multi-namespace deployments in combined charts.
|
||||
*/}}
|
||||
{{- define "common.names.namespace" -}}
|
||||
{{- if .Values.namespaceOverride -}}
|
||||
{{- .Values.namespaceOverride -}}
|
||||
{{- else -}}
|
||||
{{- .Release.Namespace -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create a fully qualified app name adding the installation's namespace.
|
||||
*/}}
|
||||
{{- define "common.names.fullname.namespace" -}}
|
||||
{{- printf "%s-%s" (include "common.names.fullname" .) (include "common.names.namespace" .) | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,13 @@
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Renders a value that contains template.
|
||||
Usage:
|
||||
{{ include "common.tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $) }}
|
||||
*/}}
|
||||
{{- define "common.tplvalues.render" -}}
|
||||
{{- if typeIs "string" .value }}
|
||||
{{- tpl .value .context }}
|
||||
{{- else }}
|
||||
{{- tpl (.value | toYaml) .context }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,51 @@
|
||||
{{- if not .Values.secretConfigName }}
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ template "common.names.configname" . }}
|
||||
namespace: {{ include "common.names.namespace" . | quote }}
|
||||
labels: {{- include "common.labels.standard" . | nindent 4 }}
|
||||
{{- if .Values.commonLabels }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
data:
|
||||
elastalert_config: |-
|
||||
---
|
||||
rules_folder: {{ .Values.rulesFolder }}
|
||||
{{- if .Values.scanSubdirectories }}
|
||||
scan_subdirectories: {{ .Values.scanSubdirectories }}
|
||||
{{- end }}
|
||||
run_every:
|
||||
minutes: {{ .Values.runIntervalMins }}
|
||||
{{- if .Values.realertIntervalMins }}
|
||||
realert:
|
||||
minutes: {{ .Values.realertIntervalMins }}
|
||||
{{- end }}
|
||||
buffer_time:
|
||||
minutes: {{ .Values.bufferTimeMins }}
|
||||
es_host: {{ .Values.elasticsearch.host }}
|
||||
es_port: {{ .Values.elasticsearch.port }}
|
||||
{{- if .Values.elasticsearch.username }}
|
||||
es_username: {{ .Values.elasticsearch.username }}
|
||||
{{- end }}
|
||||
{{- if .Values.elasticsearch.password }}
|
||||
es_password: {{ .Values.elasticsearch.password }}
|
||||
{{- end }}
|
||||
writeback_index: {{ .Values.writebackIndex }}
|
||||
use_ssl: {{ .Values.elasticsearch.useSsl }}
|
||||
verify_certs: {{ .Values.elasticsearch.verifyCerts }}
|
||||
{{- if .Values.elasticsearch.clientCert }}
|
||||
client_cert: {{ .Values.elasticsearch.clientCert }}
|
||||
{{- end }}
|
||||
{{- if .Values.elasticsearch.clientKey }}
|
||||
client_key: {{ .Values.elasticsearch.clientKey }}
|
||||
{{- end }}
|
||||
{{- if .Values.elasticsearch.caCerts }}
|
||||
ca_certs: {{ .Values.elasticsearch.caCerts }}
|
||||
{{- end }}
|
||||
alert_time_limit:
|
||||
minutes: {{ .Values.alertRetryLimitMins }}
|
||||
{{- if .Values.extraConfigOptions }}
|
||||
{{ toYaml .Values.extraConfigOptions | indent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,182 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ template "elastalert.fullname" . }}
|
||||
namespace: {{ include "common.names.namespace" . | quote }}
|
||||
labels:
|
||||
{{- if .Values.commonLabels }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
app: {{ template "elastalert.name" . }}
|
||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
{{- if .Values.deploymentAnnotations }}
|
||||
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.deploymentAnnotations "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "common.labels.matchLabels" . | nindent 6 }}
|
||||
replicas: {{ .Values.replicaCount }}
|
||||
{{- if .Values.updateStrategy }}
|
||||
strategy: {{- toYaml .Values.updateStrategy | nindent 4 }}
|
||||
{{- end }}
|
||||
revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
|
||||
minReadySeconds: {{ .Values.minReadySeconds }}
|
||||
template:
|
||||
metadata:
|
||||
annotations:
|
||||
checksum/config: {{ include (print $.Template.BasePath "/config.yaml") . | sha256sum }}
|
||||
checksum/rules: {{ include (print $.Template.BasePath "/rules.yaml") . | sha256sum }}
|
||||
{{- if .Values.metrics.enabled }}
|
||||
{{ toYaml .Values.metrics.prometheusScrapeAnnotations | indent 8 }}
|
||||
prometheus.io/port: {{ .Values.metrics.prometheusPort | quote}}
|
||||
{{- end }}
|
||||
{{- if .Values.podAnnotations }}
|
||||
{{ toYaml .Values.podAnnotations | indent 8 }}
|
||||
{{- end }}
|
||||
labels: {{- include "common.labels.standard" . | nindent 8 }}
|
||||
app.kubernetes.io/component: {{ .Values.appKubernetesIoComponent }}
|
||||
{{- if .Values.commonLabels }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if .Values.image.pullSecret }}
|
||||
imagePullSecrets:
|
||||
- name: {{ .Values.image.pullSecret }}
|
||||
{{- end }}
|
||||
serviceAccountName: {{ include "elastalert.serviceAccountName" . }}
|
||||
{{- if .Values.podSecurityContext }}
|
||||
securityContext:
|
||||
{{ toYaml .Values.podSecurityContext | indent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.extraInitContainers }}
|
||||
initContainers:
|
||||
{{ .Values.extraInitContainers | toYaml | indent 6}}
|
||||
{{- end }}
|
||||
containers:
|
||||
{{- if .Values.extraContainers }}
|
||||
{{ .Values.extraContainers | toYaml | indent 6}}
|
||||
{{- end }}
|
||||
- name: elastalert
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
{{- if .Values.metrics.enabled }}
|
||||
ports:
|
||||
- containerPort: {{ .Values.metrics.prometheusPort }}
|
||||
protocol: TCP
|
||||
name: {{ .Values.metrics.prometheusPortName }}
|
||||
{{- end }}
|
||||
{{- if .Values.securityContext }}
|
||||
securityContext:
|
||||
{{ toYaml .Values.securityContext | indent 10 }}
|
||||
{{- end }}
|
||||
{{- if .Values.command }}
|
||||
command:
|
||||
{{ toYaml .Values.command | indent 10 }}
|
||||
{{- end }}
|
||||
|
||||
{{- if or .Values.args .Values.metrics.enabled }}
|
||||
args:
|
||||
{{- if .Values.args }}
|
||||
{{ toYaml .Values.args | indent 10 }}
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.enabled }}
|
||||
{{- $enableportlist := list "--prometheus_port" (.Values.metrics.prometheusPort | toString) }}
|
||||
{{ toYaml $enableportlist | indent 10 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: '/opt/elastalert/config.yaml'
|
||||
subPath: config.yaml
|
||||
- name: {{ .Values.rulesVolumeName }}
|
||||
mountPath: {{ .Values.rulesFolder }}
|
||||
{{- if .Values.elasticsearch.certsVolumeMounts }}
|
||||
{{ toYaml .Values.elasticsearch.certsVolumeMounts | indent 10 }}
|
||||
{{- end }}
|
||||
{{- if .Values.extraVolumeMounts }}
|
||||
{{ toYaml .Values.extraVolumeMounts | indent 10 }}
|
||||
{{- end }}
|
||||
resources:
|
||||
{{ toYaml .Values.resources | indent 12 }}
|
||||
{{- if .Values.livenessProbe.enabled }}
|
||||
livenessProbe:
|
||||
{{ toYaml .Values.livenessProbe | indent 10 }}
|
||||
{{- end }}
|
||||
{{- if .Values.readinessProbe.enabled }}
|
||||
readinessProbe:
|
||||
{{ toYaml .Values.readinessProbe | indent 10 }}
|
||||
{{- end }}
|
||||
env:
|
||||
{{- if .Values.elasticsearch.credentialsSecret }}
|
||||
{{- if .Values.elasticsearch.credentialsSecretUsernameKey }}
|
||||
- name: ES_USERNAME
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ .Values.elasticsearch.credentialsSecret }}
|
||||
key: {{ .Values.elasticsearch.credentialsSecretUsernameKey }}
|
||||
{{- end }}
|
||||
{{- if .Values.elasticsearch.credentialsSecretPasswordKey }}
|
||||
- name: ES_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ .Values.elasticsearch.credentialsSecret }}
|
||||
key: {{ .Values.elasticsearch.credentialsSecretPasswordKey }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.optEnv }}
|
||||
{{ .Values.optEnv | toYaml | indent 10}}
|
||||
{{- end }}
|
||||
|
||||
restartPolicy: Always
|
||||
{{- if .Values.tolerations }}
|
||||
tolerations:
|
||||
{{ toYaml .Values.tolerations | indent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{ toYaml .Values.nodeSelector | indent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.affinity }}
|
||||
affinity:
|
||||
{{ toYaml .Values.affinity | indent 8 }}
|
||||
{{- end }}
|
||||
volumes:
|
||||
- name: rules
|
||||
{{- if .Values.secretRulesName }}
|
||||
secret:
|
||||
secretName: {{ .Values.secretRulesName }}
|
||||
items:
|
||||
{{- range $key := .Values.secretRulesList }}
|
||||
- key: {{ $key }}
|
||||
path: {{ $key}}.yaml
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
configMap:
|
||||
name: {{ template "elastalert.fullname" . }}-rules
|
||||
items:
|
||||
{{- range $key, $value := .Values.rules }}
|
||||
- key: {{ $key }}
|
||||
path: {{ $key}}.yaml
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
- name: config
|
||||
{{- if .Values.secretConfigName }}
|
||||
secret:
|
||||
secretName: {{ .Values.secretConfigName }}
|
||||
{{- else }}
|
||||
configMap:
|
||||
name: {{ template "elastalert.fullname" . }}-config
|
||||
{{- end }}
|
||||
items:
|
||||
- key: elastalert_config
|
||||
path: config.yaml
|
||||
{{- if .Values.elasticsearch.certsVolumes }}
|
||||
{{ toYaml .Values.elasticsearch.certsVolumes | indent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.extraVolumes }}
|
||||
{{ toYaml .Values.extraVolumes | indent 8 }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,39 @@
|
||||
{{- if .Values.podSecurityPolicy.create }}
|
||||
apiVersion: policy/v1beta1
|
||||
kind: PodSecurityPolicy
|
||||
metadata:
|
||||
name: {{ template "elastalert.fullname" . }}
|
||||
namespace: {{ include "common.names.namespace" . | quote }}
|
||||
labels: {{- include "common.labels.standard" . | nindent 4 }}
|
||||
{{- if .Values.commonLabels }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
# Prevents running in privileged mode
|
||||
privileged: false
|
||||
# Required to prevent escalations to root.
|
||||
allowPrivilegeEscalation: false
|
||||
volumes:
|
||||
- configMap
|
||||
- secret
|
||||
hostNetwork: false
|
||||
hostIPC: false
|
||||
hostPID: false
|
||||
runAsUser:
|
||||
rule: RunAsAny
|
||||
seLinux:
|
||||
rule: RunAsAny
|
||||
supplementalGroups:
|
||||
rule: MustRunAs
|
||||
ranges:
|
||||
# Forbid adding the root group.
|
||||
- min: 1
|
||||
max: 65535
|
||||
fsGroup:
|
||||
rule: MustRunAs
|
||||
ranges:
|
||||
# Forbid adding the root group.
|
||||
- min: 1
|
||||
max: 65535
|
||||
readOnlyRootFilesystem: false
|
||||
{{- end }}
|
||||
@@ -0,0 +1,19 @@
|
||||
{{- if and .Values.metrics.enabled .Values.metrics.prometheusRule.enabled }}
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: PrometheusRule
|
||||
metadata:
|
||||
name: {{ template "common.names.fullname" . }}
|
||||
namespace: {{ .Values.metrics.prometheusRule.namespace | default (include "common.names.namespace" .) | quote }}
|
||||
labels: {{- include "common.labels.standard" . | nindent 4 }}
|
||||
{{- if .Values.metrics.prometheusRule.additionalLabels }}
|
||||
{{- include "common.tplvalues.render" (dict "value" .Values.metrics.prometheusRule.additionalLabels "context" $) | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- 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 }}
|
||||
spec:
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.metrics.prometheusRule.rules "context" $ ) | nindent 2 }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,20 @@
|
||||
{{- if .Values.podSecurityPolicy.create }}
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: Role
|
||||
metadata:
|
||||
name: {{ template "elastalert.fullname" . }}
|
||||
namespace: {{ include "common.names.namespace" . | quote }}
|
||||
labels: {{- include "common.labels.standard" . | nindent 4 }}
|
||||
{{- if .Values.commonLabels }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
rules:
|
||||
- apiGroups:
|
||||
- policy
|
||||
resources:
|
||||
- podsecuritypolicies
|
||||
resourceNames:
|
||||
- {{ template "elastalert.fullname" . }}
|
||||
verbs:
|
||||
- use
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,18 @@
|
||||
{{- if .Values.podSecurityPolicy.create }}
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
name: {{ template "elastalert.fullname" . }}
|
||||
namespace: {{ include "common.names.namespace" . | quote }}
|
||||
labels: {{- include "common.labels.standard" . | nindent 4 }}
|
||||
{{- if .Values.commonLabels }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: Role
|
||||
name: {{ template "elastalert.fullname" . }}
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ template "elastalert.serviceAccountName" . }}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,27 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ template "elastalert.fullname" . }}-rules
|
||||
namespace: {{ include "common.names.namespace" . | quote }}
|
||||
labels: {{- include "common.labels.standard" . | nindent 4 }}
|
||||
{{- if .Values.commonLabels }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
data:
|
||||
{{- if .Values.rootRulesFolder }}
|
||||
{{- $rulesDirectory := printf "%v/**.{yaml,yml}" .Values.rootRulesFolder -}}
|
||||
{{- $enabledRules := .Values.enabledRules -}}
|
||||
{{- range $rule, $_ := .Files.Glob $rulesDirectory -}}
|
||||
{{- $ruleBase := base $rule -}}
|
||||
{{- $ruleName := regexReplaceAll "\\.(yaml|yml)$" $ruleBase "" -}}
|
||||
{{- if has $ruleName $enabledRules }}
|
||||
{{ $ruleBase }}: |-
|
||||
{{ $.Files.Get $rule | indent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
{{- range $key, $value := .Values.rules }}
|
||||
{{ $key }}: |-
|
||||
{{ $value | indent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,44 @@
|
||||
{{- if .Values.metrics.enabled -}}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "common.names.servicename" . | quote }}
|
||||
namespace: {{ include "common.names.namespace" . | quote }}
|
||||
labels: {{- include "common.labels.standard" . | nindent 4 }}
|
||||
app.kubernetes.io/component: {{ .Values.appKubernetesIoComponent}}
|
||||
{{- if .Values.commonLabels }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
annotations:
|
||||
{{- if .Values.commonAnnotations }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
type: {{ .Values.metrics.service.type }}
|
||||
{{- if and .Values.metrics.service.clusterIP (eq .Values.metrics.service.type "ClusterIP") }}
|
||||
clusterIP: {{ .Values.metrics.service.clusterIP }}
|
||||
{{- end }}
|
||||
{{- if ne .Values.metrics.service.type "ClusterIP" }}
|
||||
externalTrafficPolicy: {{ .Values.metrics.service.externalTrafficPolicy }}
|
||||
{{- end }}
|
||||
{{- if and .Values.metrics.service.loadBalancerIP (eq .Values.metrics.service.type "LoadBalancer") }}
|
||||
loadBalancerIP: {{ .Values.metrics.service.loadBalancerIP }}
|
||||
{{- end }}
|
||||
{{- if and (eq .Values.metrics.service.type "LoadBalancer") .Values.metrics.service.loadBalancerSourceRanges }}
|
||||
loadBalancerSourceRanges: {{- toYaml .Values.metrics.service.loadBalancerSourceRanges | nindent 4 }}
|
||||
{{- end }}
|
||||
ports:
|
||||
- port: {{ .Values.metrics.prometheusPort }}
|
||||
targetPort: {{ .Values.metrics.prometheusPort }}
|
||||
protocol: TCP
|
||||
name: {{ .Values.metrics.prometheusPortName }}
|
||||
{{- if and (or (eq .Values.metrics.service.type "NodePort") (eq .Values.metrics.service.type "LoadBalancer")) .Values.metrics.service.nodePorts }}
|
||||
nodePort: {{ .Values.metrics.service.nodePorts }}
|
||||
{{- else if eq .Values.metrics.service.type "ClusterIP" }}
|
||||
nodePort: null
|
||||
{{- end }}
|
||||
|
||||
selector:
|
||||
{{- include "common.labels.matchLabels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: {{ .Values.appKubernetesIoComponent }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,15 @@
|
||||
{{- if .Values.serviceAccount.create -}}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ include "elastalert.serviceAccountName" . }}
|
||||
namespace: {{ include "common.names.namespace" . | quote }}
|
||||
labels: {{- include "common.labels.standard" . | nindent 4 }}
|
||||
{{- if .Values.commonLabels }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.serviceAccount.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,45 @@
|
||||
{{- if and .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled }}
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: ServiceMonitor
|
||||
metadata:
|
||||
name: {{ include "common.names.servicename" . | quote }}
|
||||
namespace: {{ .Values.metrics.serviceMonitor.namespace | default (include "common.names.namespace" .) | quote }}
|
||||
labels: {{- include "common.labels.standard" . | nindent 4 }}
|
||||
app.kubernetes.io/component: {{ .Values.appKubernetesIoComponent}}
|
||||
{{- if .Values.commonLabels }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.serviceMonitor.labels }}
|
||||
{{- toYaml .Values.metrics.serviceMonitor.labels | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if .Values.commonAnnotations }}
|
||||
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if .Values.metrics.serviceMonitor.jobLabel }}
|
||||
jobLabel: {{ .Values.metrics.serviceMonitor.jobLabel }}
|
||||
{{- end }}
|
||||
endpoints:
|
||||
- port: {{ .Values.metrics.prometheusPortName }}
|
||||
{{- if .Values.metrics.serviceMonitor.interval }}
|
||||
interval: {{ .Values.metrics.serviceMonitor.interval }}
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.serviceMonitor.scrapeTimeout }}
|
||||
scrapeTimeout: {{ .Values.metrics.serviceMonitor.scrapeTimeout }}
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.serviceMonitor.metricRelabelings }}
|
||||
metricRelabelings: {{ toYaml .Values.metrics.serviceMonitor.metricRelabelings | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.serviceMonitor.relabelings }}
|
||||
relabelings: {{ toYaml .Values.metrics.serviceMonitor.relabelings | nindent 8 }}
|
||||
{{- end }}
|
||||
namespaceSelector:
|
||||
matchNames:
|
||||
- {{ .Release.Namespace | quote }}
|
||||
selector:
|
||||
matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
|
||||
app.kubernetes.io/component: {{ .Values.appKubernetesIoComponent }}
|
||||
{{- if .Values.metrics.serviceMonitor.selector }}
|
||||
{{- include "common.tplvalues.render" (dict "value" .Values.metrics.serviceMonitor.selector "context" $) | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,16 @@
|
||||
{{- if .Values.smtp_auth }}
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: elastalert-smtp-auth
|
||||
namespace: {{ include "common.names.namespace" . | quote }}
|
||||
labels: {{- include "common.labels.standard" . | nindent 4 }}
|
||||
{{- if .Values.commonLabels }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
type: kubernetes.io/Opaque
|
||||
stringData:
|
||||
smtp_auth.yaml: |-
|
||||
user: {{ .Values.smtp_auth.username }}
|
||||
password: {{ .Values.smtp_auth.password }}
|
||||
{{- end}}
|
||||
Reference in New Issue
Block a user