grants

package
v1.77.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 17, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package grants resolves per-project cluster resource grants (multitenancy-manager AvailableClusterResource) so that Application package settings fields tagged with x-deckhouse-grantable-resource can be defaulted and validated against what a project may use.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Catalog

type Catalog struct {
	// Default is the per-project default granted name. May be empty.
	Default string
	// Available is the set of granted names available to the project.
	Available []string
	// Found reports whether an AvailableClusterResource was actually located.
	// When false, the feature is treated as inactive (no defaulting, no
	// validation) for this resource.
	Found bool
}

Catalog is the resolved per-project catalog for one grantable resource.

func (Catalog) IsAvailable

func (c Catalog) IsAvailable(name string) bool

IsAvailable reports whether name is in the available set.

type NoopResolver

type NoopResolver struct{}

NoopResolver is a Resolver that always reports the feature as inactive. Useful for tests and contexts where grant resolution is not wired.

func (NoopResolver) Resolve

func (NoopResolver) Resolve(_ context.Context, _, _ string) (Catalog, error)

Resolve always returns an inactive catalog.

type Resolver

type Resolver interface {
	// Resolve returns the per-project catalog for the AvailableClusterResource
	// named resource in namespace. A missing CRD (multitenancy disabled) or a
	// missing object yields Catalog{Found: false} with a nil error; only
	// unexpected API errors are returned.
	Resolve(ctx context.Context, namespace, resource string) (Catalog, error)
}

Resolver resolves a grantable resource catalog for a namespace.

func NewResolver

func NewResolver(client kclient.Client) Resolver

NewResolver returns a Resolver backed by the given client.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL