Add a flag to configure the Kubernetes NodeAttestor (#83)

This commit is contained in:
kfox1111
2023-03-06 19:59:54 +01:00
committed by GitHub
parent 027556904d
commit f123296032
4 changed files with 13 additions and 5 deletions
@@ -62,6 +62,7 @@ A Helm chart to install the SPIRE server.
| jwtIssuer | string | `"oidc-discovery.example.org"` | | | jwtIssuer | string | `"oidc-discovery.example.org"` | |
| logLevel | string | `"info"` | | | logLevel | string | `"info"` | |
| nameOverride | string | `""` | | | nameOverride | string | `""` | |
| nodeAttestor.k8sPsat.enabled | bool | `true` | |
| nodeAttestor.k8sPsat.serviceAccountAllowList | list | `[]` | | | nodeAttestor.k8sPsat.serviceAccountAllowList | list | `[]` | |
| nodeSelector | object | `{}` | | | nodeSelector | object | `{}` | |
| podAnnotations | object | `{}` | | | podAnnotations | object | `{}` | |
@@ -1,4 +1,4 @@
{{ $namespace := .Release.Namespace }} {{ $root := . }}
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: ConfigMap
metadata: metadata:
@@ -36,15 +36,19 @@ data:
} }
} }
{{- with .Values.nodeAttestor.k8sPsat }}
{{- if eq (.enabled | toString) "true" }}
NodeAttestor "k8s_psat" { NodeAttestor "k8s_psat" {
plugin_data { plugin_data {
clusters = { clusters = {
{{ .Values.clusterName | quote }} = { {{ $root.Values.clusterName | quote }} = {
service_account_allow_list = {{ include "spire-server.serviceAccountAllowedList" . | trim }} service_account_allow_list = {{ include "spire-server.serviceAccountAllowedList" $root | trim }}
} }
} }
} }
} }
{{- end }}
{{- end }}
KeyManager "disk" { KeyManager "disk" {
plugin_data { plugin_data {
@@ -80,7 +84,7 @@ data:
issuer_name = {{ .issuer_name | quote }} issuer_name = {{ .issuer_name | quote }}
issuer_kind = {{ .issuer_kind | quote }} issuer_kind = {{ .issuer_kind | quote }}
issuer_group = {{ .issuer_group | quote }} issuer_group = {{ .issuer_group | quote }}
namespace = {{ default $namespace .namespace | quote }} namespace = {{ default $root.Release.Namespace .namespace | quote }}
{{- if ne .kube_config_file "" }} {{- if ne .kube_config_file "" }}
kube_config_file = {{ .kube_config_file | quote }} kube_config_file = {{ .kube_config_file | quote }}
{{- end }} {{- end }}
@@ -44,6 +44,8 @@ roleRef:
kind: Role kind: Role
name: {{ include "spire-server.fullname" . }} name: {{ include "spire-server.fullname" . }}
apiGroup: rbac.authorization.k8s.io apiGroup: rbac.authorization.k8s.io
{{- if and .Values.nodeAttestor.k8sPsat.enabled }}
--- ---
# ClusterRole to allow spire-server node attestor to query Token Review API # ClusterRole to allow spire-server node attestor to query Token Review API
# and to be able to push certificate bundles to a configmap # and to be able to push certificate bundles to a configmap
@@ -72,7 +74,6 @@ kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
metadata: metadata:
name: {{ include "spire-server.fullname" . }} name: {{ include "spire-server.fullname" . }}
namespace: {{ .Release.Namespace }}
subjects: subjects:
- kind: ServiceAccount - kind: ServiceAccount
name: {{ include "spire-server.serviceAccountName" . }} name: {{ include "spire-server.serviceAccountName" . }}
@@ -81,3 +82,4 @@ roleRef:
kind: ClusterRole kind: ClusterRole
name: {{ include "spire-server.fullname" . }} name: {{ include "spire-server.fullname" . }}
apiGroup: rbac.authorization.k8s.io apiGroup: rbac.authorization.k8s.io
{{- end }}
@@ -180,4 +180,5 @@ initContainers: []
nodeAttestor: nodeAttestor:
k8sPsat: k8sPsat:
enabled: true
serviceAccountAllowList: [] serviceAccountAllowList: []