Add AWS DB types (#464)
* Add remaining data store options Signed-off-by: Kevin Fox <[email protected]> * Fix env var Signed-off-by: Kevin Fox <[email protected]> * Add aws db types 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]> * Fix mysql vars Signed-off-by: Kevin Fox <[email protected]> * Incorperate feedback Signed-off-by: Kevin Fox <[email protected]> * Incorperate feedback Signed-off-by: Kevin Fox <[email protected]> * Fix missing ) Signed-off-by: Kevin Fox <[email protected]> * Incorperate feedback Signed-off-by: Kevin Fox <[email protected]> * Update charts/spire/charts/spire-server/values.yaml Co-authored-by: Marco Franssen <[email protected]> Signed-off-by: kfox1111 <[email protected]> * Fix readme 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]> Co-authored-by: Marco Franssen <[email protected]>
This commit is contained in:
co-authored by
Faisal Memon
Marco Franssen
parent
898a349297
commit
c29f45fc30
@@ -190,28 +190,42 @@ Create the name of the service account to use
|
||||
|
||||
{{- define "spire-server.datastore-config" }}
|
||||
{{- $config := dict }}
|
||||
{{- $pw := "" }}
|
||||
{{- $ropw := "" }}
|
||||
{{- if eq .Values.dataStore.sql.databaseType "sqlite3" }}
|
||||
{{- $_ := set $config "database_type" "sqlite3" }}
|
||||
{{- $_ := set $config "connection_string" "/run/spire/data/datastore.sqlite3" }}
|
||||
{{- else if eq .Values.dataStore.sql.databaseType "mysql" }}
|
||||
{{- $_ := set $config "database_type" "mysql" }}
|
||||
{{- else if or (eq .Values.dataStore.sql.databaseType "mysql") (eq .Values.dataStore.sql.databaseType "aws_mysql") }}
|
||||
{{- if eq .Values.dataStore.sql.databaseType "mysql" }}
|
||||
{{- $_ := set $config "database_type" "mysql" }}
|
||||
{{- $pw = "${DBPW}" }}
|
||||
{{- $ropw = "${RODBPW}" }}
|
||||
{{- else }}
|
||||
{{- $_ := set $config "database_type" (list (dict "aws_mysql" (dict "region" .Values.dataStore.sql.region))) }}
|
||||
{{- end }}
|
||||
{{- $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) }}
|
||||
{{- $_ := set $config "connection_string" (printf "%s:%s@tcp(%s:%d)/%s%s" .Values.dataStore.sql.username $pw .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) }}
|
||||
{{- $_ := set $config "ro_connection_string" (printf "%s:%s@tcp(%s:%d)/%s%s" .Values.dataStore.sql.readOnly.username $ropw .Values.dataStore.sql.readOnly.host $roPort .Values.dataStore.sql.readOnly.databaseName $roQuery) }}
|
||||
{{- end }}
|
||||
{{- else if or (eq .Values.dataStore.sql.databaseType "postgres") (eq .Values.dataStore.sql.databaseType "aws_postgres") }}
|
||||
{{- if eq .Values.dataStore.sql.databaseType "postgres" }}
|
||||
{{- $_ := set $config "database_type" "postgres" }}
|
||||
{{- $pw = " password=${DBPW}" }}
|
||||
{{- $ropw = " password=${RODBPW}" }}
|
||||
{{- else }}
|
||||
{{- $_ := set $config "database_type" (list (dict "aws_postgres" (dict "region" .Values.dataStore.sql.region))) }}
|
||||
{{- 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) }}
|
||||
{{- $_ := set $config "connection_string" (printf "dbname=%s user=%s%s host=%s port=%d%s" .Values.dataStore.sql.databaseName .Values.dataStore.sql.username $pw .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) }}
|
||||
{{- $_ := set $config "ro_connection_string" (printf "dbname=%s user=%s%s host=%s port=%d%s" .Values.dataStore.sql.readOnly.databaseName $ropw .Values.dataStore.sql.readOnly.username .Values.dataStore.sql.readOnly.host $roPort $roOptions) }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
{{- fail "Unsupported database type" }}
|
||||
|
||||
@@ -53,15 +53,15 @@
|
||||
{{- 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 and (ne .Values.dataStore.sql.databaseType "mysql") (ne .Values.dataStore.sql.databaseType "aws_mysql") }}
|
||||
{{- if ne .Values.dataStore.sql.rootCAPath "" }}
|
||||
{{- fail "rootCAPath can only be set with database type mysql." }}
|
||||
{{- fail "rootCAPath can only be set with database type mysql or aws_mysql." }}
|
||||
{{- end }}
|
||||
{{- if ne .Values.dataStore.sql.clientCertPath "" }}
|
||||
{{- fail "clientCertPath can only be set with database type mysql." }}
|
||||
{{- fail "clientCertPath can only be set with database type mysql or aws_mysql." }}
|
||||
{{- end }}
|
||||
{{- if ne .Values.dataStore.sql.clientKeyPath "" }}
|
||||
{{- fail "clientKeyPath can only be set with database type mysql." }}
|
||||
{{- fail "clientKeyPath can only be set with database type mysql or aws_mysql." }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if not .Values.externalServer }}
|
||||
|
||||
Reference in New Issue
Block a user