Kubernetes
One fix in kubernetes/kubernetes, maintained by CNCF.
Back to all open-source fixesAbout Kubernetes
Kubernetes is the open-source system for automating deployment, scaling, and management of containerized applications, and the flagship CNCF project. kubectl, its command-line client, is used daily by operators and developers to inspect and manage clusters.
My work on it
My Kubernetes contribution is in kubectl, owned by SIG CLI. I fixed an argument-parsing bug, present in every release since v1.34.0, where ordinary arguments such as label values could silently switch on verbose debug logging, and added the first unit tests for that function.
Preventing arguments from silently changing kubectl’s log level
The problem. kubectl reads its log verbosity from the raw command-line arguments before flags are parsed, and matched any argument that merely contained “-v=”. Running something like kubectl label pod foo tier-v=8 ran the whole command at debug verbosity, printing around ten times more output, including request URLs and headers, with nothing to reset it.
The fix. Changed the match so only real verbosity flags (-v=N or --v=N) are recognized. The function previously had no tests, so I added a table-driven test suite for it.
How I tested it. The new tests fail on the old code for arguments that contain “-v=” and pass with the fix, while every legitimate flag form behaves exactly as before.