From 5e8806586fddb0583e9e74adadfcf11b0d2e3ead Mon Sep 17 00:00:00 2001 From: Stefan Sundin Date: Thu, 4 Oct 2018 18:58:24 -0700 Subject: [PATCH] Initialize cm.Data if it is nil. This happens if the configMap exists but does not have any data in it, and in this case it was not possible to update the dashboard settings. Signed-off-by: Stefan Sundin --- src/app/backend/settings/manager.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/app/backend/settings/manager.go b/src/app/backend/settings/manager.go index 620b3b901235..839f2f48033c 100644 --- a/src/app/backend/settings/manager.go +++ b/src/app/backend/settings/manager.go @@ -105,6 +105,11 @@ func (sm *SettingsManager) SaveGlobalSettings(client kubernetes.Interface, s *ap return errors.New(api.ConcurrentSettingsChangeError) } + // Data can be nil if the configMap exists but does not have any data + if cm.Data == nil { + cm.Data = make(map[string]string) + } + cm.Data[api.GlobalSettingsKey] = s.Marshal() _, err := client.CoreV1().ConfigMaps(api.SettingsConfigMapNamespace).Update(cm) return err