Documentation
¶
Overview ¶
Package tenancy provides functionality for managing tenant information across the observability platform.
The package defines a TenantRepository interface for retrieving tenant IDs and provides a Kubernetes-based implementation that extracts tenants from GrafanaOrganization resources.
Tenants represent isolated units within the multi-tenant observability platform and are used for filtering and organizing observability data (metrics, logs, traces) across different organizational boundaries.
Example usage:
tenantRepo := tenancy.NewKubernetesRepository(k8sClient)
tenants, err := tenantRepo.List(ctx)
if err != nil {
return fmt.Errorf("failed to list tenants: %w", err)
}
// tenants contains a sorted, deduplicated list of tenant IDs
Index ¶
Constants ¶
const (
TenantSelectorLabel = "observability.giantswarm.io/tenant"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type KubernetesTenantRepository ¶ added in v0.57.0
KubernetesTenantRepository implements TenantRepository using Kubernetes resources.
type TenantRepository ¶ added in v0.57.0
type TenantRepository interface {
// List retrieves a unique, sorted list of tenant IDs from all active GrafanaOrganization resources.
List(ctx context.Context) ([]string, error)
}
TenantRepository defines an interface for reading tenant information.
func NewKubernetesRepository ¶ added in v0.57.0
func NewKubernetesRepository(client client.Client) TenantRepository
NewKubernetesRepository creates a new KubernetesTenantRepository.