Skip to content

Commit

Permalink
Liqoctl: install flags priority over provider
Browse files Browse the repository at this point in the history
  • Loading branch information
cheina97 authored and adamjensenbot committed May 30, 2023
1 parent 7cbcc4f commit 47459d4
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions pkg/liqoctl/install/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func (o *Options) Run(ctx context.Context, provider Provider) error {

s = o.Printer.StartSpinner("Generating installation parameters")

values, err := util.MergeMaps(o.chartValues, o.values())
values, err := util.MergeMaps(o.chartValues, o.preProviderValues())
if err != nil {
s.Fail("Error generating installation parameters: ", output.PrettyErr(err))
return err
Expand All @@ -156,6 +156,12 @@ func (o *Options) Run(ctx context.Context, provider Provider) error {
return err
}

values, err = util.MergeMaps(values, o.postProviderValues())
if err != nil {
s.Fail("Error generating installation parameters: ", output.PrettyErr(err))
return err
}

for _, value := range o.OverrideValues {
if err := strvals.ParseInto(value, values); err != nil {
err := fmt.Errorf("failed parsing --set data: %w", err)
Expand Down Expand Up @@ -305,13 +311,13 @@ func (o *Options) isRelease() bool {
return o.Version == "" || semver.IsValid(o.Version)
}

func (o *Options) values() map[string]interface{} {
func (o *Options) preProviderValues() map[string]interface{} {
replicas := 1
if o.EnableHA {
replicas = 2
}

values := map[string]interface{}{
return map[string]interface{}{
"tag": o.Version,

"apiServer": map[string]interface{}{
Expand Down Expand Up @@ -364,22 +370,21 @@ func (o *Options) values() map[string]interface{} {
"enable": !o.DisableTelemetry,
},
}
}

if o.ExtServiceType.Value != "" {
values["gateway"] = map[string]interface{}{
func (o *Options) postProviderValues() map[string]interface{} {
return map[string]interface{}{
"gateway": map[string]interface{}{
"service": map[string]interface{}{
"type": o.ExtServiceType.Value,
},
}

values["auth"] = map[string]interface{}{
},
"auth": map[string]interface{}{
"service": map[string]interface{}{
"type": o.ExtServiceType.Value,
},
}
},
}

return values
}

func (o *Options) cleanup() error {
Expand Down

0 comments on commit 47459d4

Please sign in to comment.