Skip to content

Commit 6e32e3a

Browse files
committed
Remove namespace flag from nonadmin backup delete
1 parent 641d080 commit 6e32e3a

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

cmd/non-admin/backup/delete.go

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func NewDeleteCommand(f client.Factory, use string) *cobra.Command {
5757
// DeleteOptions holds the options for the delete command
5858
type DeleteOptions struct {
5959
Name string
60-
Namespace string
60+
Namespace string // Internal field - automatically determined from kubectl context
6161
client kbclient.Client
6262
}
6363

@@ -68,7 +68,7 @@ func NewDeleteOptions() *DeleteOptions {
6868

6969
// BindFlags binds the command line flags to the options
7070
func (o *DeleteOptions) BindFlags(flags *pflag.FlagSet) {
71-
flags.StringVar(&o.Namespace, "namespace", "", "Namespace of the non-admin backup (default: current namespace)")
71+
// No user-facing flags - namespace is determined automatically from kubectl context
7272
}
7373

7474
// Complete completes the options by setting up the client and determining the namespace
@@ -89,14 +89,12 @@ func (o *DeleteOptions) Complete(args []string, f client.Factory) error {
8989

9090
o.client = kbClient
9191

92-
// Determine the namespace
93-
if o.Namespace == "" {
94-
currentNS, err := getCurrentNamespace()
95-
if err != nil {
96-
return fmt.Errorf("failed to determine current namespace: %w", err)
97-
}
98-
o.Namespace = currentNS
92+
// Always use the current namespace from kubectl context
93+
currentNS, err := getCurrentNamespace()
94+
if err != nil {
95+
return fmt.Errorf("failed to determine current namespace: %w", err)
9996
}
97+
o.Namespace = currentNS
10098

10199
return nil
102100
}

0 commit comments

Comments
 (0)