I Learned Go in 3 Weeks. Yesterday, My Code Merged into k9s
Описание и применение
k9s исправил проверку прав на порт‑форвард, добавив поддержку как create, так и get для SPDY и WebSocket, что восстановило работу для пользователей с ограниченными RBAC.
Задача
k9s incorrectly checked only the create verb for pod port‑forwarding, blocking users with get‑only RBAC on Kubernetes 1.31+ WebSocket path.
Результат
k9s now correctly authorizes port‑forwarding for both SPDY and WebSocket paths, restoring functionality for users with get‑only RBAC and maintaining backward compatibility.
Рабочий процесс
- Read issue #4144 and reproduction steps
- Read k9s source and tests to understand current logic
- Learned HTTP/1.1 upgrade vs WebSocket protocol differences
- Implemented dual verb check in
port_forwarder.go - Added comprehensive test suite covering all permission combinations
- Ran
go test -raceto catch data races - Submitted PR and iterated through review rounds
- Merged PR within 48 hours
Доказательства
I changed one word and called it a day… I replaced one hardcoded verb with another…
The error was a data race in the mock client…
I didn’t know what an HTTP/1.1 Upgrade was…
- Дата записи: 2026-09-06T09:22:22.530Z