Skip to content

Commit

Permalink
feat: add values to helm chart
Browse files Browse the repository at this point in the history
  • Loading branch information
anvari1313 committed Jan 15, 2023
1 parent 09e1fca commit af4a36e
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 17 deletions.
17 changes: 12 additions & 5 deletions .deploy/helm/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,19 @@ metadata:
data:
config.yaml: |-
database:
conn-str: {{ .Values.database.connStr | quote }}
driver: {{ .Values.database.driver | quote }}
options:
connection-lifetime: {{ .Values.database.options.connectionLifetime | quote }}
max-idle-connections: {{ .Values.database.options.maxIdleConnections }}
max-open-connections: {{ .Values.database.options.maxOpenConnections }}
host: {{ .Values.database.host | quote }}
port: {{ .Values.database.port }}
db_name: {{ .Values.database.dbName | quote }}
username: {{ .Values.database.username | quote }}
password: {{ .Values.database.password | quote }}
timeout: {{ .Values.database.timeout | quote }}
read_timeout: {{ .Values.database.readTimeout | quote }}
write_timeout: {{ .Values.database.writeTimeout | quote }}
connection_lifetime: {{ .Values.database.connectionLifetime | quote }}
max_open_connections: {{ .Values.database.maxIdleConnections }}
max_idle_connections: {{ .Values.database.maxOpenConnections }}
matrix:
display-name: {{ .Values.matrix.displayName | quote }}
token: {{ .Values.matrix.token | quote }}
Expand Down
18 changes: 13 additions & 5 deletions .deploy/helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,22 @@ tolerations: []
affinity: {}

database:
connStr: on-call:secret@tcp(localhost:3306)/on-call?readTimeout=3s&timeout=30s&parseTime=True
driver: mysql
options:
connectionLifetime: 10m
maxIdleConnections: 5
maxOpenConnections: 10
host: "localhost"
port: 3306
dbName: "on-call"
username: "on-call"
password: "secret"
timeout: "30s"
readTimeout: "3s"
writeTimeout: "1s"
connectionLifetime: 10m
maxIdleConnections: 5
maxOpenConnections: 10
matrix:
displayName: user
token: secret
url: https://example.com
userID: '@some_bot:example.com'

envs: {}
7 changes: 1 addition & 6 deletions internal/cmd/migrate/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,7 @@ const (
var ErrFlags = errors.New("error parsing flags")

func main(path string, cfg config.Database) error {
oncallDB := database.WithRetry(
database.Create,
cfg.Driver,
cfg.ConnStr,
cfg.Options,
)
oncallDB := database.WithRetry(database.Create, cfg)

sqlDB, err := oncallDB.DB()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func (c Config) Validate() error {
return errors.Wrap(validator.New().Struct(c), "config validation failed")
}

// MySQLConnectionURI returns URI for connecting to a MySQL liked database
// MySQLConnectionURI returns URI for connecting to a MySQL liked database.
func (d Database) MySQLConnectionURI() string {
return fmt.Sprintf("%s:%s@tcp(%s:%d)/%s?timeout=%s&readTimeout=%s&writeTimeout=%s&parseTime=True",
d.Username,
Expand Down

0 comments on commit af4a36e

Please sign in to comment.