mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-21 12:13:55 +09:00
The image option source lists every vm-default-images-* PVC in cozy-public. CDI creates that PVC as soon as an import starts, so a golden whose DataVolume ended in phase Failed is still offered, and a disk cloned from it never populates: the user picks an image the platform just suggested and ends up with a disk that never becomes usable. Read the DataVolumes next to the PVCs and drop the names whose import Failed. Filtering beats marking: the option can never be used, and OptionItem has no disabled state to show it in. A golden still importing stays, since CDI holds a clone until the source is populated, and so does a PVC with no DataVolume. When the DataVolumes cannot be read, without CDI or without the grant, the PVCs go out unfiltered: the Option list drops a source whose provider errors, and an empty picker would be a regression rather than a safeguard. Assisted-by: LLM Signed-off-by: Aleksei Sviridkin <f@lex.la>
88 lines
3.6 KiB
YAML
88 lines
3.6 KiB
YAML
kind: ClusterRole
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
metadata:
|
|
name: cozystack-api
|
|
rules:
|
|
- apiGroups: [""]
|
|
resources: ["namespaces", "secrets", "services"]
|
|
verbs: ["get", "watch", "list"]
|
|
# Hierarchical tenant quota admission reads the rendered ResourceQuota usage of
|
|
# a parent tenant's pool to carve a child's allocation out of what is actually
|
|
# left (see pkg/registry/apps/application/quota.go).
|
|
- apiGroups: [""]
|
|
resources: ["resourcequotas"]
|
|
verbs: ["get", "watch", "list"]
|
|
- apiGroups: ["rbac.authorization.k8s.io"]
|
|
resources: ["rolebindings"]
|
|
verbs: ["get", "watch", "list"]
|
|
- apiGroups: [""]
|
|
resources: ["secrets"]
|
|
verbs: ["create", "update", "patch", "delete"]
|
|
- apiGroups: ["admissionregistration.k8s.io"]
|
|
resources: ["mutatingwebhookconfigurations", "validatingwebhookconfigurations", "validatingadmissionpolicies", "validatingadmissionpolicybindings"]
|
|
verbs: ["get", "watch", "list"]
|
|
- apiGroups: ["flowcontrol.apiserver.k8s.io"]
|
|
resources: ["prioritylevelconfigurations", "flowschemas"]
|
|
verbs: ["list", "watch"]
|
|
- apiGroups: ["cozystack.io"]
|
|
resources: ["*"]
|
|
verbs: ["get", "watch", "list"]
|
|
# Marketplace Tap resource: disconnecting a tap deletes its (cluster-scoped)
|
|
# PackageSource and the tap-managed registration Package that de-registers its
|
|
# apps. The tap's Flux OCIRepository is read here for List/Get/Watch; its write
|
|
# verbs are scoped to a namespaced Role in cozy-system (see tap-source-role.yaml),
|
|
# since the API only ever manages tap sources there.
|
|
- apiGroups: ["cozystack.io"]
|
|
resources: ["packagesources", "packages"]
|
|
verbs: ["delete"]
|
|
- apiGroups: ["source.toolkit.fluxcd.io"]
|
|
resources: ["ocirepositories"]
|
|
verbs: ["get", "list", "watch"]
|
|
- apiGroups: ["helm.toolkit.fluxcd.io"]
|
|
resources: ["*"]
|
|
verbs: ["*"]
|
|
# Read-only sources for the Option (dropdown) resource providers.
|
|
- apiGroups: [""]
|
|
resources: ["nodes", "persistentvolumeclaims"]
|
|
verbs: ["get", "watch", "list"]
|
|
- apiGroups: ["kubevirt.io"]
|
|
resources: ["kubevirts"]
|
|
verbs: ["get", "watch", "list"]
|
|
# The image picker drops golden images whose import Failed.
|
|
- apiGroups: ["cdi.kubevirt.io"]
|
|
resources: ["datavolumes"]
|
|
verbs: ["get", "watch", "list"]
|
|
- apiGroups: ["instancetype.kubevirt.io"]
|
|
resources: ["virtualmachineclusterinstancetypes", "virtualmachineclusterpreferences"]
|
|
verbs: ["get", "watch", "list"]
|
|
- apiGroups: ["k8s.cni.cncf.io"]
|
|
resources: ["network-attachment-definitions"]
|
|
verbs: ["get", "watch", "list"]
|
|
- apiGroups: ["storage.k8s.io"]
|
|
resources: ["storageclasses"]
|
|
verbs: ["get", "watch", "list"]
|
|
- apiGroups: ["backups.cozystack.io"]
|
|
resources: ["backupclasses", "plans", "backups"]
|
|
verbs: ["get", "watch", "list"]
|
|
- apiGroups: ["apps.cozystack.io"]
|
|
resources: ["vmdisks"]
|
|
verbs: ["get", "watch", "list"]
|
|
# The sourceRef picker on a VMImportTask is an Option provider, which lists
|
|
# the sources through the dynamic client under this ServiceAccount. Without
|
|
# the group here the provider registers and then answers with an empty list,
|
|
# so the form offers no connection to import from.
|
|
- apiGroups: ["forklift.cozystack.io"]
|
|
resources: ["vmimportsources"]
|
|
verbs: ["get", "watch", "list"]
|
|
# The VM picker reads the machine list the migration controller publishes for
|
|
# each source. Read-only, and only ever fetched by a name derived from the
|
|
# source the tenant already chose.
|
|
- apiGroups: [""]
|
|
resources: ["configmaps"]
|
|
verbs: ["get", "watch", "list"]
|
|
# The SecurityGroup resource is a projection over CiliumNetworkPolicy: the
|
|
# storage CRUDs these objects with the cozystack-api ServiceAccount.
|
|
- apiGroups: ["cilium.io"]
|
|
resources: ["ciliumnetworkpolicies"]
|
|
verbs: ["get", "watch", "list", "create", "update", "patch", "delete"]
|