Skip to content

Flavor: manage the access list of a private flavor #999

Open

Description

@berendt

What would you like to see implemented?

Flavor should manage the access list of a private flavor: the projects that may use a flavor created with isPublic: false. This is Nova's flavor access API behind openstack flavor set --project <project> <flavor>: POST /flavors/{flavor_id}/action with addTenantAccess or removeTenantAccess, and GET /flavors/{flavor_id}/os-flavor-access to list the grants.

Today ORC can create a private flavor, but it cannot grant any project access to it, so only an admin can boot it.

A possible API, in the shape of securityGroupRefs on Port and userRefs on Group (#985):

apiVersion: openstack.k-orc.cloud/v1alpha1
kind: Flavor
metadata:
  name: gpu-large
spec:
  cloudCredentialsRef:
    cloudName: openstack
    secretName: openstack-clouds
  managementPolicy: managed
  resource:
    ram: 65536
    vcpus: 16
    disk: 100
    isPublic: false
    projectRefs:
    - tenant-a
    - tenant-b
  • spec.resource.projectRefs: optional, a set of Project references, mutable. A CEL rule allows it only when isPublic is false. isPublic is already immutable, so the rule holds for the life of the object.
  • status.resource.projectIDs: the projects Nova reports in the flavor's access list.

The access list would be one more resource reconciler beside reconcileExtraSpecs in internal/controllers/flavor. It waits until every referenced Project is available, then adds the missing grants and removes the grants that are not in the list, the same way the extra specs are reconciled. The compute client in internal/osclients/compute.go gains three methods.

gophercloud v2.15.0, which ORC already uses, supports all of this: flavors.ListAccesses, flavors.AddAccess and flavors.RemoveAccess, with the project in AddAccessOpts.Tenant and RemoveAccessOpts.Tenant.

Nova's default policy allows os_compute_api:os-flavor-access:add_tenant_access, remove_tenant_access and the access list for an admin with a project-scoped token, the same rule as creating the flavor. The credentials that create a flavor with ORC can therefore manage its access list.

A different shape is fine with us if you prefer one.

Additional information

CobaltCore uses ORC to seed the content of a new cloud: flavors, volume types, external networks and quotas, which the platform operator declares (C5C3/cobaltcore#1439). The platform operator decides which tenant projects may use a private flavor. Today that grant is a manual CLI step after ORC created the flavor, and nothing reconciles it afterwards. This gap is tracked in C5C3/cobaltcore#1440, and we are happy to implement it.

Link to reference documentation

https://docs.openstack.org/api-ref/compute/#flavors-access-flavors-os-flavor-access

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions