Skip to content

Report context consumers and prevent unsafe deletion #2

Description

@moonlight16

Problem

Context resources can be attached to StatefulSet or Sandbox agents, but the
current API does not report consumers. DELETE accepts a context deletion while
an agent still mounts its PVC.

Kubernetes PVC protection prevents the underlying volume from being physically
removed while a running Pod mounts it, but this can leave the PVC in
Terminating after the API and CLI report that deletion was accepted. It also
does not explain which agent is blocking removal.

This gap was identified while reviewing rossoctl/rossoctl-cli#73.

Desired behavior

  • Context get and list responses expose whether the resource is in use and,
    where practical, identify its consumers.
  • Deleting an in-use context returns 409 Conflict by default with an actionable
    explanation.
  • Any force-delete behavior is explicit and is not the default.
  • The contract distinguishes currently mounted Pods from desired references held
    by Rosso agent resources, including scaled-down or temporarily stopped agents.
  • rossoctl can display the usage information and require explicit intent before a
    forced deletion.

Design question

Context Service can discover Pods that currently mount its PVC, while Rosso knows
which agent specifications reference a named context. Decide whether Context
Service owns the full dependency check or whether Rosso enriches and enforces the
user-facing lifecycle using both sources.

Acceptance criteria

  • Active use is visible through the API.
  • A normal delete cannot silently strand an in-use PVC in Terminating.
  • Tests cover mounted, unmounted, and already-absent resources.
  • The Rosso and CLI documentation describes the implemented behavior.

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