func()

in pkg/config/configmap_manager.go [90:114]


func (m *defaultConfigmapManager) listenForConfigMapUpdates() {
	defer func() {
		m.logger.Info("Controller detected changes to the configmap, cancelling manager context")
		close(m.monitorStopChan)
		m.cancelFn()
	}()

	for {
		select {
		case <-m.storeNotifyChan:
			enabled, err := m.getCurrentEnabledConfig()
			if err != nil {
				m.logger.Error(err, "Failed to get controller state from configmap")
				return
			}
			m.logger.V(1).Info("Received configmap notification", "initial", m.initialState,
				"new", enabled)
			if m.initialState != enabled {
				m.logger.Info("Controller state changed", "initial", m.initialState,
					"new", enabled)
				return
			}
		}
	}
}