Skip to content
This repository has been archived by the owner on Mar 22, 2024. It is now read-only.

Commit

Permalink
Basic Prometheus support
Browse files Browse the repository at this point in the history
This patch adds very basic prometheus support to the agent and server
It also has a fix in it so that changes to the agent or server
configmaps reload those pods.

Signed-off-by: Kevin Fox <Kevin.Fox@pnnl.gov>
  • Loading branch information
kfox1111 committed Feb 22, 2023
1 parent b804b0a commit 6d28222
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 6 deletions.
9 changes: 9 additions & 0 deletions charts/spire/charts/spire-agent/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,12 @@ data:
live_path = "/live"
ready_path = "/ready"
}
{{- if (dig "telemetry" "prometheus" "enabled" .Values.telemetry.prometheus.enabled .Values.global) }}
telemetry {
Prometheus {
host = "0.0.0.0"
port = 9988
}
}
{{- end }}
8 changes: 5 additions & 3 deletions charts/spire/charts/spire-agent/templates/daemonset.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- $configSum := (include (print $.Template.BasePath "/configmap.yaml") . | sha256sum) }}
apiVersion: apps/v1
kind: DaemonSet
metadata:
Expand All @@ -11,10 +12,11 @@ spec:
{{- include "spire-agent.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
checksum/config: {{ $configSum }}
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "spire-agent.selectorLabels" . | nindent 8 }}
spec:
Expand Down
4 changes: 4 additions & 0 deletions charts/spire/charts/spire-agent/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,7 @@ waitForIt:
pullPolicy: IfNotPresent
version: latest-20230113
resources: {}

telemetry:
prometheus:
enabled: false
9 changes: 9 additions & 0 deletions charts/spire/charts/spire-server/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,12 @@ data:
live_path = "/live"
ready_path = "/ready"
}
{{- if (dig "telemetry" "prometheus" "enabled" .Values.telemetry.prometheus.enabled .Values.global) }}
telemetry {
Prometheus {
host = "0.0.0.0"
port = 9988
}
}
{{- end }}
8 changes: 5 additions & 3 deletions charts/spire/charts/spire-server/templates/statefulset.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- $configSum := (include (print $.Template.BasePath "/configmap.yaml") . | sha256sum) }}
{{- $fullname := include "spire-server.fullname" . }}
apiVersion: apps/v1
kind: StatefulSet
Expand All @@ -15,10 +16,11 @@ spec:
{{- include "spire-server.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
checksum/config: {{ $configSum }}
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "spire-server.selectorLabels" . | nindent 8 }}
spec:
Expand Down
4 changes: 4 additions & 0 deletions charts/spire/charts/spire-server/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -159,3 +159,7 @@ controllerManager:
# spiffe.io/spiffe-id: "true"
dnsNameTemplates: []
# - '{{ index .PodMeta.Labels "app.kubernetes.io/name" }}.{{ .PodMeta.Namespace }}.svc.cluster.local'

telemetry:
prometheus:
enabled: false
13 changes: 13 additions & 0 deletions charts/spire/values.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
#global:
# telemetry:
# prometheus:
# enabled: false|true

nameOverride: ""
fullnameOverride: ""

Expand All @@ -9,13 +14,21 @@ spire-server:
clusterName: &clusterName "example-cluster"
trustDomain: &trustDomain "example.org"

telemetry:
prometheus:
enabled: true

spire-agent:
nameOverride: agent
bundleConfigMap: *bundleConfigMap

clusterName: *clusterName
trustDomain: *trustDomain

telemetry:
prometheus:
enabled: true

spiffe-csi-driver: {}

spiffe-oidc-discovery-provider:
Expand Down

0 comments on commit 6d28222

Please sign in to comment.