yonahd / kor

A Golang Tool to discover unused Kubernetes Resources
MIT License
1.04k stars 96 forks source link

BUG(delete): Unexpected newline error on deletion confirmation #321

Closed doronkg closed 4 months ago

doronkg commented 4 months ago

Describe the bug Sometimes when using the --delete flag to remove unused resources from the cluster, the following occures: When user is asked for confirmation, the following error raises when submitted:

$ kor sa --delete
Do you want to delete ServiceAccount test in namespace test? (Y/N): Failed to read input: unexpected newline

As the input was invalid, the resource is not deleted.

To Reproduce Steps to reproduce the behavior: Use --delete flag to remove resources and submit confirmation input.

Expected behavior The input is accepted and kor proceeds to resource deletion.

Screenshots

$ .\main.exe sa --delete
Do you want to delete ServiceAccount zzz in namespace kube-public? (Y/N): Y
Deleting ServiceAccount zzz in namespace kube-public
Do you want to delete ServiceAccount zzz2 in namespace kube-public? (Y/N): Failed to read input: unexpected newline
Do you want to delete ServiceAccount abc in namespace kube-system? (Y/N): Y
Deleting ServiceAccount abc in namespace kube-system
Do you want to delete ServiceAccount abc in namespace default? (Y/N): Failed to read input: unexpected newline

OS version, architecture and kor version e.g. Windows 10 Kor version: 0.5.1

Additional context Add any other context about the problem here.

doronkg commented 4 months ago

/assign WIP in #323