Repository navigation
Commit 2b7e0db
committed
fix(kubernetes): let kubevirt-csi hot-unplug from an orphaned VMI
The driver falls back to the VMI-level removevolume subresource when
a volume is still attached to the VMI but no longer in the VM spec.
The -kcsi Role grants only the VM-level subresources, and nothing
else bound to the service account covers the VMI one: kubevirt.io:
default grants no subresource of it, and the kubevirt.io:edit and
admin roles that do are aggregated only into the built-in edit and
admin roles, which the tenant namespace never binds to this account.
Every such call ends in 403, the unpublish retries until it fails,
and the hot-plug pod keeps the infra volume attached.
The call stays needed once the driver stops falling back for a
VM-owned VMI (kubevirt/csi-driver#382), because it still makes it
for a VMI no VM owns. Deleting a VM with orphan propagation leaves
its VMI running, since the KubeVirt VM controller then drops its
finalizer without stopping the VMI, so the tenant node stays up and
its volumes stay attached until the driver detaches them.
The grant adds no reach the account lacks: it can already remove a
volume from any VM in the namespace, and virt-api refuses the VMI
call on a VM-owned VMI once the HotplugVolumes gate is off.
virtualmachineinstances/addvolume stays ungranted, as the driver
only attaches through the VM.
Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <[email protected]>1 parent b314514 commit 2b7e0db
2 files changed
Lines changed: 28 additions & 1 deletion
File tree
- packages/apps/kubernetes
- templates/csi
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
25 | 28 | | |
26 | | - | |
| 29 | + | |
27 | 30 | | |
28 | 31 | | |
29 | 32 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
0 commit comments