Add remaining data store options (#463)
* Add remaining data store options Signed-off-by: Kevin Fox <[email protected]> * Fix env var Signed-off-by: Kevin Fox <[email protected]> * Update charts/spire/README.md Co-authored-by: Faisal Memon <[email protected]> Signed-off-by: kfox1111 <[email protected]> * Update charts/spire/README.md Co-authored-by: Faisal Memon <[email protected]> Signed-off-by: kfox1111 <[email protected]> * Incorperate feedback Signed-off-by: Kevin Fox <[email protected]> --------- Signed-off-by: Kevin Fox <[email protected]> Signed-off-by: kfox1111 <[email protected]> Co-authored-by: Faisal Memon <[email protected]>
This commit is contained in:
@@ -189,7 +189,7 @@ Create the name of the service account to use
|
||||
{{- end }}
|
||||
|
||||
{{- define "spire-server.datastore-config" }}
|
||||
{{- $config := deepCopy .Values.dataStore.sql.plugin_data }}
|
||||
{{- $config := dict }}
|
||||
{{- if eq .Values.dataStore.sql.databaseType "sqlite3" }}
|
||||
{{- $_ := set $config "database_type" "sqlite3" }}
|
||||
{{- $_ := set $config "connection_string" "/run/spire/data/datastore.sqlite3" }}
|
||||
@@ -198,11 +198,21 @@ Create the name of the service account to use
|
||||
{{- $port := int .Values.dataStore.sql.port | default 3306 }}
|
||||
{{- $query := include "spire-server.config-mysql-query" .Values.dataStore.sql.options }}
|
||||
{{- $_ := set $config "connection_string" (printf "%s:${DBPW}@tcp(%s:%d)/%s%s" .Values.dataStore.sql.username .Values.dataStore.sql.host $port .Values.dataStore.sql.databaseName $query) }}
|
||||
{{- if .Values.dataStore.sql.readOnly.enabled }}
|
||||
{{- $roPort := int .Values.dataStore.sql.readOnly.port | default 3306 }}
|
||||
{{- $roQuery := include "spire-server.config-mysql-query" .Values.dataStore.sql.readOnly.options }}
|
||||
{{- $_ := set $config "ro_connection_string" (printf "%s:${RODBPW}@tcp(%s:%d)/%s%s" .Values.dataStore.sql.readOnly.username .Values.dataStore.sql.readOnly.host $roPort .Values.dataStore.sql.readOnly.databaseName $roQuery) }}
|
||||
{{- end }}
|
||||
{{- else if eq .Values.dataStore.sql.databaseType "postgres" }}
|
||||
{{- $_ := set $config "database_type" "postgres" }}
|
||||
{{- $port := int .Values.dataStore.sql.port | default 5432 }}
|
||||
{{- $options:= include "spire-server.config-postgresql-options" .Values.dataStore.sql.options }}
|
||||
{{- $_ := set $config "connection_string" (printf "dbname=%s user=%s password=${DBPW} host=%s port=%d%s" .Values.dataStore.sql.databaseName .Values.dataStore.sql.username .Values.dataStore.sql.host $port $options) }}
|
||||
{{- if .Values.dataStore.sql.readOnly.enabled }}
|
||||
{{- $roPort := int .Values.dataStore.sql.readOnly.port | default 5432 }}
|
||||
{{- $roOptions:= include "spire-server.config-postgresql-options" .Values.dataStore.sql.readOnly.options }}
|
||||
{{- $_ := set $config "ro_connection_string" (printf "dbname=%s user=%s password=${RODBPW} host=%s port=%d%s" .Values.dataStore.sql.readOnly.databaseName .Values.dataStore.sql.readOnly.username .Values.dataStore.sql.readOnly.host $roPort $roOptions) }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
{{- fail "Unsupported database type" }}
|
||||
{{- end }}
|
||||
|
||||
@@ -101,7 +101,22 @@ plugins:
|
||||
DataStore:
|
||||
sql:
|
||||
plugin_data:
|
||||
{{ include "spire-server.datastore-config" . | nindent 10 }}
|
||||
{{ include "spire-server.datastore-config" . | nindent 8 }}
|
||||
{{- if ne .Values.dataStore.sql.rootCAPath "" }}
|
||||
root_ca_path: {{ .Values.dataStore.sql.rootCAPath }}
|
||||
{{- end }}
|
||||
{{- if ne .Values.dataStore.sql.clientCertPath "" }}
|
||||
client_cert_path: {{ .Values.dataStore.sql.clientCertPath }}
|
||||
{{- end }}
|
||||
{{- if ne .Values.dataStore.sql.clientKeyPath "" }}
|
||||
client_key_path : {{ .Values.dataStore.sql.clientKeyPath }}
|
||||
{{- end }}
|
||||
max_open_conns: {{ .Values.dataStore.sql.maxOpenConns }}
|
||||
max_idle_conns: {{ .Values.dataStore.sql.maxIdleConns }}
|
||||
{{- if ne (int .Values.dataStore.sql.connMaxLifetime) 0 }}
|
||||
conn_max_lifetime: {{ .Values.dataStore.sql.connMaxLifetime }}
|
||||
{{- end }}
|
||||
disable_migration: {{ .Values.dataStore.sql.disableMigration }}
|
||||
|
||||
{{- if or .Values.nodeAttestor.k8sPSAT.enabled .Values.nodeAttestor.externalK8sPSAT.enabled .Values.nodeAttestor.joinToken.enabled .Values.nodeAttestor.httpChallenge.enabled .Values.nodeAttestor.tpmDirect.enabled }}
|
||||
NodeAttestor:
|
||||
|
||||
@@ -16,5 +16,8 @@ metadata:
|
||||
namespace: {{ include "spire-server.namespace" . }}
|
||||
data:
|
||||
DBPW: {{ .Values.dataStore.sql.password | b64enc }}
|
||||
{{- if .Values.dataStore.sql.readOnly.enabled }}
|
||||
RODBPW: {{ .Values.dataStore.sql.readOnly.password | b64enc }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
@@ -50,6 +50,20 @@
|
||||
{{- else }}
|
||||
{{- fail "Unsupported kind." }}
|
||||
{{- end }}
|
||||
{{- if hasKey .Values.dataStore.sql "plugin_data" }}
|
||||
{{- fail "The plugin_data setting to the sql data store is no longer supported." }}
|
||||
{{- end }}
|
||||
{{- if ne .Values.dataStore.sql.databaseType "mysql" }}
|
||||
{{- if ne .Values.dataStore.sql.rootCAPath "" }}
|
||||
{{- fail "rootCAPath can only be set with database type mysql." }}
|
||||
{{- end }}
|
||||
{{- if ne .Values.dataStore.sql.clientCertPath "" }}
|
||||
{{- fail "clientCertPath can only be set with database type mysql." }}
|
||||
{{- end }}
|
||||
{{- if ne .Values.dataStore.sql.clientKeyPath "" }}
|
||||
{{- fail "clientKeyPath can only be set with database type mysql." }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if not .Values.externalServer }}
|
||||
apiVersion: apps/v1
|
||||
{{- if eq .Values.kind "statefulset" }}
|
||||
@@ -195,6 +209,19 @@ spec:
|
||||
name: {{ $fullname }}-dbpw
|
||||
key: DBPW
|
||||
{{- end }}
|
||||
{{- if and .Values.dataStore.sql.readOnly.enabled .Values.dataStore.sql.readOnly.externalSecret.enabled }}
|
||||
- name: RODBPW
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ .Values.dataStore.sql.readOnly.externalSecret.name }}
|
||||
key: {{ .Values.dataStore.sql.readOnly.externalSecret.key }}
|
||||
{{- else if .Values.dataStore.sql.readOnly.enabled }}
|
||||
- name: RODBPW
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ $fullname }}-dbpw
|
||||
key: RODBPW
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if ne .Values.keyManager.awsKMS.accessKeyID "" }}
|
||||
- name: AWS_KMS_ACCESS_KEY_ID
|
||||
|
||||
Reference in New Issue
Block a user