Skip to content

Commit

Permalink
fix(context): ListOption() use namespace in returned ListOption
Browse files Browse the repository at this point in the history
  • Loading branch information
rkojedzinszky committed Dec 15, 2023
1 parent f78aee9 commit e7d1690
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion private/context/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
gocontext "context"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/kubernetes"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
Expand Down Expand Up @@ -92,7 +93,10 @@ func (c *context) CommonLabels() (ret map[string]string) {

// ListOption returns filter matching owned objects
func (c *context) ListOption() (lo client.ListOption, err error) {
return client.MatchingLabels(c.CommonLabels()), nil
return &client.ListOptions{
Namespace: c.pp.Namespace,
LabelSelector: labels.SelectorFromSet(c.CommonLabels()),
}, nil
}

func (c *context) SetMeta(m metav1.Object) error {
Expand Down

0 comments on commit e7d1690

Please sign in to comment.