in pkg/config/configmap_manager.go [64:87]
func (m *defaultConfigmapManager) MonitorConfigMap(ctx context.Context) error {
fieldSelector := fields.Set{"metadata.name": m.resourceRef.Name}.AsSelector().String()
listFunc := func(options metav1.ListOptions) (runtime.Object, error) {
options.FieldSelector = fieldSelector
return m.clientSet.CoreV1().ConfigMaps(m.resourceRef.Namespace).List(ctx, options)
}
watchFunc := func(options metav1.ListOptions) (watch.Interface, error) {
options.FieldSelector = fieldSelector
return m.clientSet.CoreV1().ConfigMaps(m.resourceRef.Namespace).Watch(ctx, options)
}
m.rt = cache.NewReflector(&cache.ListWatch{ListFunc: listFunc, WatchFunc: watchFunc},
&corev1.ConfigMap{},
m.store,
0,
)
go m.rt.Run(m.monitorStopChan)
go m.listenForConfigMapUpdates()
if _, err := m.setInitialControllerState(); err != nil {
m.logger.Info("Failed to set initial state", "err", err)
return err
}
return nil
}