Skip to content

Child tenants see no default VM images — picker reads cozy-public PVCs directly instead of via an Option source #3110

Closed

Description

Summary

Default VM images are visible only to the root tenant. Child tenants see an empty image list in the VM create form, so they cannot pick a default golden image.

Mechanism

The image picker reads PersistentVolumeClaims directly from the cozy-public namespace:

  • apps/console/src/components/SourceField.tsx — useImageOptions() calls useK8sList with a hardcoded namespace: "cozy-public" and filters PVCs by the vm-default-images- prefix.

The console talks to the Kubernetes API as the logged-in user, so this list is subject to that user's RBAC. The default golden images are provisioned as PVCs/DataVolumes in cozy-public (platform vm-default-images package), but the shared tenant role bound in that namespace (cozy:tenant:dashboard) grants read only on Flux helmrepositories/helmcharts — not on persistentvolumeclaims. So a child-tenant identity gets an empty/forbidden list and sees no images, while the root-tenant identity (broader access) sees them. Hence the asymmetry.

Suggested fix

Serve the image list the same way storage classes, VM disks and instance types are now served — through the privileged, server-side Option resource (core.cozystack.io) introduced in #2778 — instead of a direct PVC read from cozy-public:

  • Add an Option source (e.g. vmImage) computed server-side with privileged access, listing the vm-default-images-* entries from cozy-public.
  • Annotate the image field in the VM schema with x-cozystack-options so it renders via DynamicOptionsWidget.
  • Drop the bespoke useImageOptions PVC read in SourceField.tsx.

This routes around the tenant RBAC entirely (tenants need no read on cozy-public PVCs) and matches the pattern the rest of the form already uses. This depends on a backend Option source, mirroring how the dropdown migration in cozystack/cozystack-ui#30 depended on #2778.

Source

A user reported that the images of the default image package are only visible to the root tenant, not to child tenants.

Activity

  1. added
    kind/bugCategorizes issue or PR as related to a bug
    priority/important-soonMust be staffed and worked on either currently, or very soon, ideally in time for the next release
    on Jun 3, 2026
  2. myasnikovdaniil commented on Aug 15, 2026

    @myasnikovdaniil
    Contributor

    Closing, fixed by bb32213 on 2026-06-08. It adds a Role granting tenants read on persistentvolumeclaims in cozy-public, with a helm-unittest pinning it. The commit message describes this exact symptom: a 403 and an empty dropdown.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/dashboardIssues or PRs related to the dashboard / UIkind/bugCategorizes issue or PR as related to a bugpriority/important-soonMust be staffed and worked on either currently, or very soon, ideally in time for the next releasetriage/acceptedIndicates an issue is ready to be actively worked on

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions