{{ message }}
Repository navigation
Commit 69dab5d
fix(plugin): handle a missing exec permission in status (#11687)
`kubectl cnpg status` runs commands in the primary Pod through exec:
`du` for the cluster size and, with `-v -v`, `cat` to read `custom.conf`
and `pg_hba.conf`. Without the `pods/exec` permission, it printed raw
exec errors, and the configuration sections made the command fail.
Check permissions first with a `SelfSubjectAccessReview` on the primary
Pod, and show `not permitted: requires the pods/exec permission` in
place of the size and configuration sections. If the review itself
fails, run the command anyway and report the actual error. When no Pod
holds the primary role, as during bootstrap or a failover, skip the
check, because the review would have no namespace and be evaluated at
cluster scope.
Mark `pods/exec` as optional for `status` in the kubectl plugin
documentation.
Assisted-by: Claude
References #11519
Signed-off-by: Gabriele Bartolini <gabriele.bartolini@enterprisedb.com>
Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
Co-authored-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Co-authored-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>1 parent 3503f78 commit 69dab5d
3 files changed
Lines changed: 125 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| 39 | + | |
38 | 40 | | |
39 | 41 | | |
40 | 42 | | |
| |||
218 | 220 | | |
219 | 221 | | |
220 | 222 | | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
221 | 260 | | |
222 | 261 | | |
223 | 262 | | |
224 | 263 | | |
225 | 264 | | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
226 | 269 | | |
227 | 270 | | |
228 | 271 | | |
| |||
322 | 365 | | |
323 | 366 | | |
324 | 367 | | |
| 368 | + | |
| 369 | + | |
325 | 370 | | |
326 | 371 | | |
327 | 372 | | |
| |||
491 | 536 | | |
492 | 537 | | |
493 | 538 | | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
494 | 550 | | |
495 | 551 | | |
496 | 552 | | |
| |||

0 commit comments