Skip to content

Add request timeout to shell completion function to prevent indefinite waiting #7793

Description

@karthik120710

Problem

The shell completion function compGetResourceList in completion.go currently has no request timeout when fetching API resources. This can cause the shell to hang indefinitely if the Karmada API server is slow or unresponsive, providing a poor user experience during command completion.

Current Behavior

Line 259 in completion.go has a TODO comment: // TODO: Should set --request-timeout=5s
The function uses kubectl's APIResourceOptions to fetch API resources for shell completion
No timeout protection exists, so slow/unresponsive API servers can cause indefinite hangs
Expected Behavior
The completion function should have a reasonable timeout (e.g., 5 seconds) to prevent indefinite waiting
On timeout, the completion should fail gracefully (return empty completion list rather than hanging)
Normal completion operations should continue to work as expected

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions