Files
cozystack/packages
Aleksei Sviridkin e5ab1d6a7e fix(kubernetes): detach volumes when the infra PVC is missing (#5249)
## What this PR does

routes an infra PVC `NotFound` in `ControllerUnpublishVolume` through
the existing upstream hotplug detach path. a quota-rejected PVC can
still have a persistent entry in the VM spec, so returning success
before detach leaves a stale volume after the DataVolume is deleted.

adds regression coverage for a pending hotplug volume, an already
detached volume, and a VMI that outlives its VM. existing NFS unpublish
tests still pass. no dependency update is needed.

Fixes https://github.com/cozystack/cozystack/issues/5248

validation in the kubevirt-csi-driver module: `go test -count=1 ./...`
and `go vet ./...`. the new regression fails without the production
change. root `make generate` and `make manifests` also pass without
generated-file changes.

### Screenshots

no UI changes.

### Downstream repositories

- [x] No downstream repository is affected by this change
- [ ] [cozystack/website](https://github.com/cozystack/website) -
follow-up:
- [ ]
[cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack)
- follow-up:
- [ ]
[cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack)
- follow-up:
- [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up:
- [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up:
- [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) -
follow-up:
- [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) -
follow-up:
- [ ]
[cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server)
- follow-up:
- [ ]
[cozystack/external-apps-example](https://github.com/cozystack/external-apps-example)
- follow-up:
- [ ] [cozystack/examples](https://github.com/cozystack/examples) -
follow-up:
- [ ] [cozystack/community](https://github.com/cozystack/community) -
follow-up:

### Release note

```release-note
fix(kubernetes): remove stale hotplug volumes when the infra PVC is missing, preventing deleted volumes from blocking subsequent attachments
```


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Bug Fixes**
* Volume unpublish requests now proceed through standard cleanup when
the associated PVC is missing, rather than returning success
immediately. This allows remaining teardown steps to run for detached
volumes and VM-level resources. Other PVC lookup errors continue to be
returned directly, without entering the missing-PVC cleanup path.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-11-13 15:41:42 +03:00
..