222 lines
9.7 KiB
YAML
222 lines
9.7 KiB
YAML
{{ if .Values.global.prometheus.enabled }}
|
|
{{- if .Values.prometheus.server.enabled -}}
|
|
{{- if .Values.prometheus.server.statefulSet.enabled -}}
|
|
apiVersion: apps/v1
|
|
kind: StatefulSet
|
|
metadata:
|
|
{{- if .Values.prometheus.server.statefulSet.annotations }}
|
|
annotations:
|
|
{{ toYaml .Values.prometheus.server.statefulSet.annotations | indent 4 }}
|
|
{{- end }}
|
|
labels:
|
|
{{- include "prometheus.server.labels" . | nindent 4 }}
|
|
{{- if .Values.prometheus.server.statefulSet.labels}}
|
|
{{ toYaml .Values.prometheus.server.statefulSet.labels | nindent 4 }}
|
|
{{- end}}
|
|
name: {{ template "prometheus.server.fullname" . }}
|
|
namespace: {{ .Release.Namespace }}
|
|
spec:
|
|
serviceName: {{ template "prometheus.server.fullname" . }}-headless
|
|
selector:
|
|
matchLabels:
|
|
{{- include "prometheus.server.matchLabels" . | nindent 6 }}
|
|
replicas: {{ .Values.prometheus.server.replicaCount }}
|
|
podManagementPolicy: {{ .Values.prometheus.server.statefulSet.podManagementPolicy }}
|
|
template:
|
|
metadata:
|
|
{{- if .Values.prometheus.server.podAnnotations }}
|
|
annotations:
|
|
{{ toYaml .Values.prometheus.server.podAnnotations | indent 8 }}
|
|
{{- end }}
|
|
labels:
|
|
{{- include "prometheus.server.labels" . | nindent 8 }}
|
|
{{- if .Values.prometheus.server.statefulSet.labels}}
|
|
{{ toYaml .Values.prometheus.server.statefulSet.labels | nindent 8 }}
|
|
{{- end}}
|
|
spec:
|
|
{{- if .Values.prometheus.server.priorityClassName }}
|
|
priorityClassName: "{{ .Values.prometheus.server.priorityClassName }}"
|
|
{{- end }}
|
|
{{- if .Values.prometheus.server.schedulerName }}
|
|
schedulerName: "{{ .Values.prometheus.server.schedulerName }}"
|
|
{{- end }}
|
|
serviceAccountName: {{ template "prometheus.serviceAccountName.server" . }}
|
|
containers:
|
|
{{- if .Values.prometheus.configmapReload.prometheus.enabled }}
|
|
- name: {{ template "prometheus.name" . }}-{{ .Values.prometheus.server.name }}-{{ .Values.prometheus.configmapReload.prometheus.name }}
|
|
image: "{{ .Values.prometheus.configmapReload.prometheus.image.repository }}:{{ .Values.prometheus.configmapReload.prometheus.image.tag }}"
|
|
imagePullPolicy: "{{ .Values.prometheus.configmapReload.prometheus.image.pullPolicy }}"
|
|
args:
|
|
- --watched-dir=/etc/config
|
|
- --reload-url=http://127.0.0.1:9090{{ .Values.prometheus.server.prefixURL }}/-/reload
|
|
{{- range $key, $value := .Values.prometheus.configmapReload.prometheus.extraArgs }}
|
|
- --{{ $key }}={{ $value }}
|
|
{{- end }}
|
|
{{- range .Values.prometheus.configmapReload.prometheus.extraVolumeDirs }}
|
|
- --watched-dir={{ . }}
|
|
{{- end }}
|
|
resources:
|
|
{{ toYaml .Values.prometheus.configmapReload.prometheus.resources | indent 12 }}
|
|
volumeMounts:
|
|
- name: config-volume
|
|
mountPath: /etc/config
|
|
readOnly: true
|
|
{{- range .Values.prometheus.configmapReload.prometheus.extraConfigmapMounts }}
|
|
- name: {{ $.Values.prometheus.configmapReload.prometheus.name }}-{{ .name }}
|
|
mountPath: {{ .mountPath }}
|
|
subPath: {{ .subPath }}
|
|
readOnly: {{ .readOnly }}
|
|
{{- end }}
|
|
{{- end }}
|
|
- name: {{ template "prometheus.name" . }}-{{ .Values.prometheus.server.name }}
|
|
image: "{{ .Values.prometheus.server.image.repository }}:{{ .Values.prometheus.server.image.tag }}"
|
|
imagePullPolicy: "{{ .Values.prometheus.server.image.pullPolicy }}"
|
|
{{- if .Values.prometheus.server.env }}
|
|
env:
|
|
{{ toYaml .Values.prometheus.server.env | indent 12}}
|
|
{{- end }}
|
|
args:
|
|
{{- if .Values.prometheus.server.retention }}
|
|
- --storage.tsdb.retention.time={{ .Values.prometheus.server.retention }}
|
|
{{- end }}
|
|
- --config.file={{ .Values.prometheus.server.configPath }}
|
|
- --storage.tsdb.path={{ .Values.prometheus.server.persistentVolume.mountPath }}
|
|
- --web.console.libraries=/etc/prometheus/console_libraries
|
|
- --web.console.templates=/etc/prometheus/consoles
|
|
{{- range .Values.prometheus.server.extraFlags }}
|
|
- --{{ . }}
|
|
{{- end }}
|
|
{{- range $key, $value := .Values.prometheus.server.extraArgs }}
|
|
- --{{ $key }}={{ $value }}
|
|
{{- end }}
|
|
{{- if .Values.prometheus.server.baseURL }}
|
|
- --web.external-url={{ .Values.prometheus.server.baseURL }}
|
|
{{- end }}
|
|
ports:
|
|
- containerPort: 9090
|
|
readinessProbe:
|
|
httpGet:
|
|
path: {{ .Values.prometheus.server.prefixURL }}/-/ready
|
|
port: 9090
|
|
initialDelaySeconds: {{ .Values.prometheus.server.readinessProbeInitialDelay }}
|
|
timeoutSeconds: {{ .Values.prometheus.server.readinessProbeTimeout }}
|
|
livenessProbe:
|
|
httpGet:
|
|
path: {{ .Values.prometheus.server.prefixURL }}/-/healthy
|
|
port: 9090
|
|
initialDelaySeconds: {{ .Values.prometheus.server.livenessProbeInitialDelay }}
|
|
timeoutSeconds: {{ .Values.prometheus.server.livenessProbeTimeout }}
|
|
resources:
|
|
{{ toYaml .Values.prometheus.server.resources | indent 12 }}
|
|
volumeMounts:
|
|
- name: config-volume
|
|
mountPath: /etc/config
|
|
- name: storage-volume
|
|
mountPath: {{ .Values.prometheus.server.persistentVolume.mountPath }}
|
|
subPath: "{{ .Values.prometheus.server.persistentVolume.subPath }}"
|
|
{{- range .Values.prometheus.server.extraHostPathMounts }}
|
|
- name: {{ .name }}
|
|
mountPath: {{ .mountPath }}
|
|
subPath: {{ .subPath }}
|
|
readOnly: {{ .readOnly }}
|
|
{{- end }}
|
|
{{- range .Values.prometheus.server.extraConfigmapMounts }}
|
|
- name: {{ $.Values.prometheus.server.name }}-{{ .name }}
|
|
mountPath: {{ .mountPath }}
|
|
subPath: {{ .subPath }}
|
|
readOnly: {{ .readOnly }}
|
|
{{- end }}
|
|
{{- range .Values.prometheus.server.extraSecretMounts }}
|
|
- name: {{ .name }}
|
|
mountPath: {{ .mountPath }}
|
|
subPath: {{ .subPath }}
|
|
readOnly: {{ .readOnly }}
|
|
{{- end }}
|
|
{{- if .Values.prometheus.server.extraVolumeMounts }}
|
|
{{ toYaml .Values.prometheus.server.extraVolumeMounts | nindent 12 }}
|
|
{{- end }}
|
|
{{- if .Values.prometheus.server.sidecarContainers }}
|
|
{{- toYaml .Values.prometheus.server.sidecarContainers | nindent 8 }}
|
|
{{- end }}
|
|
{{- if .Values.prometheus.imagePullSecrets }}
|
|
imagePullSecrets:
|
|
{{ toYaml .Values.prometheus.imagePullSecrets | indent 2 }}
|
|
{{- end }}
|
|
{{- if .Values.prometheus.server.nodeSelector }}
|
|
nodeSelector:
|
|
{{ toYaml .Values.prometheus.server.nodeSelector | indent 8 }}
|
|
{{- end }}
|
|
{{- if .Values.prometheus.server.securityContext }}
|
|
securityContext:
|
|
{{ toYaml .Values.prometheus.server.securityContext | indent 8 }}
|
|
{{- end }}
|
|
{{- if .Values.prometheus.server.tolerations }}
|
|
tolerations:
|
|
{{ toYaml .Values.prometheus.server.tolerations | indent 8 }}
|
|
{{- end }}
|
|
{{- if .Values.prometheus.server.affinity }}
|
|
affinity:
|
|
{{ toYaml .Values.prometheus.server.affinity | indent 8 }}
|
|
{{- end }}
|
|
terminationGracePeriodSeconds: {{ .Values.prometheus.server.terminationGracePeriodSeconds }}
|
|
volumes:
|
|
- name: config-volume
|
|
configMap:
|
|
name: {{ if .Values.prometheus.server.configMapOverrideName }}{{ .Release.Name }}-{{ .Values.prometheus.server.configMapOverrideName }}{{- else }}{{ template "prometheus.server.fullname" . }}{{- end }}
|
|
{{- range .Values.prometheus.server.extraHostPathMounts }}
|
|
- name: {{ .name }}
|
|
hostPath:
|
|
path: {{ .hostPath }}
|
|
{{- end }}
|
|
{{- range .Values.prometheus.configmapReload.prometheus.extraConfigmapMounts }}
|
|
- name: {{ $.Values.prometheus.configmapReload.prometheus.name }}-{{ .name }}
|
|
configMap:
|
|
name: {{ .configMap }}
|
|
{{- end }}
|
|
{{- range .Values.prometheus.server.extraConfigmapMounts }}
|
|
- name: {{ $.Values.prometheus.server.name }}-{{ .name }}
|
|
configMap:
|
|
name: {{ .configMap }}
|
|
{{- end }}
|
|
{{- range .Values.prometheus.server.extraSecretMounts }}
|
|
- name: {{ .name }}
|
|
secret:
|
|
secretName: {{ .secretName }}
|
|
{{- end }}
|
|
{{- range .Values.prometheus.configmapReload.prometheus.extraConfigmapMounts }}
|
|
- name: {{ .name }}
|
|
configMap:
|
|
name: {{ .configMap }}
|
|
{{- end }}
|
|
{{- if .Values.prometheus.server.extraVolumes }}
|
|
{{ toYaml .Values.prometheus.server.extraVolumes | indent 8}}
|
|
{{- end }}
|
|
{{- if .Values.prometheus.server.persistentVolume.enabled }}
|
|
volumeClaimTemplates:
|
|
- metadata:
|
|
name: storage-volume
|
|
{{- if .Values.prometheus.server.persistentVolume.annotations }}
|
|
annotations:
|
|
{{ toYaml .Values.prometheus.server.persistentVolume.annotations | indent 10 }}
|
|
{{- end }}
|
|
spec:
|
|
accessModes:
|
|
{{ toYaml .Values.prometheus.server.persistentVolume.accessModes | indent 10 }}
|
|
resources:
|
|
requests:
|
|
storage: "{{ .Values.prometheus.server.persistentVolume.size }}"
|
|
{{- if .Values.prometheus.server.persistentVolume.storageClass }}
|
|
{{- if (eq "-" .Values.prometheus.server.persistentVolume.storageClass) }}
|
|
storageClassName: ""
|
|
{{- else }}
|
|
storageClassName: "{{ .Values.prometheus.server.persistentVolume.storageClass }}"
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- else }}
|
|
- name: storage-volume
|
|
emptyDir: {}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{ end }}
|