You've already forked prometheus-postgres-exporter
Initial Commit
This commit is contained in:
58
templates/prometheus-postgres-exporter/_common.tpl
Normal file
58
templates/prometheus-postgres-exporter/_common.tpl
Normal file
@ -0,0 +1,58 @@
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "prometheus-postgres-exporter.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 "prometheus-postgres-exporter.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 chart name and version as used by the chart label.
|
||||
*/}}
|
||||
{{- define "prometheus-postgres-exporter.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Common annotations
|
||||
*/}}
|
||||
{{- define "prometheus-postgres-exporter.annotations" -}}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Common labels
|
||||
*/}}
|
||||
{{- define "prometheus-postgres-exporter.labels" -}}
|
||||
{{ include "prometheus-postgres-exporter.selectorLabels" . }}
|
||||
{{- if .Chart.AppVersion }}
|
||||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||
{{- end }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
helm.sh/chart: {{ include "prometheus-postgres-exporter.chart" . }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Common selector labels
|
||||
*/}}
|
||||
{{- define "prometheus-postgres-exporter.selectorLabels" -}}
|
||||
app.kubernetes.io/name: {{ include "prometheus-postgres-exporter.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- end }}
|
70
templates/prometheus-postgres-exporter/_deployment.tpl
Normal file
70
templates/prometheus-postgres-exporter/_deployment.tpl
Normal file
@ -0,0 +1,70 @@
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
|
||||
{{/* annotations */}}
|
||||
|
||||
{{- define "prometheus-postgres-exporter.deployment.annotations" -}}
|
||||
{{ include "prometheus-postgres-exporter.annotations" . }}
|
||||
{{- if .Values.deployment.annotations }}
|
||||
{{ toYaml .Values.deployment.annotations }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/* envFrom */}}
|
||||
|
||||
{{- define "prometheus-postgres-exporter.deployment.envFrom" -}}
|
||||
{{- $envFrom := dict "envFrom" (.Values.deployment.postgresExporter.envFrom | default (list) ) }}
|
||||
{{- $secretName := .Values.config.database.existingSecret.secretName -}}
|
||||
{{- if not .Values.config.database.existingSecret.enabled }}
|
||||
{{- $secretName = printf "%s-database-env" (include "prometheus-postgres-exporter.fullname" . ) }}
|
||||
{{- end }}
|
||||
{{- $envFrom = merge $envFrom (dict "envFrom" (list (dict "secretRef" (dict "name" $secretName)))) }}
|
||||
{{ toYaml $envFrom }}
|
||||
{{- end -}}
|
||||
|
||||
{{/* image */}}
|
||||
|
||||
{{- define "prometheus-postgres-exporter.deployment.images.postgres-exporter.fqin" -}}
|
||||
{{- $registry := .Values.deployment.postgresExporter.image.registry -}}
|
||||
{{- $repository := .Values.deployment.postgresExporter.image.repository -}}
|
||||
{{- $tag := default .Chart.AppVersion .Values.deployment.postgresExporter.image.tag -}}
|
||||
{{- printf "%s/%s:v%s" $registry $repository $tag -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/* labels */}}
|
||||
|
||||
{{- define "prometheus-postgres-exporter.deployment.labels" -}}
|
||||
{{ include "prometheus-postgres-exporter.labels" . }}
|
||||
{{- if .Values.deployment.labels }}
|
||||
{{ toYaml .Values.deployment.labels }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/* serviceAccount */}}
|
||||
|
||||
{{- define "prometheus-postgres-exporter.deployment.serviceAccount" -}}
|
||||
{{- if .Values.serviceAccount.existing.enabled -}}
|
||||
{{- printf "%s" .Values.serviceAccount.existing.serviceAccountName -}}
|
||||
{{- else -}}
|
||||
{{- include "prometheus-postgres-exporter.fullname" . -}}
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
|
||||
{{/* volumeMounts */}}
|
||||
|
||||
{{- define "prometheus-postgres-exporter.deployment.volumeMounts" -}}
|
||||
{{- $volumeMounts := dict "volumeMounts" (.Values.deployment.postgresExporter.volumeMounts | default (list) ) }}
|
||||
{{- $volumeMounts = merge $volumeMounts (dict "volumeMounts" (list (dict "name" "exporter-config" "mountPath" "/etc/prometheus-postgres-exporter/config.d" ))) }}
|
||||
{{ toYaml $volumeMounts }}
|
||||
{{- end -}}
|
||||
|
||||
{{/* volumes */}}
|
||||
|
||||
{{- define "prometheus-postgres-exporter.deployment.volumes" -}}
|
||||
{{- $volumes := dict "volumes" (.Values.deployment.volumes | default (list) ) }}
|
||||
{{- $secretName := .Values.config.exporterConfig.existingSecret.secretName -}}
|
||||
{{- if not .Values.config.exporterConfig.existingSecret.enabled }}
|
||||
{{- $secretName = printf "%s-exporter-config" (include "prometheus-postgres-exporter.fullname" . ) }}
|
||||
{{- end }}
|
||||
{{- $volumes = merge $volumes (dict "volumes" (list (dict "name" "exporter-config" "secret" (dict "secretName" $secretName)))) }}
|
||||
{{ toYaml $volumes }}
|
||||
{{- end -}}
|
19
templates/prometheus-postgres-exporter/_ingress.tpl
Normal file
19
templates/prometheus-postgres-exporter/_ingress.tpl
Normal file
@ -0,0 +1,19 @@
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
|
||||
{{/* annotations */}}
|
||||
|
||||
{{- define "prometheus-postgres-exporter.ingress.annotations" -}}
|
||||
{{ include "prometheus-postgres-exporter.annotations" . }}
|
||||
{{- if .Values.ingress.annotations }}
|
||||
{{ toYaml .Values.ingress.annotations }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/* labels */}}
|
||||
|
||||
{{- define "prometheus-postgres-exporter.ingress.labels" -}}
|
||||
{{ include "prometheus-postgres-exporter.labels" . }}
|
||||
{{- if .Values.ingress.labels }}
|
||||
{{ toYaml .Values.ingress.labels }}
|
||||
{{- end }}
|
||||
{{- end }}
|
17
templates/prometheus-postgres-exporter/_pod.tpl
Normal file
17
templates/prometheus-postgres-exporter/_pod.tpl
Normal file
@ -0,0 +1,17 @@
|
||||
---
|
||||
|
||||
{{/* annotations */}}
|
||||
|
||||
{{- define "prometheus-postgres-exporter.pod.annotations" -}}
|
||||
{{ include "prometheus-postgres-exporter.annotations" . }}
|
||||
{{- end }}
|
||||
|
||||
{{/* labels */}}
|
||||
|
||||
{{- define "prometheus-postgres-exporter.pod.labels" -}}
|
||||
{{ include "prometheus-postgres-exporter.labels" . }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "prometheus-postgres-exporter.pod.selectorLabels" -}}
|
||||
{{ include "prometheus-postgres-exporter.pod.labels" . }}
|
||||
{{- end }}
|
19
templates/prometheus-postgres-exporter/_podMonitors.tpl
Normal file
19
templates/prometheus-postgres-exporter/_podMonitors.tpl
Normal file
@ -0,0 +1,19 @@
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
|
||||
{{/* annotations */}}
|
||||
|
||||
{{- define "prometheus-postgres-exporter.podMonitors.http.annotations" -}}
|
||||
{{ include "prometheus-postgres-exporter.annotations" . }}
|
||||
{{- if .Values.prometheus.metrics.podMonitor.annotations }}
|
||||
{{ toYaml .Values.prometheus.metrics.podMonitor.annotations }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/* labels */}}
|
||||
|
||||
{{- define "prometheus-postgres-exporter.podMonitors.http.labels" -}}
|
||||
{{ include "prometheus-postgres-exporter.labels" . }}
|
||||
{{- if .Values.prometheus.metrics.podMonitor.labels }}
|
||||
{{ toYaml .Values.prometheus.metrics.podMonitor.labels }}
|
||||
{{- end }}
|
||||
{{- end }}
|
13
templates/prometheus-postgres-exporter/_prometheusRules.tpl
Normal file
13
templates/prometheus-postgres-exporter/_prometheusRules.tpl
Normal file
@ -0,0 +1,13 @@
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
|
||||
{{/* annotations */}}
|
||||
|
||||
{{- define "prometheus-postgres-exporter.prometheusRules.annotations" -}}
|
||||
{{ include "prometheus-postgres-exporter.annotations" . }}
|
||||
{{- end }}
|
||||
|
||||
{{/* labels */}}
|
||||
|
||||
{{- define "prometheus-postgres-exporter.prometheusRules.labels" -}}
|
||||
{{ include "prometheus-postgres-exporter.labels" . }}
|
||||
{{- end }}
|
48
templates/prometheus-postgres-exporter/_secrets.tpl
Normal file
48
templates/prometheus-postgres-exporter/_secrets.tpl
Normal file
@ -0,0 +1,48 @@
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
|
||||
{{/* annotations */}}
|
||||
|
||||
{{- define "prometheus-postgres-exporter.secrets.database.annotations" -}}
|
||||
{{ include "prometheus-postgres-exporter.annotations" . }}
|
||||
{{- if .Values.config.database.secret.annotations }}
|
||||
{{ toYaml .Values.config.database.secret.annotations }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "prometheus-postgres-exporter.secrets.exporterConfig.annotations" -}}
|
||||
{{ include "prometheus-postgres-exporter.annotations" . }}
|
||||
{{- if .Values.config.exporterConfig.secret.annotations }}
|
||||
{{ toYaml .Values.config.exporterConfig.secret.annotations }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "prometheus-postgres-exporter.secrets.webConfig.annotations" -}}
|
||||
{{ include "prometheus-postgres-exporter.annotations" . }}
|
||||
{{- if .Values.config.webConfig.secret.annotations }}
|
||||
{{ toYaml .Values.config.webConfig.secret.annotations }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/* labels */}}
|
||||
|
||||
{{- define "prometheus-postgres-exporter.secrets.database.labels" -}}
|
||||
{{ include "prometheus-postgres-exporter.labels" . }}
|
||||
{{- if .Values.config.database.secret.labels }}
|
||||
{{ toYaml .Values.config.database.secret.labels }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "prometheus-postgres-exporter.secrets.exporterConfig.labels" -}}
|
||||
{{ include "prometheus-postgres-exporter.labels" . }}
|
||||
{{- if .Values.config.exporterConfig.secret.labels }}
|
||||
{{ toYaml .Values.config.exporterConfig.secret.labels }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
|
||||
{{- define "prometheus-postgres-exporter.secrets.webConfig.labels" -}}
|
||||
{{ include "prometheus-postgres-exporter.labels" . }}
|
||||
{{- if .Values.config.webConfig.secret.labels }}
|
||||
{{ toYaml .Values.config.webConfig.secret.labels }}
|
||||
{{- end }}
|
||||
{{- end }}
|
17
templates/prometheus-postgres-exporter/_serviceAccount.tpl
Normal file
17
templates/prometheus-postgres-exporter/_serviceAccount.tpl
Normal file
@ -0,0 +1,17 @@
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
|
||||
{{/* annotations */}}
|
||||
|
||||
{{- define "prometheus-postgres-exporter.serviceAccount.annotations" -}}
|
||||
{{- if .Values.serviceAccount.new.annotations }}
|
||||
{{ toYaml .Values.serviceAccount.new.annotations }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/* labels */}}
|
||||
|
||||
{{- define "prometheus-postgres-exporter.serviceAccount.labels" -}}
|
||||
{{- if .Values.serviceAccount.new.labels }}
|
||||
{{ toYaml .Values.serviceAccount.new.labels }}
|
||||
{{- end }}
|
||||
{{- end }}
|
25
templates/prometheus-postgres-exporter/_serviceMonitors.tpl
Normal file
25
templates/prometheus-postgres-exporter/_serviceMonitors.tpl
Normal file
@ -0,0 +1,25 @@
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
|
||||
{{/* annotations */}}
|
||||
|
||||
{{- define "prometheus-postgres-exporter.serviceMonitors.http.annotations" -}}
|
||||
{{ include "prometheus-postgres-exporter.annotations" . }}
|
||||
{{- if .Values.prometheus.metrics.serviceMonitor.annotations }}
|
||||
{{ toYaml .Values.prometheus.metrics.serviceMonitor.annotations }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/* labels */}}
|
||||
|
||||
{{- define "prometheus-postgres-exporter.serviceMonitors.http.labels" -}}
|
||||
{{ include "prometheus-postgres-exporter.labels" . }}
|
||||
{{- if .Values.prometheus.metrics.serviceMonitor.labels }}
|
||||
{{ toYaml .Values.prometheus.metrics.serviceMonitor.labels }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "prometheus-postgres-exporter.serviceMonitors.http.selectorLabels" -}}
|
||||
{{ include "prometheus-postgres-exporter.selectorLabels" . }}
|
||||
{{/* Add label to select the correct service via `selector.matchLabels` of the serviceMonitor resource. */}}
|
||||
app.kubernetes.io/service-name: http
|
||||
{{- end }}
|
29
templates/prometheus-postgres-exporter/_services.tpl
Normal file
29
templates/prometheus-postgres-exporter/_services.tpl
Normal file
@ -0,0 +1,29 @@
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
|
||||
{{/* annotations */}}
|
||||
|
||||
{{- define "prometheus-postgres-exporter.services.http.annotations" -}}
|
||||
{{ include "prometheus-postgres-exporter.annotations" . }}
|
||||
{{- if .Values.services.http.annotations }}
|
||||
{{ toYaml .Values.services.http.annotations }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/* labels */}}
|
||||
|
||||
{{- define "prometheus-postgres-exporter.services.http.labels" -}}
|
||||
{{ include "prometheus-postgres-exporter.labels" . }}
|
||||
{{/* Add label to select the correct service via `selector.matchLabels` of the serviceMonitor resource. */}}
|
||||
app.kubernetes.io/service-name: http
|
||||
{{- if .Values.services.http.labels }}
|
||||
{{ toYaml .Values.services.http.labels }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/* names */}}
|
||||
|
||||
{{- define "prometheus-postgres-exporter.services.http.name" -}}
|
||||
{{- if .Values.services.http.enabled -}}
|
||||
{{ include "prometheus-postgres-exporter.fullname" . }}-http
|
||||
{{- end -}}
|
||||
{{- end -}}
|
119
templates/prometheus-postgres-exporter/deployment.yaml
Normal file
119
templates/prometheus-postgres-exporter/deployment.yaml
Normal file
@ -0,0 +1,119 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
{{- with (include "prometheus-postgres-exporter.deployment.annotations" . | fromYaml) }}
|
||||
annotations:
|
||||
{{- tpl (. | toYaml) $ | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with (include "prometheus-postgres-exporter.deployment.labels" . | fromYaml) }}
|
||||
labels:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
name: {{ include "prometheus-postgres-exporter.fullname" . }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "prometheus-postgres-exporter.pod.selectorLabels" . | nindent 6 }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "prometheus-postgres-exporter.pod.labels" . | nindent 8 }}
|
||||
spec:
|
||||
containers:
|
||||
- name: postgres-exporter
|
||||
args:
|
||||
- "--config.file=/etc/prometheus-postgres-exporter/config.d/exporterConfig.yaml"
|
||||
- "--web.listen-address=:9187"
|
||||
{{- range .Values.deployment.postgresExporter.args }}
|
||||
- {{ . | quote }}
|
||||
{{- end }}
|
||||
{{- with .Values.deployment.postgresExporter.env }}
|
||||
env:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- $envFrom := (include "prometheus-postgres-exporter.deployment.envFrom" . | fromYaml) }}
|
||||
{{- if hasKey $envFrom "envFrom" }}
|
||||
envFrom:
|
||||
{{- toYaml $envFrom.envFrom | nindent 8 }}
|
||||
{{- end }}
|
||||
image: {{ include "prometheus-postgres-exporter.deployment.images.postgres-exporter.fqin" . | quote }}
|
||||
imagePullPolicy: {{ .Values.deployment.postgresExporter.image.pullPolicy }}
|
||||
livenessProbe:
|
||||
tcpSocket:
|
||||
port: 9187
|
||||
failureThreshold: 3
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 60
|
||||
successThreshold: 1
|
||||
timeoutSeconds: 3
|
||||
readinessProbe:
|
||||
tcpSocket:
|
||||
port: 9187
|
||||
failureThreshold: 3
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 15
|
||||
successThreshold: 1
|
||||
timeoutSeconds: 3
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: 9187
|
||||
protocol: TCP
|
||||
{{- with .Values.deployment.containerResources }}
|
||||
resources:
|
||||
{{- toYaml . | nindent 10 }}
|
||||
{{- end }}
|
||||
{{- with .Values.deployment.postgresExporter.securityContext }}
|
||||
securityContext:
|
||||
{{- toYaml . | nindent 10 }}
|
||||
{{- end }}
|
||||
{{- $volumeMounts := (include "prometheus-postgres-exporter.deployment.volumeMounts" . | fromYaml) }}
|
||||
{{- if hasKey $volumeMounts "volumeMounts" }}
|
||||
volumeMounts:
|
||||
{{- toYaml $volumeMounts.volumeMounts | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.deployment.dnsConfig }}
|
||||
dnsConfig:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.deployment.dnsPolicy }}
|
||||
dnsPolicy: {{ .Values.deployment.dnsPolicy }}
|
||||
{{- end }}
|
||||
{{- if .Values.deployment.hostname }}
|
||||
hostname: {{ .Values.batch.dbUpdate.hostname }}
|
||||
{{- end }}
|
||||
hostNetwork: {{ .Values.deployment.hostNetwork }}
|
||||
{{- with .Values.deployment.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.deployment.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.deployment.priorityClassName }}
|
||||
priorityClassName: {{ .Values.deployment.priorityClassName }}
|
||||
{{- end }}
|
||||
restartPolicy: {{ .Values.deployment.restartPolicy }}
|
||||
{{- with .Values.deployment.securityContext }}
|
||||
securityContext:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
serviceAccount: {{ include "prometheus-postgres-exporter.deployment.serviceAccount" . }}
|
||||
{{- if .Values.deployment.subdomain }}
|
||||
subdomain: {{ .Values.deployment.subdomain }}
|
||||
{{- end }}
|
||||
terminationGracePeriodSeconds: {{ .Values.deployment.terminationGracePeriodSeconds }}
|
||||
{{- with .Values.deployment.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml . | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- with .Values.deployment.topologySpreadConstraints }}
|
||||
topologySpreadConstraints:
|
||||
{{- toYaml . | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- $volumes := (include "prometheus-postgres-exporter.deployment.volumes" . | fromYaml) }}
|
||||
{{- if hasKey $volumes "volumes" }}
|
||||
volumes:
|
||||
{{- toYaml $volumes.volumes | nindent 6 }}
|
||||
{{- end }}
|
45
templates/prometheus-postgres-exporter/ingress.yaml
Normal file
45
templates/prometheus-postgres-exporter/ingress.yaml
Normal file
@ -0,0 +1,45 @@
|
||||
{{- if and .Values.services.http.enabled .Values.ingress.enabled }}
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
{{- with (include "prometheus-postgres-exporter.ingress.annotations" . | fromYaml) }}
|
||||
annotations:
|
||||
{{- tpl (. | toYaml) $ | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with (include "prometheus-postgres-exporter.ingress.labels" . | fromYaml) }}
|
||||
labels:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
name: {{ include "prometheus-postgres-exporter.fullname" . }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
spec:
|
||||
ingressClassName: {{ .Values.ingress.className }}
|
||||
rules:
|
||||
{{- range .Values.ingress.hosts }}
|
||||
- host: {{ tpl .host $ | quote }}
|
||||
http:
|
||||
paths:
|
||||
{{- range .paths }}
|
||||
- path: {{ .path }}
|
||||
{{- if .pathType }}
|
||||
pathType: {{ .pathType }}
|
||||
{{- end }}
|
||||
backend:
|
||||
service:
|
||||
name: {{ include "prometheus-postgres-exporter.fullname" $ }}
|
||||
port:
|
||||
number: {{ $.Values.services.http.port }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.ingress.tls }}
|
||||
tls:
|
||||
{{- range .Values.ingress.tls }}
|
||||
- hosts:
|
||||
{{- range .hosts }}
|
||||
- {{ tpl . $ | quote }}
|
||||
{{- end }}
|
||||
secretName: {{ .secretName | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
40
templates/prometheus-postgres-exporter/podMonitor.yaml
Normal file
40
templates/prometheus-postgres-exporter/podMonitor.yaml
Normal file
@ -0,0 +1,40 @@
|
||||
{{- if and .Values.prometheus.metrics.enabled .Values.prometheus.metrics.podMonitor.enabled (not .Values.prometheus.metrics.serviceMonitor.enabled) }}
|
||||
---
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: PodMonitor
|
||||
metadata:
|
||||
{{- with (include "prometheus-postgres-exporter.podMonitors.http.annotations" . | fromYaml) }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with (include "prometheus-postgres-exporter.podMonitors.http.labels" . | fromYaml) }}
|
||||
labels:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
name: {{ include "prometheus-postgres-exporter.fullname" . }}-http
|
||||
namespace: {{ .Release.Namespace }}
|
||||
spec:
|
||||
podMetricsEndpoints:
|
||||
- enableHttp2: {{ required "The enableHttp2 option of the podMonitor is not defined!" .Values.prometheus.metrics.podMonitor.enableHttp2 }}
|
||||
followRedirects: {{ required "The followRedirects option of the podMonitor is not defined!" .Values.prometheus.metrics.podMonitor.followRedirects }}
|
||||
honorLabels: {{ required "The honorLabels option of the podMonitor is not defined!" .Values.prometheus.metrics.podMonitor.honorLabels }}
|
||||
interval: {{ required "The scrape interval of the podMonitor is not defined!" .Values.prometheus.metrics.podMonitor.interval }}
|
||||
path: {{ required "The metric path of the podMonitor is not defined!" .Values.prometheus.metrics.podMonitor.path }}
|
||||
port: "http"
|
||||
{{- with .Values.prometheus.metrics.podMonitor.relabelings }}
|
||||
relabelings:
|
||||
{{- toYaml . | nindent 6 }}
|
||||
{{- end }}
|
||||
scrapeTimeout: {{ required "The scrape timeout of the podMonitor is not defined!" .Values.prometheus.metrics.podMonitor.scrapeTimeout }}
|
||||
scheme: {{ required "The scheme of the podMonitor is not defined!" .Values.prometheus.metrics.podMonitor.scheme}}
|
||||
{{- with .Values.prometheus.metrics.podMonitor.tlsConfig }}
|
||||
tlsConfig:
|
||||
{{- toYaml . | nindent 6 }}
|
||||
{{- end }}
|
||||
namespaceSelector:
|
||||
matchNames:
|
||||
- {{ .Release.Namespace }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "prometheus-postgres-exporter.pod.selectorLabels" . | nindent 6 }}
|
||||
{{- end }}
|
23
templates/prometheus-postgres-exporter/prometheusRules.yaml
Normal file
23
templates/prometheus-postgres-exporter/prometheusRules.yaml
Normal file
@ -0,0 +1,23 @@
|
||||
{{- if gt (len .Values.prometheus.rules) 0 }}
|
||||
---
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: PrometheusRule
|
||||
metadata:
|
||||
{{- with (include "prometheus-postgres-exporter.prometheusRules.annotations" . | fromYaml) }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with (include "prometheus-postgres-exporter.prometheusRules.labels" . | fromYaml) }}
|
||||
labels:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
name: {{ include "prometheus-postgres-exporter.fullname" . }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
spec:
|
||||
{{- with .Values.prometheus.rules }}
|
||||
groups:
|
||||
- name: {{ template "prometheus-postgres-exporter.name" $ }}
|
||||
rules:
|
||||
{{ toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
20
templates/prometheus-postgres-exporter/secretDatabase.yaml
Normal file
20
templates/prometheus-postgres-exporter/secretDatabase.yaml
Normal file
@ -0,0 +1,20 @@
|
||||
{{- if not (.Values.config.database.existingSecret.enabled) }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
{{- with (include "prometheus-postgres-exporter.secrets.database.annotations" . | fromYaml) }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with (include "prometheus-postgres-exporter.secrets.database.labels" . | fromYaml) }}
|
||||
labels:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
name: {{ include "prometheus-postgres-exporter.fullname" . }}-database-env
|
||||
namespace: {{ .Release.Namespace }}
|
||||
stringData:
|
||||
DATA_SOURCE_URI: {{ required "No `databaseConnectionUrl` defined!" .Values.config.database.secret.databaseConnectionUrl }}
|
||||
DATA_SOURCE_USER: {{ required "No `databaseUsername` defined!" .Values.config.database.secret.databaseUsername }}
|
||||
DATA_SOURCE_PASS: {{ required "No `databasePassword` defined!" .Values.config.database.secret.databasePassword }}
|
||||
{{- end }}
|
@ -0,0 +1,19 @@
|
||||
{{- if not .Values.config.exporterConfig.existingSecret.enabled }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
{{- with (include "prometheus-postgres-exporter.secrets.exporterConfig.annotations" . | fromYaml) }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with (include "prometheus-postgres-exporter.secrets.exporterConfig.labels" . | fromYaml) }}
|
||||
labels:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
name: {{ include "prometheus-postgres-exporter.fullname" . }}-exporter-config
|
||||
namespace: {{ .Release.Namespace }}
|
||||
stringData:
|
||||
exporterConfig.yaml: |
|
||||
{{- toYaml .Values.config.exporterConfig.secret.exporterConfig | nindent 4 }}
|
||||
{{- end }}
|
19
templates/prometheus-postgres-exporter/secretWebConfig.yaml
Normal file
19
templates/prometheus-postgres-exporter/secretWebConfig.yaml
Normal file
@ -0,0 +1,19 @@
|
||||
{{- if and (not (.Values.config.webConfig.existingSecret.enabled)) .Values.config.webConfig.secret.webConfig }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
{{- with (include "prometheus-postgres-exporter.secrets.webConfig.annotations" . | fromYaml) }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with (include "prometheus-postgres-exporter.secrets.webConfig.labels" . | fromYaml) }}
|
||||
labels:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
name: {{ include "prometheus-postgres-exporter.fullname" . }}-webconfig
|
||||
namespace: {{ .Release.Namespace }}
|
||||
stringData:
|
||||
webConfig.yaml: |
|
||||
{{- toYaml .Values.config.webConfig.secret.webConfig | nindent 4 }}
|
||||
{{- end }}
|
26
templates/prometheus-postgres-exporter/serviceAccount.yaml
Normal file
26
templates/prometheus-postgres-exporter/serviceAccount.yaml
Normal file
@ -0,0 +1,26 @@
|
||||
{{- if not .Values.serviceAccount.existing.enabled }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
{{- with (include "prometheus-postgres-exporter.serviceAccount.annotations" . | fromYaml) }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with (include "prometheus-postgres-exporter.serviceAccount.labels" . | fromYaml) }}
|
||||
labels:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
name: {{ include "prometheus-postgres-exporter.fullname" . }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
spec:
|
||||
automountServiceAccountToken: {{ .Values.serviceAccount.new.automountServiceAccountToken }}
|
||||
{{- with .Values.serviceAccount.new.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.serviceAccount.new.secrets }}
|
||||
secrets:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
57
templates/prometheus-postgres-exporter/serviceHTTP.yaml
Normal file
57
templates/prometheus-postgres-exporter/serviceHTTP.yaml
Normal file
@ -0,0 +1,57 @@
|
||||
{{- if .Values.services.http.enabled }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
{{- with (include "prometheus-postgres-exporter.services.http.annotations" . | fromYaml) }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with (include "prometheus-postgres-exporter.services.http.labels" . | fromYaml) }}
|
||||
labels:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
name: {{ include "prometheus-postgres-exporter.services.http.name" . }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
spec:
|
||||
{{- if not (empty .Values.services.http.externalIPs) }}
|
||||
externalIPs:
|
||||
{{- range .Values.services.http.externalIPs }}
|
||||
- {{ . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if and (or (eq .Values.services.http.type "LoadBalancer") (eq .Values.services.http.type "NodePort") ) .Values.services.http.externalTrafficPolicy }}
|
||||
externalTrafficPolicy: {{ .Values.services.http.externalTrafficPolicy }}
|
||||
{{- end }}
|
||||
internalTrafficPolicy: {{ required "No internal traffic policy defined!" .Values.services.http.internalTrafficPolicy }}
|
||||
{{- if .Values.services.http.ipFamilies }}
|
||||
ipFamilies:
|
||||
{{- range .Values.services.http.ipFamilies }}
|
||||
- {{ . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if and (eq .Values.services.http.type "LoadBalancer") .Values.services.http.loadBalancerClass }}
|
||||
loadBalancerClass: {{ .Values.services.http.loadBalancerClass }}
|
||||
{{- end }}
|
||||
{{- if and (eq .Values.services.http.type "LoadBalancer") .Values.services.http.loadBalancerIP }}
|
||||
loadBalancerIP: {{ .Values.services.http.loadBalancerIP }}
|
||||
{{- end }}
|
||||
{{- if eq .Values.services.http.type "LoadBalancer" }}
|
||||
loadBalancerSourceRanges:
|
||||
{{- range .Values.services.http.loadBalancerSourceRanges }}
|
||||
- {{ . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
ports:
|
||||
- name: http
|
||||
protocol: TCP
|
||||
port: {{ required "No service port defined!" .Values.services.http.port }}
|
||||
selector:
|
||||
{{- include "prometheus-postgres-exporter.pod.selectorLabels" . | nindent 4 }}
|
||||
sessionAffinity: {{ required "No session affinity defined!" .Values.services.http.sessionAffinity }}
|
||||
{{- with .Values.services.http.sessionAffinityConfig }}
|
||||
sessionAffinityConfig:
|
||||
{{- toYaml . | nindent 4}}
|
||||
{{- end }}
|
||||
type: {{ required "No service type defined!" .Values.services.http.type }}
|
||||
{{- end }}
|
@ -0,0 +1,40 @@
|
||||
{{- if and .Values.services.http.enabled .Values.prometheus.metrics.enabled .Values.prometheus.metrics.serviceMonitor.enabled (not .Values.prometheus.metrics.podMonitor.enabled)}}
|
||||
---
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: ServiceMonitor
|
||||
metadata:
|
||||
{{- with (include "prometheus-postgres-exporter.serviceMonitors.http.annotations" . | fromYaml) }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with (include "prometheus-postgres-exporter.serviceMonitors.http.labels" . | fromYaml) }}
|
||||
labels:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
name: {{ include "prometheus-postgres-exporter.fullname" . }}-http
|
||||
namespace: {{ .Release.Namespace }}
|
||||
spec:
|
||||
endpoints:
|
||||
- enableHttp2: {{ required "The enableHttp2 option of the serviceMonitor is not defined!" .Values.prometheus.metrics.serviceMonitor.enableHttp2 }}
|
||||
followRedirects: {{ required "The followRedirects option of the serviceMonitor is not defined!" .Values.prometheus.metrics.serviceMonitor.followRedirects }}
|
||||
honorLabels: {{ required "The honorLabels option of the serviceMonitor is not defined!" .Values.prometheus.metrics.serviceMonitor.honorLabels }}
|
||||
interval: {{ required "The scrape interval of the serviceMonitor is not defined!" .Values.prometheus.metrics.serviceMonitor.interval }}
|
||||
path: {{ required "The metric path of the serviceMonitor is not defined!" .Values.prometheus.metrics.serviceMonitor.path }}
|
||||
{{- with .Values.prometheus.metrics.serviceMonitor.relabelings }}
|
||||
relabelings:
|
||||
{{- toYaml . | nindent 6 }}
|
||||
{{- end }}
|
||||
scrapeTimeout: {{ required "The scrape timeout of the serviceMonitor is not defined!" .Values.prometheus.metrics.serviceMonitor.scrapeTimeout }}
|
||||
scheme: {{ required "The scheme of the serviceMonitor is not defined!" .Values.prometheus.metrics.serviceMonitor.scheme}}
|
||||
targetPort: {{ required "The port of the serviceMonitor is not defined!" .Values.prometheus.metrics.serviceMonitor.port }}
|
||||
{{- with .Values.prometheus.metrics.serviceMonitor.tlsConfig }}
|
||||
tlsConfig:
|
||||
{{- toYaml . | nindent 6 }}
|
||||
{{- end }}
|
||||
namespaceSelector:
|
||||
matchNames:
|
||||
- {{ .Release.Namespace }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "prometheus-postgres-exporter.serviceMonitors.http.selectorLabels" . | nindent 6 }}
|
||||
{{- end }}
|
Reference in New Issue
Block a user