Merge pull request #5414 from mohiuddin-khan-shiam/main
fix(events): respect `--all-namespaces` flag
This commit is contained in:
@@ -112,7 +112,12 @@ func eventsCmdRun(cmd *cobra.Command, args []string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var diffRefNs bool
|
var diffRefNs bool
|
||||||
clientListOpts := []client.ListOption{client.InNamespace(*kubeconfigArgs.Namespace)}
|
// Build the base list options. When --all-namespaces is set we must NOT constrain the
|
||||||
|
// query to a single namespace, otherwise we silently return a partial result set.
|
||||||
|
clientListOpts := []client.ListOption{}
|
||||||
|
if !eventArgs.allNamespaces {
|
||||||
|
clientListOpts = append(clientListOpts, client.InNamespace(*kubeconfigArgs.Namespace))
|
||||||
|
}
|
||||||
var refListOpts [][]client.ListOption
|
var refListOpts [][]client.ListOption
|
||||||
if eventArgs.forSelector != "" {
|
if eventArgs.forSelector != "" {
|
||||||
kind, name := getKindNameFromSelector(eventArgs.forSelector)
|
kind, name := getKindNameFromSelector(eventArgs.forSelector)
|
||||||
|
|||||||
Reference in New Issue
Block a user