diff --git a/controller/engine_image_controller.go b/controller/engine_image_controller.go index e6d9335ac3..b1d8d880f9 100644 --- a/controller/engine_image_controller.go +++ b/controller/engine_image_controller.go @@ -386,7 +386,7 @@ func (ic *EngineImageController) syncNodeDeploymentMap(engineImage *longhorn.Eng return err } - eiDaemonSetPods, err := ic.ds.ListEngineImageDaemonSetPodsFromEngineImageName(engineImage.Name) + eiDaemonSetPods, err := ic.ds.ListEngineImageDaemonSetPodsFromEngineImageNameRO(engineImage.Name) if err != nil { return err } @@ -565,7 +565,7 @@ func updateEngineImageVersion(ei *longhorn.EngineImage) error { } func (ic *EngineImageController) countVolumesUsingEngineImage(image string) (int, error) { - volumes, err := ic.ds.ListVolumes() + volumes, err := ic.ds.ListVolumesRO() if err != nil { return 0, err } @@ -580,7 +580,7 @@ func (ic *EngineImageController) countVolumesUsingEngineImage(image string) (int } func (ic *EngineImageController) countEnginesUsingEngineImage(image string) (int, error) { - engines, err := ic.ds.ListEngines() + engines, err := ic.ds.ListEnginesRO() if err != nil { return 0, err } @@ -595,7 +595,7 @@ func (ic *EngineImageController) countEnginesUsingEngineImage(image string) (int } func (ic *EngineImageController) countReplicasUsingEngineImage(image string) (int, error) { - replicas, err := ic.ds.ListReplicas() + replicas, err := ic.ds.ListReplicasRO() if err != nil { return 0, err } diff --git a/datastore/kubernetes.go b/datastore/kubernetes.go index 681c2474f8..12f66acc4f 100644 --- a/datastore/kubernetes.go +++ b/datastore/kubernetes.go @@ -185,14 +185,14 @@ func (s *DataStore) GetEngineImageDaemonSet(name string) (*appsv1.DaemonSet, err return resultRO.DeepCopy(), nil } -func (s *DataStore) ListEngineImageDaemonSetPodsFromEngineImageName(EIName string) ([]*corev1.Pod, error) { +func (s *DataStore) ListEngineImageDaemonSetPodsFromEngineImageNameRO(EIName string) ([]*corev1.Pod, error) { selector, err := metav1.LabelSelectorAsSelector(&metav1.LabelSelector{ MatchLabels: types.GetEIDaemonSetLabelSelector(EIName), }) if err != nil { return nil, err } - return s.ListPodsBySelector(selector) + return s.ListPodsBySelectorRO(selector) } // CreatePDB creates a PodDisruptionBudget resource for the given PDB object and namespace