From f0da42d38790cc08b4b70ac065a7cee44b8cf659 Mon Sep 17 00:00:00 2001 From: Francesco Guardiani Date: Thu, 7 Nov 2019 15:31:56 +0100 Subject: [PATCH] Made ReadProfilingKey method public and more generic (#852) * Made ReadProfilingKey method public and more generic * Removed old readProfilingFlag --- profiling/server.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/profiling/server.go b/profiling/server.go index 22089ed5e..fb27a5180 100644 --- a/profiling/server.go +++ b/profiling/server.go @@ -76,8 +76,8 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { } } -func readProfilingFlag(configMap *corev1.ConfigMap) (bool, error) { - profiling, ok := configMap.Data[profilingKey] +func ReadProfilingFlag(config map[string]string) (bool, error) { + profiling, ok := config[profilingKey] if !ok { return false, nil } @@ -91,7 +91,7 @@ func readProfilingFlag(configMap *corev1.ConfigMap) (bool, error) { // UpdateFromConfigMap modifies the Enabled flag in the Handler // according to the value in the given ConfigMap func (h *Handler) UpdateFromConfigMap(configMap *corev1.ConfigMap) { - enabled, err := readProfilingFlag(configMap) + enabled, err := ReadProfilingFlag(configMap.Data) if err != nil { h.log.Errorw("Failed to update the profiling flag", zap.Error(err)) return