Update spire-ha-agent (#936)

* Update spire-ha-agent

Signed-off-by: Kevin Fox <[email protected]>

* Update spire-ha-agent

Signed-off-by: Kevin Fox <[email protected]>

* Update with new features

Signed-off-by: Kevin Fox <[email protected]>

* Updates

Signed-off-by: Kevin Fox <[email protected]>

* Point at release

Signed-off-by: Kevin Fox <[email protected]>

* Fix version

Signed-off-by: Kevin Fox <[email protected]>

---------

Signed-off-by: Kevin Fox <[email protected]>
Co-authored-by: Faisal Memon <[email protected]>
This commit is contained in:
kfox1111
2026-09-04 20:34:10 +00:00
committed by GitHub
co-authored by Faisal Memon
parent 2a8c1b63c4
commit 90e3518dca
12 changed files with 592 additions and 250 deletions
+1 -1
View File
@@ -3,7 +3,7 @@ name: spire-ha-agent
description: A Helm chart to install the SPIRE HA agent.
type: application
version: 0.3.1
appVersion: "0.4.0"
appVersion: "0.5.0"
keywords: ["spiffe", "spire-ha-agent"]
home: https://github.com/spiffe/helm-charts-hardened/tree/main/charts/spire-ha-agent
sources:
+84 -65
View File
@@ -1,6 +1,6 @@
# spire-ha-agent
![Version: 0.3.1](https://img.shields.io/badge/Version-0.3.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.4.0](https://img.shields.io/badge/AppVersion-0.4.0-informational?style=flat-square)
![Version: 0.3.1](https://img.shields.io/badge/Version-0.3.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.5.0](https://img.shields.io/badge/AppVersion-0.5.0-informational?style=flat-square)
A Helm chart to install the SPIRE HA agent.
@@ -24,67 +24,86 @@ A Helm chart to install the SPIRE HA agent.
### Chart parameters
| Name | Description | Value |
| --------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- |
| `image.registry` | The OCI registry to pull the image from | `ghcr.io` |
| `image.repository` | The repository within the registry | `spiffe/spire-ha-agent` |
| `image.pullPolicy` | The image pull policy | `IfNotPresent` |
| `image.tag` | Overrides the image tag whose default is the chart appVersion | `""` |
| `mode` | If the spire-ha-agent will run in delegated or broker mode | `delegated` |
| `singleSocket` | If in singleSocket mode, only one driver is used | `false` |
| `sockets.single.admin.hostPath` | Where the admin socket is on disk when in single socket mode | `/var/run/spire/agent/sockets/main/csi.spiffe.io/admin` |
| `sockets.a.admin.hostPath` | Where the a admin socket is on disk | `/var/run/spire/agent/sockets/a/csi.spiffe.io/admin` |
| `sockets.b.admin.hostPath` | Where the b admin sockets is on disk | `/var/run/spire/agent/sockets/b/csi.spiffe.io/admin` |
| `sockets.single.broker.hostPath` | Where the broker socket is on disk when in single socket mode | `/var/run/spire/agent/sockets/main/csi.spiffe.io/broker` |
| `sockets.a.broker.hostPath` | Where the a broker socket is on disk | `/var/run/spire/agent/sockets/a/csi.spiffe.io/broker` |
| `sockets.b.broker.hostPath` | Where the b broker socket is on disk | `/var/run/spire/agent/sockets/b/csi.spiffe.io/broker` |
| `sockets.single.workload.hostPath` | Where the broker socket is on disk when in single socket mode | `/var/run/spire/agent-sockets` |
| `sockets.a.workload.hostPath` | Where the a workload socket is on disk | `/var/run/spire/agent/sockets/a/csi.spiffe.io/public` |
| `sockets.b.workload.hostPath` | Where the b workload socket is on disk | `/var/run/spire/agent/sockets/b/csi.spiffe.io/public` |
| `vsock` | Use a vsockets to expose the service rather then a unix socket | `false` |
| `port` | Port number to listen on | `999` |
| `imagePullSecrets` | Pull secrets for images | `[]` |
| `nameOverride` | Name override | `""` |
| `namespaceOverride` | Namespace override | `""` |
| `fullnameOverride` | Fullname override | `""` |
| `serviceAccount.create` | Specifies whether a service account should be created | `true` |
| `serviceAccount.annotations` | Annotations to add to the service account | `{}` |
| `serviceAccount.name` | The name of the service account to use. | `""` |
| `podAnnotations` | Annotations to add to pods | `{}` |
| `podLabels` | Labels to add to pods | `{}` |
| `podSecurityContext` | Pod security context | `{}` |
| `securityContext` | Security context | `{}` |
| `resources` | Resource requests and limits | `{}` |
| `nodeSelector` | Node selector | `{}` |
| `tolerations` | List of tolerations | `[]` |
| `affinity` | Node affinity | `{}` |
| `updateStrategy.type` | The update strategy to use to replace existing DaemonSet pods with new pods. Can be RollingUpdate or OnDelete. | `RollingUpdate` |
| `updateStrategy.rollingUpdate.maxUnavailable` | Max unavailable pods during update. Can be a number or a percentage. | `1` |
| `fsGroupFix.image.registry` | The OCI registry to pull the image from | `cgr.dev` |
| `fsGroupFix.image.repository` | The repository within the registry | `chainguard/bash` |
| `fsGroupFix.image.pullPolicy` | The image pull policy | `Always` |
| `fsGroupFix.image.tag` | Overrides the image tag whose default is the chart appVersion | `latest@sha256:ea74a5487d6a76198fb651b48e953a01d13128c68ecf38df3d6e22307f0b93c1` |
| `fsGroupFix.resources` | Specify resource needs as per https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ | `{}` |
| `cid2PID.image.registry` | The OCI registry to pull the image from | `ghcr.io` |
| `cid2PID.image.repository` | The repository within the registry | `kfox1111/cid2pid` |
| `cid2PID.image.pullPolicy` | The image pull policy | `Always` |
| `cid2PID.image.tag` | Overrides the image tag whose default is the chart appVersion | `v0.0.3` |
| `cid2PID.busybox.image.registry` | The OCI registry to pull the image from | `docker.io` |
| `cid2PID.busybox.image.repository` | The repository within the registry | `library/busybox` |
| `cid2PID.busybox.image.pullPolicy` | The image pull policy | `IfNotPresent` |
| `cid2PID.busybox.image.tag` | Overrides the image tag whose default is the chart appVersion | `1.36.1-uclibc` |
| `cid2PID.busybox.resources` | Specify resource needs as per https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ | `{}` |
| `socketPath` | The unix socket path to the spire-agent | `/run/spire/agent-sockets/spire-agent.sock` |
| `socketAlternate.names` | List of alternate names for the socket that workloads might expect to be able to access in the driver mount. | `["socket","spire-agent.sock","api.sock"]` |
| `socketAlternate.image.registry` | The OCI registry to pull the image from | `cgr.dev` |
| `socketAlternate.image.repository` | The repository within the registry | `chainguard/bash` |
| `socketAlternate.image.pullPolicy` | The image pull policy | `Always` |
| `socketAlternate.image.tag` | Overrides the image tag whose default is the chart appVersion | `latest@sha256:ea74a5487d6a76198fb651b48e953a01d13128c68ecf38df3d6e22307f0b93c1` |
| `socketAlternate.resources` | Specify resource needs as per https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ | `{}` |
| `priorityClassName` | Priority class assigned to daemonset pods. Can be auto set with global.recommendations.priorityClassName. | `""` |
| `extraEnvVars` | Extra environment variables to be added to the Spire Agent container | `[]` |
| `extraVolumes` | Extra volumes to be mounted on Spire Agent pods | `[]` |
| `extraVolumeMounts` | Extra volume mounts for Spire Agent pods | `[]` |
| `extraContainers` | Additional containers to create with Spire Agent pods | `[]` |
| `initContainers` | Additional init containers to create with Spire Agent pods | `[]` |
| `hostAliases` | Customize /etc/hosts file as described here https://kubernetes.io/docs/tasks/network/customize-hosts-file-for-pods/ | `[]` |
| Name | Description | Value |
| ------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------- |
| `image.registry` | The OCI registry to pull the image from | `ghcr.io` |
| `image.repository` | The repository within the registry | `spiffe/spire-ha-agent` |
| `image.pullPolicy` | The image pull policy | `IfNotPresent` |
| `image.tag` | Overrides the image tag whose default is the chart appVersion | `""` |
| `mode` | If the spire-ha-agent will run in delegated or broker mode | `delegated` |
| `trustDomain` | The trust domain to be used for the SPIFFE identifiers | `example.org` |
| `singleSocket` | If in singleSocket mode, only one driver is used | `false` |
| `sockets.single.admin.hostPath` | Where the admin socket is on disk when in single socket mode | `/var/run/spire/agent/sockets/main/csi.spiffe.io/admin` |
| `sockets.a.admin.hostPath` | Where the a admin socket is on disk | `/var/run/spire/agent/sockets/a/csi.spiffe.io/admin` |
| `sockets.b.admin.hostPath` | Where the b admin sockets is on disk | `/var/run/spire/agent/sockets/b/csi.spiffe.io/admin` |
| `sockets.single.broker.hostPath` | Where the broker socket is on disk when in single socket mode | `/var/run/spire/agent/sockets/main/csi.spiffe.io/broker` |
| `sockets.a.broker.hostPath` | Where the a broker socket is on disk | `/var/run/spire/agent/sockets/a/csi.spiffe.io/broker` |
| `sockets.b.broker.hostPath` | Where the b broker socket is on disk | `/var/run/spire/agent/sockets/b/csi.spiffe.io/broker` |
| `sockets.single.workload.hostPath` | Where the broker socket is on disk when in single socket mode | `/var/run/spire/agent-sockets` |
| `sockets.a.workload.hostPath` | Where the a workload socket is on disk | `/var/run/spire/agent/sockets/a/csi.spiffe.io/public` |
| `sockets.b.workload.hostPath` | Where the b workload socket is on disk | `/var/run/spire/agent/sockets/b/csi.spiffe.io/public` |
| `vsock` | Use a vsockets to expose the service rather then a unix socket | `false` |
| `port` | Port number to listen on | `999` |
| `brokerAPI.enabled` | Serve the SPIFFE Broker API to downstream consumers. Only supported when mode is broker. | `false` |
| `brokerAPI.socket.enabled` | Serve the broker api on a unix socket | `true` |
| `brokerAPI.socket.mountOnHost` | Make the served broker socket visible on the host, so consumers running in other pods on the node can reach it. When false the socket stays in an emptyDir, reachable only from this pod. | `true` |
| `brokerAPI.socket.hostPath` | Where the served broker socket is made available on the host when mountOnHost is true | `/run/spire/agent/sockets/csi.spiffe.io/broker` |
| `brokerAPI.tcp.enabled` | Serve the broker api over tcp | `false` |
| `brokerAPI.tcp.bindAddress` | The tcp address to bind to | `0.0.0.0:8788` |
| `brokerAPI.brokers.spiffefs.enabled` | Enable spiffefs as a broker. This feature is experimental. | `false` |
| `brokerAPI.brokers.spiffefs.idTemplate` | The default id template | `spiffe://{{ .TrustDomain }}/spiffefs` |
| `brokerAPI.brokers.spiffefs.allowedReferenceTypes[0].typeURL` | The type of reference allowed | `type.googleapis.com/spiffe.broker.WorkloadPIDReference` |
| `brokerAPI.brokers.spiffefs.allowedReferenceTypes[0].allowOverTCP` | Allow access over TCP | `false` |
| `upstreamKeepalive.time` | How often to ping an upstream broker to notice a connection that died silently. 0 disables. Do not lower below 5m: a spire-agent that does not configure a keepalive enforcement policy answers more frequent pings with GOAWAY too_many_pings and drops the connection. | `5m` |
| `upstreamKeepalive.timeout` | How long to wait for a keepalive ping response before considering the connection dead | `20s` |
| `telemetry.prometheus.enabled` | Flag to enable prometheus monitoring | `false` |
| `telemetry.prometheus.port` | Port for prometheus metrics | `9988` |
| `telemetry.prometheus.host` | Host for prometheus metrics | `0.0.0.0` |
| `telemetry.prometheus.podMonitor.enabled` | Enable podMonitor for prometheus | `false` |
| `telemetry.prometheus.podMonitor.namespace` | Override where to install the podMonitor, if not set will use the same namespace as the spire-ha-agent | `""` |
| `telemetry.prometheus.podMonitor.labels` | Pod labels to filter for prometheus monitoring | `{}` |
| `imagePullSecrets` | Pull secrets for images | `[]` |
| `nameOverride` | Name override | `""` |
| `namespaceOverride` | Namespace override | `""` |
| `fullnameOverride` | Fullname override | `""` |
| `serviceAccount.create` | Specifies whether a service account should be created | `true` |
| `serviceAccount.annotations` | Annotations to add to the service account | `{}` |
| `serviceAccount.name` | The name of the service account to use. | `""` |
| `podAnnotations` | Annotations to add to pods | `{}` |
| `podLabels` | Labels to add to pods | `{}` |
| `podSecurityContext` | Pod security context | `{}` |
| `securityContext` | Security context | `{}` |
| `resources` | Resource requests and limits | `{}` |
| `nodeSelector` | Node selector | `{}` |
| `tolerations` | List of tolerations | `[]` |
| `affinity` | Node affinity | `{}` |
| `updateStrategy.type` | The update strategy to use to replace existing DaemonSet pods with new pods. Can be RollingUpdate or OnDelete. | `RollingUpdate` |
| `updateStrategy.rollingUpdate.maxUnavailable` | Max unavailable pods during update. Can be a number or a percentage. | `1` |
| `fsGroupFix.image.registry` | The OCI registry to pull the image from | `cgr.dev` |
| `fsGroupFix.image.repository` | The repository within the registry | `chainguard/bash` |
| `fsGroupFix.image.pullPolicy` | The image pull policy | `Always` |
| `fsGroupFix.image.tag` | Overrides the image tag whose default is the chart appVersion | `latest@sha256:ea74a5487d6a76198fb651b48e953a01d13128c68ecf38df3d6e22307f0b93c1` |
| `fsGroupFix.resources` | Specify resource needs as per https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ | `{}` |
| `cid2PID.image.registry` | The OCI registry to pull the image from | `ghcr.io` |
| `cid2PID.image.repository` | The repository within the registry | `kfox1111/cid2pid` |
| `cid2PID.image.pullPolicy` | The image pull policy | `Always` |
| `cid2PID.image.tag` | Overrides the image tag whose default is the chart appVersion | `v0.0.3` |
| `cid2PID.busybox.image.registry` | The OCI registry to pull the image from | `docker.io` |
| `cid2PID.busybox.image.repository` | The repository within the registry | `library/busybox` |
| `cid2PID.busybox.image.pullPolicy` | The image pull policy | `IfNotPresent` |
| `cid2PID.busybox.image.tag` | Overrides the image tag whose default is the chart appVersion | `1.36.1-uclibc` |
| `cid2PID.busybox.resources` | Specify resource needs as per https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ | `{}` |
| `socketPath` | The unix socket path to the spire-agent | `/run/spire/agent-sockets/spire-agent.sock` |
| `socketAlternate.names` | List of alternate names for the socket that workloads might expect to be able to access in the driver mount. | `["socket","spire-agent.sock","api.sock"]` |
| `socketAlternate.image.registry` | The OCI registry to pull the image from | `cgr.dev` |
| `socketAlternate.image.repository` | The repository within the registry | `chainguard/bash` |
| `socketAlternate.image.pullPolicy` | The image pull policy | `Always` |
| `socketAlternate.image.tag` | Overrides the image tag whose default is the chart appVersion | `latest@sha256:ea74a5487d6a76198fb651b48e953a01d13128c68ecf38df3d6e22307f0b93c1` |
| `socketAlternate.resources` | Specify resource needs as per https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ | `{}` |
| `priorityClassName` | Priority class assigned to daemonset pods. Can be auto set with global.recommendations.priorityClassName. | `""` |
| `extraEnvVars` | Extra environment variables to be added to the Spire Agent container | `[]` |
| `extraVolumes` | Extra volumes to be mounted on Spire Agent pods | `[]` |
| `extraVolumeMounts` | Extra volume mounts for Spire Agent pods | `[]` |
| `extraContainers` | Additional containers to create with Spire Agent pods | `[]` |
| `initContainers` | Additional init containers to create with Spire Agent pods | `[]` |
| `hostAliases` | Customize /etc/hosts file as described here https://kubernetes.io/docs/tasks/network/customize-hosts-file-for-pods/ | `[]` |
@@ -110,6 +110,15 @@ Create the name of the service account to use
{{- end }}
{{- end }}
{{/*
Whether prometheus metrics are on.
*/}}
{{- define "spire-ha-agent.prometheus-enabled" -}}
{{- if or (dig "telemetry" "prometheus" "enabled" .Values.telemetry.prometheus.enabled .Values.global) (and (dig "spire" "recommendations" "enabled" false .Values.global) (dig "spire" "recommendations" "prometheus" true .Values.global)) }}
{{- printf "true" }}
{{- end }}
{{- end }}
{{- define "spire-ha-agent.socket-path" -}}
{{- print .Values.socketPath }}
{{- end }}
@@ -0,0 +1,94 @@
{{- define "spire-ha-agent.check-config-values" -}}
{{- if not (has .Values.mode (list "delegated" "broker")) }}
{{- fail (printf "mode must be one of [delegated, broker], got: %s" .Values.mode) }}
{{- end }}
{{- if .Values.brokerAPI.enabled }}
{{- if ne .Values.mode "broker" }}
{{- fail "brokerAPI.enabled is true but mode is not broker. The served broker api is only available in broker mode." }}
{{- end }}
{{- if and (not .Values.brokerAPI.socket.enabled) (not .Values.brokerAPI.tcp.enabled) }}
{{- fail "brokerAPI.enabled is true but neither brokerAPI.socket.enabled nor brokerAPI.tcp.enabled is set. At least one listener is required." }}
{{- end }}
{{- $enabledBrokers := 0 }}
{{- range $name, $value := .Values.brokerAPI.brokers }}
{{- if or (not (hasKey $value "enabled")) $value.enabled }}
{{- $enabledBrokers = add1 $enabledBrokers }}
{{- end }}
{{- end }}
{{- if eq $enabledBrokers 0 }}
{{- fail "brokerAPI.enabled is true but no entry in brokerAPI.brokers is enabled. Only listed brokers may connect, so at least one is required." }}
{{- end }}
{{- include "spire-lib.check-strict-mode" (list . "trustDomain must be set when brokerAPI is enabled, as broker ids are derived from it" (eq (include "spire-lib.trust-domain" .) "example.org")) }}
{{- end }}
{{- end }}
{{/*
The agent reads this config as YAML, so it is emitted directly rather than
going through spire-lib.reformat-and-yaml2json. That helper exists to hand
spire an HCL-compatible JSON document and to reshape its plugins dict into
lists; neither applies here.
*/}}
{{- define "spire-ha-agent.yaml-config" -}}
{{- $trustDomain := include "spire-lib.trust-domain" . | trim -}}
single: {{ eq .Values.singleSocket true }}
{{- if .Values.vsock }}
vsock:
enabled: true
port: {{ .Values.port }}
{{- else }}
socket: /tmp/spire-ha-agent/public/spire-agent.sock
{{- end }}
upstream_a:
broker_address: unix:///var/run/spire/agent/sockets/a/csi.spiffe.io/broker/broker.sock
workload_socket: unix:///var/run/spire/agent/sockets/a/csi.spiffe.io/public/spire-agent.sock
{{- if not .Values.singleSocket }}
upstream_b:
broker_address: unix:///var/run/spire/agent/sockets/b/csi.spiffe.io/broker/broker.sock
workload_socket: unix:///var/run/spire/agent/sockets/b/csi.spiffe.io/public/spire-agent.sock
{{- end }}
upstream_keepalive:
time: {{ .Values.upstreamKeepalive.time | quote }}
timeout: {{ .Values.upstreamKeepalive.timeout | quote }}
{{- if include "spire-ha-agent.prometheus-enabled" . }}
metrics:
bind_address: {{ printf "%s:%v" .Values.telemetry.prometheus.host .Values.telemetry.prometheus.port | quote }}
{{- end }}
{{- if .Values.brokerAPI.enabled }}
broker_endpoint:
{{- /* Deliberately not under the workload api socket directory: the agent
rejects a socket_path that shares a directory with it. */}}
{{- if .Values.brokerAPI.socket.enabled }}
socket_path: /tmp/spire-ha-agent/broker/broker.sock
{{- end }}
{{- if .Values.brokerAPI.tcp.enabled }}
bind_address: {{ .Values.brokerAPI.tcp.bindAddress | quote }}
{{- end }}
brokers:
{{- range $name, $value := .Values.brokerAPI.brokers }}
{{- if or (not (hasKey $value "enabled")) $value.enabled }}
- id: {{ tpl $value.idTemplate (dict "TrustDomain" $trustDomain) | quote }}
allowed_reference_types:
{{- range $value.allowedReferenceTypes }}
- type_url: {{ .typeURL | quote }}
allow_over_tcp: {{ eq .allowOverTCP true }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- /* Validation runs for every mode: two of its checks exist precisely to
catch a mode that is not broker. */}}
{{- include "spire-ha-agent.check-config-values" . }}
{{- if eq .Values.mode "broker" }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "spire-ha-agent.fullname" . | quote }}
namespace: {{ include "spire-ha-agent.namespace" . | quote }}
labels:
{{- include "spire-ha-agent.labels" . | nindent 4 }}
data:
config.yaml: |
{{- include "spire-ha-agent.yaml-config" . | nindent 4 }}
{{- end }}
+55 -22
View File
@@ -2,6 +2,7 @@
{{- $mainSecurityContext := deepCopy .Values.securityContext }}
{{- $socketAlternateNames := index (include "spire-ha-agent.socket-alternate-names" . | fromYaml) "names" }}
{{- $socketPath := include "spire-ha-agent.socket-path" . }}
{{- $configSum := (include (print $.Template.BasePath "/configmap.yaml") . | sha256sum) }}
apiVersion: apps/v1
kind: DaemonSet
metadata:
@@ -30,6 +31,12 @@ spec:
metadata:
annotations:
kubectl.kubernetes.io/default-container: spire-ha-agent
{{- if eq .Values.mode "broker" }}
checksum/config: {{ $configSum | quote }}
{{- end }}
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "spire-ha-agent.selectorLabels" . | nindent 8 }}
app.kubernetes.io/component: spire-ha-agent
@@ -122,53 +129,51 @@ spec:
args:
- "-mode"
- {{ .Values.mode | quote }}
{{- if eq .Values.mode "broker" }}
- "-config"
- "/opt/spire-ha-agent/conf/config.yaml"
{{- end }}
securityContext:
privileged: true
#FIXME read permission to api socket
runAsUser: 0
runAsGroup: 0
#{- $mainSecurityContext | toYaml | nindent 12 }}
{{- /* Broker mode is configured entirely by the rendered config
file, so it has nothing to put here unless the user supplied
extraEnvVars. Emitting a bare env: would render env: null. */}}
{{- if or (eq .Values.mode "delegated") (gt (len .Values.extraEnvVars) 0) }}
env:
{{- if eq .Values.mode "delegated" }}
- name: SPIRE_HA_AGENT_SOCK
value: /tmp/spire-ha-agent/public/spire-agent.sock
{{- if .Values.singleSocket }}
{{- if .Values.singleSocket }}
- name: SPIRE_HA_AGENT_SINGLE
value: enabled
{{- if eq .Values.mode "delegated" }}
- name: SPIRE_HA_AGENT_SOCKET
value: unix:///var/run/spire/agent/sockets/a/csi.spiffe.io/admin/admin.sock
{{- else }}
- name: SPIRE_HA_AGENT_BROKER
value: unix:///var/run/spire/agent/sockets/a/csi.spiffe.io/broker/broker.sock
- name: SPIRE_HA_AGENT_WORKLOAD_SOCKET
value: unix:///var/run/spire/agent/sockets/a/csi.spiffe.io/public/spire-agent.sock
{{- end }}
{{- else }}
{{- if eq .Values.mode "delegated" }}
{{- else }}
- name: SPIRE_HA_AGENT_SOCKET_A
value: unix:///var/run/spire/agent/sockets/a/csi.spiffe.io/admin/admin.sock
- name: SPIRE_HA_AGENT_SOCKET_B
value: unix:///var/run/spire/agent/sockets/b/csi.spiffe.io/admin/admin.sock
{{- else }}
- name: SPIRE_HA_AGENT_BROKER_A
value: unix:///var/run/spire/agent/sockets/a/csi.spiffe.io/broker/broker.sock
- name: SPIRE_HA_AGENT_BROKER_B
value: unix:///var/run/spire/agent/sockets/b/csi.spiffe.io/broker/broker.sock
- name: SPIRE_HA_AGENT_WORKLOAD_SOCKET_A
value: unix:///var/run/spire/agent/sockets/a/csi.spiffe.io/public/spire-agent.sock
- name: SPIRE_HA_AGENT_WORKLOAD_SOCKET_B
value: unix:///var/run/spire/agent/sockets/b/csi.spiffe.io/public/spire-agent.sock
{{- end }}
{{- end }}
{{- if .Values.vsock }}
{{- end }}
{{- if .Values.vsock }}
- name: SPIRE_HA_AGENT_VSOCK
value: enabled
- name: SPIRE_HA_AGENT_PORT
value: {{ .Values.port | quote }}
{{- end }}
{{- end }}
{{- with .Values.extraEnvVars }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- end }}
{{- if include "spire-ha-agent.prometheus-enabled" . }}
ports:
- containerPort: {{ .Values.telemetry.prometheus.port }}
name: prom
{{- end }}
volumeMounts:
# - name: spire-ha-agent-persistence
# mountPath: /var/lib/spire
@@ -201,6 +206,18 @@ spec:
mountPath: /var/run/spire/agent/sockets/b/csi.spiffe.io/public
{{- end }}
{{- end }}
{{- if eq .Values.mode "broker" }}
- name: spire-ha-agent-config
mountPath: /opt/spire-ha-agent/conf
readOnly: true
{{- if .Values.brokerAPI.enabled }}
{{- if .Values.brokerAPI.socket.enabled }}
- name: spire-ha-agent-broker-socket-dir
mountPath: /tmp/spire-ha-agent/broker
readOnly: false
{{- end }}
{{- end }}
{{- end }}
- name: dev
mountPath: /dev
{{- if gt (len .Values.extraVolumeMounts) 0 }}
@@ -261,6 +278,22 @@ spec:
type: DirectoryOrCreate
{{- end }}
{{- end }}
{{- if eq .Values.mode "broker" }}
- name: spire-ha-agent-config
configMap:
name: {{ include "spire-ha-agent.fullname" . | quote }}
{{- if and .Values.brokerAPI.enabled .Values.brokerAPI.socket.enabled }}
{{- if .Values.brokerAPI.socket.mountOnHost }}
- name: spire-ha-agent-broker-socket-dir
hostPath:
path: {{ .Values.brokerAPI.socket.hostPath | quote }}
type: DirectoryOrCreate
{{- else }}
- name: spire-ha-agent-broker-socket-dir
emptyDir: {}
{{- end }}
{{- end }}
{{- end }}
- name: dev
hostPath:
path: /dev
@@ -0,0 +1,27 @@
{{- if (dig "telemetry" "prometheus" "podMonitor" "enabled" .Values.telemetry.prometheus.podMonitor.enabled .Values.global) }}
{{- $namespace := include "spire-ha-agent.podMonitor.namespace" . }}
{{- $podNamespace := ( include "spire-ha-agent.namespace" . ) }}
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
name: {{ include "spire-ha-agent.fullname" . }}
namespace: {{ $namespace | quote }}
labels:
{{- include "spire-ha-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-ha-agent.selectorLabels" . | nindent 6 }}
podMetricsEndpoints:
- port: prom
{{- if ne $namespace $podNamespace }}
namespaceSelector:
kubernetes.io/metadata.name: {{ $podNamespace | quote }}
{{- end }}
{{- end }}
+55
View File
@@ -20,6 +20,9 @@ image:
## @param mode If the spire-ha-agent will run in delegated or broker mode
mode: delegated
## @param trustDomain The trust domain to be used for the SPIFFE identifiers
trustDomain: example.org
## @param singleSocket If in singleSocket mode, only one driver is used
singleSocket: false
@@ -61,6 +64,58 @@ vsock: false
## @param port Port number to listen on
port: 999
brokerAPI:
## @param brokerAPI.enabled Serve the SPIFFE Broker API to downstream consumers. Only supported when mode is broker.
enabled: false
socket:
## @param brokerAPI.socket.enabled Serve the broker api on a unix socket
enabled: true
## @param brokerAPI.socket.mountOnHost Make the served broker socket visible on the host, so consumers running in other pods on the node can reach it. When false the socket stays in an emptyDir, reachable only from this pod.
mountOnHost: true
## @param brokerAPI.socket.hostPath Where the served broker socket is made available on the host when mountOnHost is true
hostPath: /run/spire/agent/sockets/csi.spiffe.io/broker
tcp:
## @param brokerAPI.tcp.enabled Serve the broker api over tcp
enabled: false
## @param brokerAPI.tcp.bindAddress The tcp address to bind to
bindAddress: 0.0.0.0:8788
## Brokers allowed to use the served broker api, keyed by name. At least one
## must be enabled when brokerAPI.enabled is true. Add your own alongside
## these following the same shape.
brokers:
spiffefs:
## @param brokerAPI.brokers.spiffefs.enabled Enable spiffefs as a broker. This feature is experimental.
enabled: false
## @param brokerAPI.brokers.spiffefs.idTemplate The default id template
idTemplate: spiffe://{{ .TrustDomain }}/spiffefs
allowedReferenceTypes:
## @param brokerAPI.brokers.spiffefs.allowedReferenceTypes[0].typeURL The type of reference allowed
## @param brokerAPI.brokers.spiffefs.allowedReferenceTypes[0].allowOverTCP Allow access over TCP
- typeURL: "type.googleapis.com/spiffe.broker.WorkloadPIDReference"
allowOverTCP: false
upstreamKeepalive:
## @param upstreamKeepalive.time How often to ping an upstream broker to notice a connection that died silently. 0 disables. Do not lower below 5m: a spire-agent that does not configure a keepalive enforcement policy answers more frequent pings with GOAWAY too_many_pings and drops the connection.
time: 5m
## @param upstreamKeepalive.timeout How long to wait for a keepalive ping response before considering the connection dead
timeout: 20s
telemetry:
prometheus:
## @param telemetry.prometheus.enabled Flag to enable prometheus monitoring
enabled: false
## @param telemetry.prometheus.port Port for prometheus metrics
port: 9988
## @param telemetry.prometheus.host Host for prometheus metrics
host: "0.0.0.0"
podMonitor:
## @param telemetry.prometheus.podMonitor.enabled Enable podMonitor for prometheus
enabled: false
## @param telemetry.prometheus.podMonitor.namespace Override where to install the podMonitor, if not set will use the same namespace as the spire-ha-agent
namespace: ""
## @param telemetry.prometheus.podMonitor.labels [object] Pod labels to filter for prometheus monitoring
labels: {}
## @param imagePullSecrets [array] Pull secrets for images
imagePullSecrets: []