Skip to content

Commit 3d915df

Browse files
authored
Merge pull request #2282 from vincepri/in-namespace-as-selector
🌱 Add client.InNamespace("xyz").AsSelector()
2 parents f831695 + 58640d1 commit 3d915df

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pkg/client/options.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,11 @@ func (n InNamespace) ApplyToDeleteAllOf(opts *DeleteAllOfOptions) {
606606
n.ApplyToList(&opts.ListOptions)
607607
}
608608

609+
// AsSelector returns a selector that matches objects in the given namespace.
610+
func (n InNamespace) AsSelector() fields.Selector {
611+
return fields.SelectorFromSet(fields.Set{"metadata.namespace": string(n)})
612+
}
613+
609614
// Limit specifies the maximum number of results to return from the server.
610615
// Limit does not implement DeleteAllOfOption interface because the server
611616
// does not support setting it for deletecollection operations.

0 commit comments

Comments
 (0)