Add podmonitors (#165)
Co-authored-by: Marco Franssen <[email protected]> Signed-off-by: Marco Franssen <[email protected]>
This commit is contained in:
co-authored by
Marco Franssen
parent
456075f843
commit
563e1f7920
Executable
+3
@@ -0,0 +1,3 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
helm install kube-prometheus-stack kube-prometheus-stack --version 45.7.1 --repo https://prometheus-community.github.io/helm-charts -n "$scenario" --wait
|
||||||
@@ -2,3 +2,12 @@ global:
|
|||||||
telemetry:
|
telemetry:
|
||||||
prometheus:
|
prometheus:
|
||||||
enabled: true
|
enabled: true
|
||||||
|
podMonitor:
|
||||||
|
enabled: true
|
||||||
|
labels:
|
||||||
|
release: kube-prometheus-stack
|
||||||
|
|
||||||
|
spiffe-oidc-discovery-provider:
|
||||||
|
enabled: true
|
||||||
|
insecureScheme:
|
||||||
|
enabled: true
|
||||||
|
|||||||
@@ -68,6 +68,9 @@ A Helm chart to install the SPIFFE OIDC discovery provider.
|
|||||||
| telemetry.prometheus.nginxExporter.image.repository | string | `"nginx/nginx-prometheus-exporter"` | |
|
| telemetry.prometheus.nginxExporter.image.repository | string | `"nginx/nginx-prometheus-exporter"` | |
|
||||||
| telemetry.prometheus.nginxExporter.image.version | string | `"0.11.0"` | |
|
| telemetry.prometheus.nginxExporter.image.version | string | `"0.11.0"` | |
|
||||||
| telemetry.prometheus.nginxExporter.resources | object | `{}` | |
|
| telemetry.prometheus.nginxExporter.resources | object | `{}` | |
|
||||||
|
| telemetry.prometheus.podMonitor.enabled | bool | `false` | |
|
||||||
|
| telemetry.prometheus.podMonitor.labels | object | `{}` | |
|
||||||
|
| telemetry.prometheus.podMonitor.namespace | string | `""` | Override where to install the podMonitor, if not set will use the same namespace as the spiffe-oidc-discovery-provider |
|
||||||
| telemetry.prometheus.port | int | `9988` | |
|
| telemetry.prometheus.port | int | `9988` | |
|
||||||
| tolerations | list | `[]` | |
|
| tolerations | list | `[]` | |
|
||||||
| trustDomain | string | `"example.org"` | |
|
| trustDomain | string | `"example.org"` | |
|
||||||
|
|||||||
@@ -34,6 +34,16 @@ Allow the release namespace to be overridden for multi-namespace deployments in
|
|||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- define "spiffe-oidc-discovery-provider.podMonitor.namespace" -}}
|
||||||
|
{{- if ne (len .Values.telemetry.prometheus.podMonitor.namespace) 0 }}
|
||||||
|
{{- .Values.telemetry.prometheus.podMonitor.namespace }}
|
||||||
|
{{- else if ne (len (dig "telemetry" "prometheus" "podMonitor" "namespace" "" .Values.global)) 0 }}
|
||||||
|
{{- .Values.global.telemetry.prometheus.podMonitor.namespace }}
|
||||||
|
{{- else }}
|
||||||
|
{{- include "spiffe-oidc-discovery-provider.namespace" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
{{/*
|
{{/*
|
||||||
Create chart name and version as used by the chart label.
|
Create chart name and version as used by the chart label.
|
||||||
*/}}
|
*/}}
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
{{- if .Values.insecureScheme.enabled }}
|
||||||
|
{{- if (dig "telemetry" "prometheus" "podMonitor" "enabled" .Values.telemetry.prometheus.podMonitor.enabled .Values.global) }}
|
||||||
|
{{- $namespace := include "spiffe-oidc-discovery-provider.podMonitor.namespace" . }}
|
||||||
|
{{- $podNamespace := ( include "spiffe-oidc-discovery-provider.namespace" . ) }}
|
||||||
|
apiVersion: monitoring.coreos.com/v1
|
||||||
|
kind: PodMonitor
|
||||||
|
metadata:
|
||||||
|
name: {{ include "spire-agent.fullname" . }}
|
||||||
|
namespace: {{ $namespace }}
|
||||||
|
labels:
|
||||||
|
{{- include "spire-agent.labels" . | nindent 4 }}
|
||||||
|
{{- if ne (len (dig "telemetry" "prometheus" "podMonitor" "labels" (dict) .Values.global)) 0 }}
|
||||||
|
{{- .Values.global.telemetry.prometheus.podMonitor.labels | toYaml | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.telemetry.prometheus.podMonitor.labels }}
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
{{- include "spire-agent.selectorLabels" . | nindent 6 }}
|
||||||
|
podMetricsEndpoints:
|
||||||
|
- port: prom
|
||||||
|
{{- if ne $namespace $podNamespace }}
|
||||||
|
namespaceSelector:
|
||||||
|
kubernetes.io/metadata.name: {{ $podNamespace }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
@@ -120,6 +120,11 @@ telemetry:
|
|||||||
prometheus:
|
prometheus:
|
||||||
enabled: false
|
enabled: false
|
||||||
port: 9988
|
port: 9988
|
||||||
|
podMonitor:
|
||||||
|
enabled: false
|
||||||
|
# -- Override where to install the podMonitor, if not set will use the same namespace as the spiffe-oidc-discovery-provider
|
||||||
|
namespace: ""
|
||||||
|
labels: {}
|
||||||
|
|
||||||
nginxExporter:
|
nginxExporter:
|
||||||
image:
|
image:
|
||||||
|
|||||||
@@ -44,6 +44,9 @@ A Helm chart to install the SPIRE agent.
|
|||||||
| serviceAccount.name | string | `""` | |
|
| serviceAccount.name | string | `""` | |
|
||||||
| socketPath | string | `"/run/spire/agent-sockets/spire-agent.sock"` | |
|
| socketPath | string | `"/run/spire/agent-sockets/spire-agent.sock"` | |
|
||||||
| telemetry.prometheus.enabled | bool | `false` | |
|
| telemetry.prometheus.enabled | bool | `false` | |
|
||||||
|
| telemetry.prometheus.podMonitor.enabled | bool | `false` | |
|
||||||
|
| telemetry.prometheus.podMonitor.labels | object | `{}` | |
|
||||||
|
| telemetry.prometheus.podMonitor.namespace | string | `""` | Override where to install the podMonitor, if not set will use the same namespace as the spire-agent |
|
||||||
| telemetry.prometheus.port | int | `9988` | |
|
| telemetry.prometheus.port | int | `9988` | |
|
||||||
| trustDomain | string | `"example.org"` | |
|
| trustDomain | string | `"example.org"` | |
|
||||||
| waitForIt.image.pullPolicy | string | `"IfNotPresent"` | |
|
| waitForIt.image.pullPolicy | string | `"IfNotPresent"` | |
|
||||||
|
|||||||
@@ -42,6 +42,16 @@ Allow the release namespace to be overridden for multi-namespace deployments in
|
|||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- define "spire-agent.podMonitor.namespace" -}}
|
||||||
|
{{- if ne (len .Values.telemetry.prometheus.podMonitor.namespace) 0 }}
|
||||||
|
{{- .Values.telemetry.prometheus.podMonitor.namespace }}
|
||||||
|
{{- else if ne (len (dig "telemetry" "prometheus" "podMonitor" "namespace" "" .Values.global)) 0 }}
|
||||||
|
{{- .Values.global.telemetry.prometheus.podMonitor.namespace }}
|
||||||
|
{{- else }}
|
||||||
|
{{- include "spire-agent.namespace" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
{{/*
|
{{/*
|
||||||
Create chart name and version as used by the chart label.
|
Create chart name and version as used by the chart label.
|
||||||
*/}}
|
*/}}
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
{{- if (dig "telemetry" "prometheus" "podMonitor" "enabled" .Values.telemetry.prometheus.podMonitor.enabled .Values.global) }}
|
||||||
|
{{- $namespace := include "spiffe-oidc-discovery-provider.podMonitor.namespace" . }}
|
||||||
|
{{- $podNamespace := ( include "spiffe-oidc-discovery-provider.namespace" . ) }}
|
||||||
|
apiVersion: monitoring.coreos.com/v1
|
||||||
|
kind: PodMonitor
|
||||||
|
metadata:
|
||||||
|
name: {{ include "spiffe-oidc-discovery-provider.fullname" . }}
|
||||||
|
namespace: {{ $namespace }}
|
||||||
|
labels:
|
||||||
|
{{- include "spiffe-oidc-discovery-provider.labels" . | nindent 4 }}
|
||||||
|
{{- if ne (len (dig "telemetry" "prometheus" "podMonitor" "labels" (dict) .Values.global)) 0 }}
|
||||||
|
{{- .Values.global.telemetry.prometheus.podMonitor.labels | toYaml | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.telemetry.prometheus.podMonitor.labels }}
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
{{- include "spiffe-oidc-discovery-provider.selectorLabels" . | nindent 6 }}
|
||||||
|
podMetricsEndpoints:
|
||||||
|
- port: prom
|
||||||
|
{{- if ne $namespace $podNamespace }}
|
||||||
|
namespaceSelector:
|
||||||
|
kubernetes.io/metadata.name: {{ $podNamespace }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
@@ -86,6 +86,11 @@ telemetry:
|
|||||||
prometheus:
|
prometheus:
|
||||||
enabled: false
|
enabled: false
|
||||||
port: 9988
|
port: 9988
|
||||||
|
podMonitor:
|
||||||
|
enabled: false
|
||||||
|
# -- Override where to install the podMonitor, if not set will use the same namespace as the spire-agent
|
||||||
|
namespace: ""
|
||||||
|
labels: {}
|
||||||
|
|
||||||
socketPath: /run/spire/agent-sockets/spire-agent.sock
|
socketPath: /run/spire/agent-sockets/spire-agent.sock
|
||||||
|
|
||||||
|
|||||||
@@ -92,6 +92,9 @@ A Helm chart to install the SPIRE server.
|
|||||||
| serviceAccount.create | bool | `true` | |
|
| serviceAccount.create | bool | `true` | |
|
||||||
| serviceAccount.name | string | `""` | |
|
| serviceAccount.name | string | `""` | |
|
||||||
| telemetry.prometheus.enabled | bool | `false` | |
|
| telemetry.prometheus.enabled | bool | `false` | |
|
||||||
|
| telemetry.prometheus.podMonitor.enabled | bool | `false` | |
|
||||||
|
| telemetry.prometheus.podMonitor.labels | object | `{}` | |
|
||||||
|
| telemetry.prometheus.podMonitor.namespace | string | `""` | Override where to install the podMonitor, if not set will use the same namespace as the spire-server |
|
||||||
| tolerations | list | `[]` | |
|
| tolerations | list | `[]` | |
|
||||||
| topologySpreadConstraints | list | `[]` | |
|
| topologySpreadConstraints | list | `[]` | |
|
||||||
| trustDomain | string | `"example.org"` | |
|
| trustDomain | string | `"example.org"` | |
|
||||||
|
|||||||
@@ -34,6 +34,16 @@ Allow the release namespace to be overridden for multi-namespace deployments in
|
|||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- define "spire-server.podMonitor.namespace" -}}
|
||||||
|
{{- if ne (len .Values.telemetry.prometheus.podMonitor.namespace) 0 }}
|
||||||
|
{{- .Values.telemetry.prometheus.podMonitor.namespace }}
|
||||||
|
{{- else if ne (len (dig "telemetry" "prometheus" "podMonitor" "namespace" "" .Values.global)) 0 }}
|
||||||
|
{{- .Values.global.telemetry.prometheus.podMonitor.namespace }}
|
||||||
|
{{- else }}
|
||||||
|
{{- include "spire-server.namespace" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
{{/*
|
{{/*
|
||||||
Create chart name and version as used by the chart label.
|
Create chart name and version as used by the chart label.
|
||||||
*/}}
|
*/}}
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
{{- if (dig "telemetry" "prometheus" "podMonitor" "enabled" .Values.telemetry.prometheus.podMonitor.enabled .Values.global) }}
|
||||||
|
{{- $namespace := include "spire-server.podMonitor.namespace" . }}
|
||||||
|
{{- $podNamespace := ( include "spire-server.namespace" . ) }}
|
||||||
|
apiVersion: monitoring.coreos.com/v1
|
||||||
|
kind: PodMonitor
|
||||||
|
metadata:
|
||||||
|
name: {{ include "spire-server.fullname" . }}
|
||||||
|
namespace: {{ $namespace }}
|
||||||
|
labels:
|
||||||
|
{{- include "spire-server.labels" . | nindent 4 }}
|
||||||
|
{{- if ne (len (dig "telemetry" "prometheus" "podMonitor" "labels" (dict) .Values.global)) 0 }}
|
||||||
|
{{- .Values.global.telemetry.prometheus.podMonitor.labels | toYaml | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.telemetry.prometheus.podMonitor.labels }}
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
{{- include "spire-server.selectorLabels" . | nindent 6 }}
|
||||||
|
podMetricsEndpoints:
|
||||||
|
- port: prom
|
||||||
|
{{- if ne $namespace $podNamespace }}
|
||||||
|
namespaceSelector:
|
||||||
|
kubernetes.io/metadata.name: {{ $podNamespace }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
@@ -195,6 +195,11 @@ controllerManager:
|
|||||||
telemetry:
|
telemetry:
|
||||||
prometheus:
|
prometheus:
|
||||||
enabled: false
|
enabled: false
|
||||||
|
podMonitor:
|
||||||
|
enabled: false
|
||||||
|
# -- Override where to install the podMonitor, if not set will use the same namespace as the spire-server
|
||||||
|
namespace: ""
|
||||||
|
labels: {}
|
||||||
|
|
||||||
extraVolumes: []
|
extraVolumes: []
|
||||||
extraVolumeMounts: []
|
extraVolumeMounts: []
|
||||||
|
|||||||
@@ -14,6 +14,11 @@ global:
|
|||||||
# telemetry:
|
# telemetry:
|
||||||
# prometheus:
|
# prometheus:
|
||||||
# enabled: true
|
# enabled: true
|
||||||
|
# podMonitor:
|
||||||
|
# enabled: true
|
||||||
|
# # -- Allows to install the PodMonitor in another namespace then the spire components are installed into.
|
||||||
|
# namespace: "kube-prometheus-system"
|
||||||
|
# labels: {}
|
||||||
|
|
||||||
nameOverride: ""
|
nameOverride: ""
|
||||||
fullnameOverride: ""
|
fullnameOverride: ""
|
||||||
|
|||||||
Reference in New Issue
Block a user