inventory

package
v0.5.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AuthModeKubernetes validates bearer tokens via TokenReview + SubjectAccessReview.
	AuthModeKubernetes = "kubernetes"
	// AuthModeDisabled disables auth (local dev / CI only).
	AuthModeDisabled = "disabled"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthConfig

type AuthConfig struct {
	Mode                string
	Client              kubernetes.Interface
	RequireInventoryGet bool
	CacheTTL            time.Duration
	// contains filtered or unexported fields
}

AuthConfig configures inventory HTTP authentication (ADR-0404).

func (AuthConfig) AuthDisabled

func (a AuthConfig) AuthDisabled() bool

AuthDisabled reports whether auth middleware should be bypassed.

func (*AuthConfig) InitCache

func (a *AuthConfig) InitCache()

InitCache allocates the in-memory TokenReview/SAR cache when CacheTTL is set.

func (*AuthConfig) Middleware

func (a *AuthConfig) Middleware(next http.Handler) http.Handler

Middleware wraps handlers with Kubernetes token validation when enabled.

type ClientStatusReader added in v0.3.0

type ClientStatusReader struct {
	Client client.Reader
}

ClientStatusReader implements StatusReader using a controller-runtime client.

func (*ClientStatusReader) GetInventoryExportStatus added in v0.3.0

func (r *ClientStatusReader) GetInventoryExportStatus(
	ctx context.Context,
	namespace, name string,
) ([]ExportStatus, error)

func (*ClientStatusReader) ListInventoryStatus added in v0.3.0

func (r *ClientStatusReader) ListInventoryStatus(
	ctx context.Context,
	namespace string,
) ([]ResourceStatus, error)

func (*ClientStatusReader) ListTargetStatus added in v0.3.0

func (r *ClientStatusReader) ListTargetStatus(
	ctx context.Context,
	namespace string,
) ([]ResourceStatus, error)

type ExportStatus added in v0.3.0

type ExportStatus struct {
	SinkName       string `json:"sinkName"`
	SinkNamespace  string `json:"sinkNamespace,omitempty"`
	Status         string `json:"status"`
	LastExportTime string `json:"lastExportTime,omitempty"`
	Message        string `json:"message,omitempty"`
}

ExportStatus reports export health for one sink referenced by an inventory.

type InventorySummary added in v0.3.0

type InventorySummary struct {
	SchemaVersion string         `json:"schemaVersion"`
	ItemCount     int            `json:"itemCount"`
	Namespace     string         `json:"namespace,omitempty"`
	Inventory     string         `json:"inventory,omitempty"`
	Items         []collect.Item `json:"items"`
	UpdatedAt     string         `json:"updatedAt"`
	Pagination    *Pagination    `json:"pagination,omitempty"`
	ExportStatus  []ExportStatus `json:"exportStatus,omitempty"`
	Checksum      string         `json:"checksum,omitempty"`
}

InventorySummary is the versioned Read API envelope (ADR-0405, ADR-0408).

type ListFilter added in v0.3.0

type ListFilter struct {
	Namespace string
	Inventory string
	Target    string
	Group     string
	Version   string
	Kind      string
	Name      string
	Limit     int
	Offset    int
}

ListFilter holds query parameters for inventory list endpoints.

type Pagination added in v0.3.0

type Pagination struct {
	Limit   int  `json:"limit"`
	Offset  int  `json:"offset"`
	Total   int  `json:"total"`
	HasMore bool `json:"hasMore"`
}

Pagination describes a page of inventory items (ADR-0408).

type ResourceStatus added in v0.3.0

type ResourceStatus struct {
	Name               string             `json:"name"`
	Namespace          string             `json:"namespace"`
	Generation         int64              `json:"generation,omitempty"`
	ObservedGeneration int64              `json:"observedGeneration,omitempty"`
	ItemCount          int                `json:"itemCount,omitempty"`
	Conditions         []metav1.Condition `json:"conditions,omitempty"`
	LastExportTime     string             `json:"lastExportTime,omitempty"`
}

ResourceStatus is a CRD status projection for UI health views (B3).

type Server

type Server struct {
	Enabled bool
	Port    int32
	Store   *collect.Store
	Auth    *AuthConfig
	Status  StatusReader
}

Server serves read-only inventory HTTP endpoints backed by the collection store.

func (*Server) Start

func (s *Server) Start(ctx context.Context) error

Start runs the HTTP server until ctx is cancelled.

type StatusListResponse added in v0.3.0

type StatusListResponse struct {
	SchemaVersion string           `json:"schemaVersion"`
	Items         []ResourceStatus `json:"items"`
}

StatusListResponse wraps CRD status rows in the Read API envelope.

type StatusReader added in v0.3.0

type StatusReader interface {
	ListInventoryStatus(ctx context.Context, namespace string) ([]ResourceStatus, error)
	ListTargetStatus(ctx context.Context, namespace string) ([]ResourceStatus, error)
	GetInventoryExportStatus(ctx context.Context, namespace, name string) ([]ExportStatus, error)
}

StatusReader lists CRD status for optional Read API proxy endpoints (B3).

type Summary

type Summary = InventorySummary

Summary is retained as an alias for backward-compatible tests and docs.

Jump to

Keyboard shortcuts

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