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