Skip to content

Commit 47459d4

Browse files
cheina97adamjensenbot
authored andcommitted
Liqoctl: install flags priority over provider
1 parent 7cbcc4f commit 47459d4

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

pkg/liqoctl/install/handler.go

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ func (o *Options) Run(ctx context.Context, provider Provider) error {
144144

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

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

159+
values, err = util.MergeMaps(values, o.postProviderValues())
160+
if err != nil {
161+
s.Fail("Error generating installation parameters: ", output.PrettyErr(err))
162+
return err
163+
}
164+
159165
for _, value := range o.OverrideValues {
160166
if err := strvals.ParseInto(value, values); err != nil {
161167
err := fmt.Errorf("failed parsing --set data: %w", err)
@@ -305,13 +311,13 @@ func (o *Options) isRelease() bool {
305311
return o.Version == "" || semver.IsValid(o.Version)
306312
}
307313

308-
func (o *Options) values() map[string]interface{} {
314+
func (o *Options) preProviderValues() map[string]interface{} {
309315
replicas := 1
310316
if o.EnableHA {
311317
replicas = 2
312318
}
313319

314-
values := map[string]interface{}{
320+
return map[string]interface{}{
315321
"tag": o.Version,
316322

317323
"apiServer": map[string]interface{}{
@@ -364,22 +370,21 @@ func (o *Options) values() map[string]interface{} {
364370
"enable": !o.DisableTelemetry,
365371
},
366372
}
373+
}
367374

368-
if o.ExtServiceType.Value != "" {
369-
values["gateway"] = map[string]interface{}{
375+
func (o *Options) postProviderValues() map[string]interface{} {
376+
return map[string]interface{}{
377+
"gateway": map[string]interface{}{
370378
"service": map[string]interface{}{
371379
"type": o.ExtServiceType.Value,
372380
},
373-
}
374-
375-
values["auth"] = map[string]interface{}{
381+
},
382+
"auth": map[string]interface{}{
376383
"service": map[string]interface{}{
377384
"type": o.ExtServiceType.Value,
378385
},
379-
}
386+
},
380387
}
381-
382-
return values
383388
}
384389

385390
func (o *Options) cleanup() error {

0 commit comments

Comments
 (0)