mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-21 20:23:39 +09:00
Recovering outputs that no status recorded goes through fulfill's vm == nil branch, which settles the reclaim policy of volumes an older controller left on Retain. Nothing drove that branch, so the write path could be removed with the suite still green. A fulfill test now runs it with the handoff open and finished. The guards that stop the controller from rewriting the policy of a volume it did not produce, or before CDI controls the claim, get one case each: a claim or VMDisk marked by another import, a non-controller DataVolume owner reference, and a claimRef naming the replacement claim under a stale UID. The storageclasses RBAC comment now also names the reclaim policy read. Assisted-by: LLM Signed-off-by: Mattia Eleuteri <mattia@hidora.io>
82 lines
4.1 KiB
YAML
82 lines
4.1 KiB
YAML
kind: ClusterRole
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
metadata:
|
|
name: forklift.cozystack.io:controller
|
|
rules:
|
|
# The API this controller owns. `update` covers finalizers and nothing else:
|
|
# a task is held open while the engine's transfer volumes are removed, and
|
|
# releasing it means writing metadata.finalizers, which is a write to the object
|
|
# rather than to its status. Spec fields are never written — every one of them
|
|
# is immutable on admission anyway.
|
|
- apiGroups: ["forklift.cozystack.io"]
|
|
resources: ["vmimportsources", "vmimporttasks"]
|
|
verbs: ["get", "list", "watch", "update"]
|
|
- apiGroups: ["forklift.cozystack.io"]
|
|
resources: ["vmimportsources/status", "vmimporttasks/status"]
|
|
verbs: ["get", "update", "patch"]
|
|
# Forklift is the migration engine. The controller renders the whole object
|
|
# graph a transfer needs and reads back the verdicts Forklift publishes on it,
|
|
# which is why it needs no provider client of its own.
|
|
- apiGroups: ["forklift.konveyor.io"]
|
|
resources: ["providers", "plans", "migrations", "networkmaps", "storagemaps", "hosts"]
|
|
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
|
|
# The credentials Secret projected for Forklift to consume, plus the CA of
|
|
# Forklift's inventory service, read by name from Forklift's own namespace.
|
|
# Deliberately no list or watch: every Secret this controller touches is read by
|
|
# name, so a cluster-wide Secret informer is neither needed nor granted.
|
|
- apiGroups: [""]
|
|
resources: ["secrets"]
|
|
verbs: ["get", "create", "update", "patch", "delete"]
|
|
# The machine list a Source publishes for the console's VM picker. It is written
|
|
# to a ConfigMap owned by the Source rather than onto its status, so refreshing
|
|
# thousands of entries does not wake everything watching the Source.
|
|
- apiGroups: [""]
|
|
resources: ["configmaps"]
|
|
verbs: ["get", "list", "watch", "create", "update", "patch"]
|
|
# The copy-free handoff: a transferred volume is retained and re-bound into the
|
|
# claim a VMDisk expects. Volumes are cluster-scoped, which is why this role is
|
|
# cluster-wide rather than namespaced.
|
|
- apiGroups: [""]
|
|
resources: ["persistentvolumes"]
|
|
verbs: ["get", "list", "watch", "update", "patch"]
|
|
- apiGroups: [""]
|
|
resources: ["persistentvolumeclaims"]
|
|
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
|
|
# Storage classes are read to reject a binding mode that would deadlock an
|
|
# import before anything is created, and to give each imported volume its
|
|
# class's reclaim policy back once the handoff is over.
|
|
- apiGroups: ["storage.k8s.io"]
|
|
resources: ["storageclasses"]
|
|
verbs: ["get", "list", "watch"]
|
|
# CDI DataVolumes: created for the VMDisk release to adopt, and the
|
|
# transferring one is removed before its claim is re-pointed.
|
|
- apiGroups: ["cdi.kubevirt.io"]
|
|
resources: ["datavolumes"]
|
|
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
|
|
# The KubeVirt VirtualMachine Forklift builds is read for the source VM's shape
|
|
# and then discarded. It is never started.
|
|
#
|
|
# `create` is here even though this controller never creates a VirtualMachine
|
|
# itself. Forklift's Plan admission webhook runs a SubjectAccessReview against
|
|
# whoever creates the Plan and refuses it unless that identity could create
|
|
# VirtualMachines in the Plan's target namespace — Forklift is going to create
|
|
# one on their behalf, and it declines to act with more authority than the
|
|
# requester has. Without this verb every Plan is denied at admission with
|
|
# "Action is forbidden", and the import never starts.
|
|
- apiGroups: ["kubevirt.io"]
|
|
resources: ["virtualmachines"]
|
|
verbs: ["get", "list", "watch", "create", "delete"]
|
|
# The imported objects. Create and read only: an import produces tenant
|
|
# objects, and nothing here may edit or delete a disk or instance a tenant
|
|
# already owns.
|
|
- apiGroups: ["apps.cozystack.io"]
|
|
resources: ["vmdisks", "vminstances"]
|
|
verbs: ["get", "list", "watch", "create"]
|
|
# Leader election (--leader-elect) and events.
|
|
- apiGroups: ["coordination.k8s.io"]
|
|
resources: ["leases"]
|
|
verbs: ["get", "list", "watch", "create", "update", "patch"]
|
|
- apiGroups: [""]
|
|
resources: ["events"]
|
|
verbs: ["create", "patch"]
|