Skip to content

Commit

Permalink
Merge pull request #1306 from flanksource/chart-update
Browse files Browse the repository at this point in the history
fix: chart fixes for upstream
  • Loading branch information
moshloop authored Oct 11, 2023
2 parents 619dd61 + 3a88324 commit 5d9711a
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 24 deletions.
6 changes: 4 additions & 2 deletions chart/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ spec:
labels:
{{- include "canary-checker.labels" . | nindent 10 }}
spec:
{{- if not (eq .Values.db.embedded.storageClass "") }}
storageClassName: {{ .Values.db.embedded.storageClass }}
{{- end }}
accessModes: ["ReadWriteOnce"]
resources:
requests:
Expand Down Expand Up @@ -96,7 +98,7 @@ spec:
{{- if .Values.upstream.enabled }}
envFrom:
- secretRef:
name: {{ include "canary-checker.name" . }}
name: {{ .Values.upstream.secretKeyRef.name }}
{{- end }}
volumeMounts:
{{- if eq .Values.dockerSocket true }}
Expand Down Expand Up @@ -140,7 +142,7 @@ spec:
{{- end }}
{{- if .Values.upstream.enabled }}
- --agent-name={{ .Values.upstream.agentName }}
- --upstream-host={{ .Values.upstream.host }}
- --upstream-host=$UPSTREAM_HOST
- --upstream-user=$UPSTREAM_USER
- --upstream-password=$UPSTREAM_PASSWORD
{{- end }}
Expand Down
2 changes: 2 additions & 0 deletions chart/templates/postgres-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ spec:
name: postgresql
spec:
accessModes: ["ReadWriteOnce"]
{{- if not (eq .Values.db.external.storageClass "") }}
storageClassName: {{ .Values.db.external.storageClass }}
{{- end }}
resources:
requests:
storage: {{ .Values.db.external.storage }}
Expand Down
9 changes: 0 additions & 9 deletions chart/templates/secret.yaml

This file was deleted.

12 changes: 6 additions & 6 deletions chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ db:
# If the database is embedded, setting this to true will persist the contents of the database
# through a persistent volume
persist: false
storageClass:
storageClass: ""
storage: 20Gi
external:
# Setting enabled to true will use a external postgres DB, disabling the embedded DB
Expand All @@ -54,7 +54,7 @@ db:
# this is the key it will look for in the secret(if secretRefKey is
# mentioned). The name of the key is mandatory to set.
key: DB_URL
storageClass:
storageClass: ""
storage: 20Gi

nameOverride: ""
Expand All @@ -72,10 +72,10 @@ data:

upstream:
enabled: false
host: ""
agentName: ""
username: ""
password: ""
agentName: default-agent
# Must contain: UPSTREAM_USER, UPSTREAM_PASS & UPSTREAM_HOST
secretKeyRef:
name: canary-checker-upstream

ingress:
enabled: false
Expand Down
9 changes: 2 additions & 7 deletions pkg/db/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,7 @@ func IsConnected() bool {

func embeddedDB() error {
embeddedPath := strings.TrimSuffix(strings.TrimPrefix(ConnectionString, "embedded://"), "/")
err := os.Chmod(embeddedPath, 0750)
if err != nil {
logger.Errorf("Error changing permission of dataPath: %v, Error: %v", embeddedPath, err)
return err
}
_ = os.Chmod(embeddedPath, 0750)

logger.Infof("Starting embedded postgres server at %s", embeddedPath)

Expand All @@ -73,8 +69,7 @@ func embeddedDB() error {
Username("postgres").Password("postgres").
Database("canary"))
ConnectionString = "postgres://postgres:postgres@localhost:6432/canary?sslmode=disable"
err = PostgresServer.Start()
if err != nil {
if err := PostgresServer.Start(); err != nil {
return fmt.Errorf("error starting embedded postgres: %v", err)
}
return nil
Expand Down

0 comments on commit 5d9711a

Please sign in to comment.