Skip to content

Commit e467670

Browse files
committed
Use different helmValues if an existing installation is detected
Signed-off-by: Alvaro Saurin <[email protected]>
1 parent fc4bf54 commit e467670

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

pkg/controller/ambassadorinstallation/reconcile.go

+21-3
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,18 @@ const (
4444
)
4545

4646
var (
47-
// some default Helm values
48-
defaultChartValues = HelmValues{
47+
// some default Helm values for new installations
48+
defaultChartValuesNewInstallations = HelmValues{
4949
"deploymentTool": "amb-oper",
50+
"licenseKey": map[string]interface{}{
51+
"createSecret": true,
52+
},
53+
}
5054

55+
// default Helm values when doing upgrades or re-installations
56+
// TODO: remove the duplication with `defaultChartValuesNewInstallations`
57+
defaultChartValuesUpgrades = HelmValues{
58+
"deploymentTool": "amb-oper",
5159
"licenseKey": map[string]interface{}{
5260
"createSecret": false,
5361
},
@@ -224,6 +232,10 @@ func (r *ReconcileAmbassadorInstallation) Reconcile(request reconcile.Request) (
224232
return reconcile.Result{}, nil
225233
}
226234

235+
lastCondition := status.LastCondition(ambassador.AmbInsCondition{})
236+
log.V(2).Info("Last condition",
237+
"type", lastCondition.Type, "reason", lastCondition.Reason, "status", lastCondition.Status)
238+
227239
// check if this is the first and only AmbassadorInstallation in this namespace
228240
// if it is not, mark the status as Duplicate
229241
isFirstAmbIns, err := r.isFirstAmbInst(ambIns)
@@ -265,7 +277,13 @@ func (r *ReconcileAmbassadorInstallation) Reconcile(request reconcile.Request) (
265277

266278
// process all static Helm values: the default ones, the ones coming from files, etc...
267279
helmValues := HelmValues{}
268-
helmValues.AppendFrom(defaultChartValues, true) // copy the default values
280+
281+
// copy the default Helm values
282+
if lastCondition.Type == ambassador.ConditionDeployed {
283+
helmValues.AppendFrom(defaultChartValuesUpgrades, true)
284+
} else {
285+
helmValues.AppendFrom(defaultChartValuesNewInstallations, true)
286+
}
269287

270288
for _, f := range defExtraValuesFiles {
271289
log.Info("Looking for helm values in file", "filename", f)

0 commit comments

Comments
 (0)