Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions charts/diode/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ helm show values diode/diode
| externalPostgresql.password | string | `""` | password |
| externalPostgresql.port | int | `5432` | port |
| externalPostgresql.username | string | `"diode"` | username |
| externalPostgresql.sslMode | string | `"disable"` | postgres ssl connection mode |
| externalRedis.hostname | string | `"localhost"` | hostname |
| externalRedis.port | int | `6379` | port |
| global.commonAnnotations | object | `{}` | common annotations for all resources |
Expand Down
13 changes: 13 additions & 0 deletions charts/diode/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,19 @@ Create the secret key for PostgreSQL password
{{- end }}
{{- end }}

{{/*
Create the SSL option for PostgreSQL
*/}}
{{- define "diode.postgresql.sslMode" -}}
{{- if .Values.postgresql.enabled -}}
{{- printf "disable" }}
{{- else if and .Values.externalPostgresql (hasKey .Values.externalPostgresql "sslMode") (not (empty .Values.externalPostgresql.sslMode)) -}}
{{- .Values.externalPostgresql.sslMode }}
{{- else -}}
{{- printf "disable" }}
{{- end }}
{{- end }}

{{/*
Create the hostname of the public Hydra service
*/}}
Expand Down
1 change: 1 addition & 0 deletions charts/diode/templates/diode-reconciler-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ data:
POSTGRES_PORT: {{ include "diode.postgresql.port" . | quote }}
POSTGRES_DB_NAME: {{ include "diode.postgresql.database" . | quote }}
POSTGRES_USER: {{ include "diode.postgresql.username" . | quote }}
POSTGRES_SSL_MODE: {{ include "diode.postgresql.sslMode" . | quote }}
NETBOX_DIODE_PLUGIN_API_BASE_URL: {{ $config.netboxDiodePluginApiBaseUrl | quote }}
NETBOX_DIODE_PLUGIN_SKIP_TLS_VERIFY: {{ $config.netboxDiodePluginSkipTlsVerify | quote }}
DIODE_AUTH_TOKEN_URL: {{ printf "%s/token" (include "diode.auth.url" .) | quote }}
Expand Down
2 changes: 2 additions & 0 deletions charts/diode/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ externalPostgresql:
username: diode
# -- password
password: ""
# -- ssl mode
sslMode: ""
# -- existing postgresql secret
existingSecretName: ""
# -- key of password in existing postgresql secret
Expand Down
2 changes: 1 addition & 1 deletion diode-server/cmd/reconciler/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func main() {

metricRecorder.SetServiceInfo(ctx, fmt.Sprintf("%s.%s", version.GetBuildVersion(), version.GetBuildCommit()))

dbURL := fmt.Sprintf("host=%s port=%d user=%s password=%s dbname=%s sslmode=disable", cfg.PostgresHost, cfg.PostgresPort, cfg.PostgresUser, cfg.PostgresPassword, cfg.PostgresDBName)
dbURL := fmt.Sprintf("host=%s port=%d user=%s password=%s dbname=%s sslmode=%s", cfg.PostgresHost, cfg.PostgresPort, cfg.PostgresUser, cfg.PostgresPassword, cfg.PostgresDBName, cfg.PostgresSSLMode)

if cfg.MigrationEnabled {
if err := runDBMigrations(ctx, s.Logger(), dbURL); err != nil {
Expand Down
1 change: 1 addition & 0 deletions diode-server/reconciler/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ type Config struct {
PostgresDBName string `envconfig:"POSTGRES_DB_NAME"`
PostgresUser string `envconfig:"POSTGRES_USER"`
PostgresPassword string `envconfig:"POSTGRES_PASSWORD"`
PostgresSSLMode string `envconfig:"POSTGRES_SSL_MODE" default:"disable"`

NetBoxDiodePluginAPIBaseURL string `envconfig:"NETBOX_DIODE_PLUGIN_API_BASE_URL" required:"true"`
NetBoxDiodePluginSkipTLSVerify bool `envconfig:"NETBOX_DIODE_PLUGIN_SKIP_TLS_VERIFY" default:"false"`
Expand Down
Loading