Files
cozystack/packages
Aleksei Sviridkin 2b7e0db40f 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 <f@lex.la>
2026-09-29 12:28:31 +03:00
..