fix(events): respect --all-namespaces flag
The `flux events` command always applied a namespace filter, even when `--all-namespaces` was set. This produced incomplete results and confused users expecting cluster-wide events. Changes made: * Build `clientListOpts` dynamically. * Omit `client.InNamespace(...)` when `eventArgs.allNamespaces` is true, ensuring no namespace constraint. Impact: `flux events --all-namespaces` now returns events from every namespace, restoring expected functionality without affecting other options. Signed-off-by: S. M. Mohiuddin Khan Shiam <147746955+mohiuddin-khan-shiam@users.noreply.github.com>
This commit is contained in:
committed by
Matheus Pimenta
parent
24ae50cfd5
commit
c2a883e25a
@@ -112,7 +112,12 @@ func eventsCmdRun(cmd *cobra.Command, args []string) error {
|
||||
}
|
||||
|
||||
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
|
||||
if eventArgs.forSelector != "" {
|
||||
kind, name := getKindNameFromSelector(eventArgs.forSelector)
|
||||
|
||||
Reference in New Issue
Block a user