Skip to content

Commit

Permalink
feat: Add support for mariadb-galera, mysql, and mongodb-sharded charts
Browse files Browse the repository at this point in the history
  • Loading branch information
gabe565 committed Oct 7, 2023
1 parent 0bc5e90 commit 874e3e3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
15 changes: 11 additions & 4 deletions internal/database/dialect/mariadb.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func (MariaDB) DefaultPort() uint16 {
}

func (MariaDB) DatabaseEnvNames() []string {
return []string{"MARIADB_DATABASE"}
return []string{"MARIADB_DATABASE", "MYSQL_DATABASE"}
}

func (MariaDB) ListDatabasesQuery() string {
Expand All @@ -34,7 +34,7 @@ func (MariaDB) ListTablesQuery() string {
}

func (MariaDB) UserEnvNames() []string {
return []string{"MARIADB_USER"}
return []string{"MARIADB_USER", "MYSQL_USER"}
}

func (MariaDB) DefaultUser() string {
Expand All @@ -55,6 +55,13 @@ func (MariaDB) PodLabels() []kubernetes.LabelQueryable {
{Name: "app.kubernetes.io/name", Value: "mariadb"},
{Name: "app.kubernetes.io/component", Value: "primary"},
},
kubernetes.LabelQueryAnd{
{Name: "app.kubernetes.io/name", Value: "mariadb-galera"},
},
kubernetes.LabelQueryAnd{
{Name: "app.kubernetes.io/name", Value: "mysql"},
{Name: "app.kubernetes.io/component", Value: "primary"},
},
kubernetes.LabelQuery{Name: "app", Value: "mariadb"},
}
}
Expand All @@ -65,9 +72,9 @@ func (MariaDB) FilterPods(ctx context.Context, client kubernetes.KubeClient, pod

func (db MariaDB) PasswordEnvNames(c config.Global) []string {
if c.Username == db.DefaultUser() {
return []string{"MARIADB_ROOT_PASSWORD"}
return []string{"MARIADB_ROOT_PASSWORD", "MYSQL_ROOT_PASSWORD"}
}
return []string{"MARIADB_PASSWORD"}
return []string{"MARIADB_PASSWORD", "MYSQL_PASSWORD"}
}

func (MariaDB) ExecCommand(conf config.Exec) *command.Builder {
Expand Down
4 changes: 4 additions & 0 deletions internal/database/dialect/mongodb.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ func (MongoDB) PodLabels() []kubernetes.LabelQueryable {
{Name: "app.kubernetes.io/name", Value: "mongodb"},
{Name: "app.kubernetes.io/component", Value: "mongodb"},
},
kubernetes.LabelQueryAnd{
{Name: "app.kubernetes.io/name", Value: "mongodb-sharded"},
{Name: "app.kubernetes.io/component", Value: "mongos"},
},
kubernetes.LabelQuery{Name: "app", Value: "mongodb"},
}
}
Expand Down

0 comments on commit 874e3e3

Please sign in to comment.