Skip to content

Commit

Permalink
Make runDbDeleter configurable
Browse files Browse the repository at this point in the history
Take the value from the experimental server config rather than
hardcoding to `true`.
  • Loading branch information
Andrew Farries committed May 4, 2022
1 parent ca76283 commit 10e5932
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
10 changes: 9 additions & 1 deletion install/installer/pkg/components/server/configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) {
return nil
})

runDbDeleter := true
_ = ctx.WithExperimental(func(cfg *experimental.Config) error {
if cfg.WebApp != nil && cfg.WebApp.Server != nil {
runDbDeleter = cfg.WebApp.Server.RunDbDeleter
}
return nil
})

defaultBaseImageRegistryWhitelist := []string{}
_ = ctx.WithExperimental(func(cfg *experimental.Config) error {
if cfg.WebApp != nil && cfg.WebApp.Server != nil {
Expand Down Expand Up @@ -147,7 +155,7 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) {
BlockNewUsers: ctx.Config.BlockNewUsers,
MakeNewUsersAdmin: false,
DefaultBaseImageRegistryWhitelist: defaultBaseImageRegistryWhitelist,
RunDbDeleter: true,
RunDbDeleter: runDbDeleter,
OAuthServer: OAuthServer{
Enabled: true,
JWTSecret: jwtSecret,
Expand Down
4 changes: 4 additions & 0 deletions install/installer/pkg/components/server/configmap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
func TestConfigMap(t *testing.T) {
type Expectation struct {
EnableLocalApp bool
RunDbDeleter bool
DisableDynamicAuthProviderLogin bool
DefaultBaseImageRegistryWhiteList []string
WorkspaceImage string
Expand All @@ -30,6 +31,7 @@ func TestConfigMap(t *testing.T) {
expectation := Expectation{
EnableLocalApp: true,
DisableDynamicAuthProviderLogin: true,
RunDbDeleter: false,
DefaultBaseImageRegistryWhiteList: []string{"some-registry"},
WorkspaceImage: "some-workspace-image",
JWTSecret: "some-jwt-secret",
Expand All @@ -53,6 +55,7 @@ func TestConfigMap(t *testing.T) {
Server: &experimental.ServerConfig{
DisableDynamicAuthProviderLogin: expectation.DisableDynamicAuthProviderLogin,
EnableLocalApp: expectation.EnableLocalApp,
RunDbDeleter: expectation.RunDbDeleter,
DefaultBaseImageRegistryWhiteList: expectation.DefaultBaseImageRegistryWhiteList,
WorkspaceDefaults: experimental.WorkspaceDefaults{
WorkspaceImage: expectation.WorkspaceImage,
Expand Down Expand Up @@ -94,6 +97,7 @@ func TestConfigMap(t *testing.T) {
actual := Expectation{
DisableDynamicAuthProviderLogin: config.DisableDynamicAuthProviderLogin,
EnableLocalApp: config.EnableLocalApp,
RunDbDeleter: config.RunDbDeleter,
DefaultBaseImageRegistryWhiteList: config.DefaultBaseImageRegistryWhitelist,
WorkspaceImage: config.WorkspaceDefaults.WorkspaceImage,
JWTSecret: config.OAuthServer.JWTSecret,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ type ServerConfig struct {
ChargebeeSecret string `json:"chargebeeSecret"`
DisableDynamicAuthProviderLogin bool `json:"disableDynamicAuthProviderLogin"`
EnableLocalApp bool `json:"enableLocalApp"`
RunDbDeleter bool `json:"runDbDeleter"`
DefaultBaseImageRegistryWhiteList []string `json:"defaultBaseImageRegistryWhitelist"`
}

Expand Down

0 comments on commit 10e5932

Please sign in to comment.