Skip to content

Commit

Permalink
Revert changes to GetPods to limit scope of this PR
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasrod16 committed Mar 18, 2024
1 parent 7001ebc commit a7d0762
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/pkg/cluster/injector.go
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ func (c *Cluster) getImagesAndNodesForInjection(timeoutDuration time.Duration) (

// After delay, try running
default:
pods, err := c.GetPods(corev1.NamespaceAll, nil)
pods, err := c.GetPods(corev1.NamespaceAll)
if err != nil {
return nil, fmt.Errorf("unable to get the list of pods in the cluster")
}
Expand Down
12 changes: 5 additions & 7 deletions src/pkg/k8s/pods.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,13 @@ func (k *K8s) CreatePod(pod *corev1.Pod) (*corev1.Pod, error) {

// GetAllPods returns a list of pods from the cluster for all namespaces.
func (k *K8s) GetAllPods() (*corev1.PodList, error) {
return k.GetPods(corev1.NamespaceAll, nil)
return k.GetPods(corev1.NamespaceAll)
}

// GetPods returns a list of pods from the cluster by namespace and listOpts.
func (k *K8s) GetPods(namespace string, listOpts *metav1.ListOptions) (*corev1.PodList, error) {
if listOpts == nil {
listOpts = &metav1.ListOptions{}
}
return k.Clientset.CoreV1().Pods(namespace).List(context.TODO(), *listOpts)
// GetPods returns a list of pods from the cluster by namespace.
func (k *K8s) GetPods(namespace string) (*corev1.PodList, error) {
metaOptions := metav1.ListOptions{}
return k.Clientset.CoreV1().Pods(namespace).List(context.TODO(), metaOptions)
}

// WaitForPodsAndContainers attempts to find pods matching the given selector and optional inclusion filter
Expand Down

0 comments on commit a7d0762

Please sign in to comment.