Commit bf69e92
fix: enable kubelet HTTP API with proper 501 responses for unsupported operations
The kubelet HTTPS listener on :10250 was never started because the VK
library's runHTTP() requires both TLSConfig and Handler to be set on
NodeConfig — neither was, so it silently exited on every startup.
This meant kubectl logs, kubectl exec, kubectl port-forward, and kubectl
attach all resulted in connection refused rather than a meaningful HTTP
error. Any metrics scraper hitting the kubelet endpoint also got nothing.
Changes:
- cmd/cisco-vk/run.go: generate a self-signed ECDSA TLS certificate at
startup and set it on NodeConfig.TLSConfig so runHTTP() starts the
listener. Build a custom PodHandlerConfig with nil for all unsupported
operations (logs, exec, attach, port-forward, stats, metrics) so the
VK library's built-in NotImplemented handler returns HTTP 501 instead
of calling through to the provider stub and returning HTTP 500. Uses a
closure pattern to wire the mux after the provider is created while
satisfying the Handler requirement before NewNode() runs.
- internal/provider/provider.go: fix AttachToContainer to return a proper
error instead of writing a hardcoded string and returning nil — the
prior implementation kept streaming connections open indefinitely.
HTTP status codes after this change:
GET /pods → 200 (was: connection refused)
GET /containerLogs/... → 501 Not Implemented (was: connection refused)
POST /exec/... → 501 Not Implemented (was: connection refused)
POST /attach/... → 501 Not Implemented (was: connection refused)
POST /portForward/... → 501 Not Implemented (was: connection refused)
GET /stats/summary → 404 route not registered (was: connection refused)
GET /metrics/resource → 404 route not registered (was: connection refused)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent dc0b0ed commit bf69e92
2 files changed
Lines changed: 119 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
19 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
20 | 30 | | |
21 | 31 | | |
22 | 32 | | |
23 | 33 | | |
24 | 34 | | |
| 35 | + | |
25 | 36 | | |
26 | 37 | | |
27 | 38 | | |
| |||
31 | 42 | | |
32 | 43 | | |
33 | 44 | | |
| 45 | + | |
34 | 46 | | |
| 47 | + | |
35 | 48 | | |
36 | 49 | | |
37 | 50 | | |
| 51 | + | |
38 | 52 | | |
39 | 53 | | |
40 | 54 | | |
| |||
192 | 206 | | |
193 | 207 | | |
194 | 208 | | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
195 | 228 | | |
196 | 229 | | |
197 | 230 | | |
198 | 231 | | |
199 | 232 | | |
200 | 233 | | |
| 234 | + | |
| 235 | + | |
201 | 236 | | |
202 | 237 | | |
203 | 238 | | |
| |||
214 | 249 | | |
215 | 250 | | |
216 | 251 | | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
217 | 275 | | |
218 | 276 | | |
219 | 277 | | |
| |||
228 | 286 | | |
229 | 287 | | |
230 | 288 | | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
| 153 | + | |
162 | 154 | | |
163 | 155 | | |
164 | 156 | | |
| |||
0 commit comments