From a6bb9619c947a9c79ad420660e05cb10b02bf515 Mon Sep 17 00:00:00 2001 From: Tom Lebreux Date: Tue, 19 Mar 2024 13:26:47 -0400 Subject: [PATCH] Remove webhook capi Helm values (#44710) --- .../dashboard/systemcharts/controller.go | 7 ++++--- .../dashboard/systemcharts/controller_test.go | 16 ++++------------ 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/pkg/controllers/dashboard/systemcharts/controller.go b/pkg/controllers/dashboard/systemcharts/controller.go index 1e1e8e539cd..dbe0a41047d 100644 --- a/pkg/controllers/dashboard/systemcharts/controller.go +++ b/pkg/controllers/dashboard/systemcharts/controller.go @@ -138,9 +138,10 @@ func (h *handler) getChartsToInstall() []*chart.Definition { ExactVersionSetting: settings.RancherWebhookVersion, Values: func() map[string]interface{} { values := map[string]interface{}{ - "capi": map[string]interface{}{ - "enabled": false, - }, + // This is no longer used in the webhook chart but previous values can still be found + // with `helm get values -n cattle-system rancher-webhook` which can be confusing. We + // completely remove the previous capi values by setting it to nil here. + "capi": nil, "mcm": map[string]interface{}{ "enabled": features.MCM.Enabled(), }, diff --git a/pkg/controllers/dashboard/systemcharts/controller_test.go b/pkg/controllers/dashboard/systemcharts/controller_test.go index 94ededbd8c1..e15edc085d9 100644 --- a/pkg/controllers/dashboard/systemcharts/controller_test.go +++ b/pkg/controllers/dashboard/systemcharts/controller_test.go @@ -83,9 +83,7 @@ func Test_ChartInstallation(t *testing.T) { settings.RancherWebhookVersion.Set("2.0.0") expectedValues := map[string]interface{}{ "priorityClassName": priorityClassName, - "capi": map[string]interface{}{ - "enabled": false, - }, + "capi": nil, "mcm": map[string]interface{}{ "enabled": features.MCM.Enabled(), }, @@ -134,9 +132,7 @@ func Test_ChartInstallation(t *testing.T) { mocks.configCache.EXPECT().Get(gomock.Any(), chart.CustomValueMapName).Return(nil, errTest).Times(4) settings.RancherWebhookVersion.Set("2.0.0") expectedValues := map[string]interface{}{ - "capi": map[string]interface{}{ - "enabled": false, - }, + "capi": nil, "mcm": map[string]interface{}{ "enabled": features.MCM.Enabled(), }, @@ -183,9 +179,7 @@ func Test_ChartInstallation(t *testing.T) { mocks.configCache.EXPECT().Get(gomock.Any(), chart.CustomValueMapName).Return(emptyConfig, nil).Times(4) settings.RancherWebhookVersion.Set("2.0.1") expectedValues := map[string]interface{}{ - "capi": map[string]interface{}{ - "enabled": false, - }, + "capi": nil, "mcm": map[string]interface{}{ "enabled": features.MCM.Enabled(), }, @@ -242,9 +236,7 @@ func Test_ChartInstallation(t *testing.T) { features.MCM.Set(true) expectedValues := map[string]interface{}{ "priorityClassName": "newClass", - "capi": map[string]interface{}{ - "enabled": false, - }, + "capi": nil, "mcm": map[string]interface{}{ "enabled": false, },