Skip to content
This repository has been archived by the owner on Mar 16, 2024. It is now read-only.

Commit

Permalink
Merge client side and server side configs when installing (#790)
Browse files Browse the repository at this point in the history
Signed-off-by: tylerslaton <mtslaton1@gmail.com>
  • Loading branch information
tylerslaton committed Nov 2, 2022
1 parent e6d97a9 commit 8ae67af
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
4 changes: 2 additions & 2 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func IsDockerDesktop(ctx context.Context, getter kclient.Reader) (bool, error) {
return false, nil
}

func merge(oldConfig, newConfig *apiv1.Config) *apiv1.Config {
func Merge(oldConfig, newConfig *apiv1.Config) *apiv1.Config {
var (
mergedConfig apiv1.Config
)
Expand Down Expand Up @@ -235,7 +235,7 @@ func AsConfigMap(cfg *apiv1.Config) (*corev1.ConfigMap, error) {
}

func asConfigMap(existing, cfg *apiv1.Config) (*corev1.ConfigMap, error) {
newConfig := merge(existing, cfg)
newConfig := Merge(existing, cfg)

configBytes, err := json.Marshal(newConfig)
if err != nil {
Expand Down
17 changes: 12 additions & 5 deletions pkg/install/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,18 @@ func Install(ctx context.Context, image string, opts *Options) error {
klogv2.SetOutput(io.Discard)
utilruntime.ErrorHandlers = nil

kclient, err := k8sclient.Default()
if err != nil {
return err
}

serverConf, err := config.Get(ctx, kclient)
if err != nil {
return err
}

opts.Config = *config.Merge(serverConf, &opts.Config)

// Require E-Mail address when using Let's Encrypt production
if opts.Config.LetsEncrypt != nil && *opts.Config.LetsEncrypt == "enabled" {
if opts.Config.LetsEncryptTOSAgree == nil || !*opts.Config.LetsEncryptTOSAgree {
Expand Down Expand Up @@ -163,11 +175,6 @@ func Install(ctx context.Context, image string, opts *Options) error {
}
}

kclient, err := k8sclient.Default()
if err != nil {
return err
}

var installIngressController bool
if ok, err := config.IsDockerDesktop(ctx, kclient); err != nil {
return err
Expand Down

0 comments on commit 8ae67af

Please sign in to comment.