fix: use resource definition's default namespace in omnictl get

The namespace flag default ("default") prevented fallback to the resource definition's own DefaultNamespace, causing resources in other namespaces (e.g., ResourceDefinitions in "meta") to return empty results.

Signed-off-by: Oguz Kilcan <oguz.kilcan@siderolabs.com>
This commit is contained in:
Oguz Kilcan 2026-04-10 11:45:04 +02:00
parent 131bd3a6bc
commit ba80cf6ec2
No known key found for this signature in database
GPG Key ID: 372F271E3AD80BFC

View File

@ -16,7 +16,6 @@ import (
"github.com/siderolabs/omni/client/pkg/client"
"github.com/siderolabs/omni/client/pkg/cosi/labels"
omniresources "github.com/siderolabs/omni/client/pkg/omni/resources"
"github.com/siderolabs/omni/client/pkg/omnictl/internal/access"
"github.com/siderolabs/omni/client/pkg/omnictl/output"
"github.com/siderolabs/omni/client/pkg/omnictl/resources"
@ -267,7 +266,7 @@ func createResourceRequest(
}
func init() {
getCmd.PersistentFlags().StringVarP(&getCmdFlags.namespace, "namespace", "n", omniresources.DefaultNamespace, "The resource namespace.")
getCmd.PersistentFlags().StringVarP(&getCmdFlags.namespace, "namespace", "n", "", "The resource namespace.")
getCmd.PersistentFlags().BoolVarP(&getCmdFlags.watch, "watch", "w", false, "Watch the resource state.")
getCmd.PersistentFlags().StringVarP(&getCmdFlags.output, "output", "o", "table", "Output format (json, table, yaml, jsonpath).")
getCmd.PersistentFlags().StringVarP(&getCmdFlags.selector, "selector", "l", "", "Selector (label query) to filter on, supports '=' and '==' (e.g. -l key1=value1,key2=value2)")