Skip to content

Feature request: Authorize cross-namespace volume sharing using namespace labels #1196

Open

Description

@kmizumar

Describe the solution you'd like

Currently, a source PVC authorizes cross-namespace volume sharing through
trident.netapp.io/shareToNamespace, which accepts namespace names or *.

We would like to allow source PVC owners to authorize sharing based on
destination namespace labels. This would simplify managing access when
namespaces are created and removed dynamically, while avoiding permission
to share with every namespace.

For example, a source PVC could use:

metadata:
  annotations:
    trident.netapp.io/shareToNamespaceSelector: "storage.example.com/share-group=ml"

A new shared PVC would be permitted only when its destination namespace
matches this Kubernetes label selector and has the required
TridentVolumeReference.

Proposed behavior:

  • A selector alone can authorize sharing.
  • When both a selector and a nonempty shareToNamespace value are configured,
    both conditions must match. * does not bypass the selector.
  • When the selector annotation is absent, existing behavior is preserved.
  • Empty or invalid selectors and namespace lookup failures reject provisioning.
  • Destination namespace labels are retrieved when validating a new
    shared-volume configuration.

The initial scope is authorization of new shared-volume provisioning.
Removing a label required by a positive selector would deny subsequent
provisioning attempts. Existing shared volumes and mounted workloads would
continue to work. Previously admitted operations and idempotent requests
for already-created volumes would retain their existing behavior.

Continuous revocation of existing access and changes to cross-namespace
cloning are outside this initial scope.

Describe alternatives you've considered

  • Maintaining explicit namespace lists on each source PVC requires updates
    whenever eligible namespaces change.
  • Using shareToNamespace: "*" permits sharing more broadly than intended.
  • An external controller could synchronize namespace labels into explicit
    namespace lists, but would require an additional component to operate.

Additional context

We searched existing issues and PRs and found related requests:

This proposal addresses namespace eligibility for new shared-volume
provisioning.

I intend to contribute a PR. A local prototype and unit tests have been
prepared, and I would like feedback from the Trident development team before
submitting it.

Would this annotation and authorization model be appropriate for Trident?
In particular, is requiring both conditions when the selector and namespace
list are configured the preferred behavior?

Activity

  1. torirevilla commented on Oct 14, 2026

    @torirevilla
    Contributor

    Hi @kmizumar If you wish to contribute to Trident please complete the necessary steps outlined in the CONTRIBUTING.md file, including the signed CCLA.

    Sign and submit NetApp's Contributor License Agreement. You must sign and submit the Corporate Contributor License Agreement (CCLA) in order to contribute.

    To answer your questions, we use annotations so that would not be out of place, we would likely not want to use both the selector you are proposing exists and shareToNamespace annotations, it would be better to use one in place of the other. In addition, since the cross namespace volume sharing feature allows access to a volume we'd want to still require the shareFromPVC annotation on the subordinate volume. Please reach out if you have further questions. Once the CCLA is signed we can take a look at your PR.

  2. kmizumar commented on Oct 15, 2026

    @kmizumar
    Author

    Thank you so much for your advice, @torirevilla

    To obtain internal approval to sign the CCLA, could you please provide the following information?

    • The name of the person responsible for receiving emails sent to legalip@netapp.com
    • The department to which that person belongs

    In addition, we are required to complete an internal counterparty due diligence process before entering into an agreement. To complete that process, could you also provide the following information?

    • Head office location: Is the contracting entity the North America entity or the International entity listed on your website?
    • Name of the appropriate contact person
    • Email address of the contact person

    Thank you for your assistance.

  3. kmizumar commented on Nov 10, 2026

    @kmizumar
    Author

    Thank you for the feedback, @torirevilla. Our Corporate CLA has now been signed and submitted.

    I have opened #1202. Following your suggestion, the new trident.netapp.io/shareToNamespaceSelector annotation is an alternative to trident.netapp.io/shareToNamespace. A source PVC with both annotations is rejected with an error that asks the user to set only one of them. The subordinate PVC still requires shareFromPVC and a TridentVolumeReference.

    Please let me know if a different behavior would be preferred when both annotations are set.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions