inventory

package
v2.2.14 Latest Latest
Warning

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

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

Documentation

Overview

SPDX-FileCopyrightText: (C) 2025 Intel Corporation SPDX-License-Identifier: Apache-2.0

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyHostID    = errors.New("host id is empty")
	ErrEmptyProjectID = errors.New("project id is empty")
	ErrNilK8sClient   = errors.New("k8s client is nil")
	ErrNilLabels      = errors.New("labels are nil")
)
View Source
var (
	GetInventoryClientFunc = client.NewTenantAwareInventoryClient
)

Functions

func JsonStringToMap

func JsonStringToMap(jsonString string) (map[string]string, error)

func NewNoopInventoryClient

func NewNoopInventoryClient() *noopInventoryClient

NewNoopInventoryClient returns a new no-op InventoryClient

Types

type HostCreated

type HostCreated struct {
	HostEventBase
}

HostCreated is an event triggered when a host is created in the Inventory

func (HostCreated) Handle

func (e HostCreated) Handle(ctx context.Context) error

Handle the HostCreated event

type HostDeleted

type HostDeleted struct {
	HostEventBase
}

HostDeleted is an event triggered when a host is deleted in the Inventory

func (HostDeleted) Handle

func (e HostDeleted) Handle(ctx context.Context) error

Handle the HostDeleted event

type HostEventBase

type HostEventBase struct {
	events.EventBase
	HostId    string
	ProjectId string
}

HostEventBase contains common fields for all host events

type HostUpdated

type HostUpdated struct {
	HostEventBase
	Labels map[string]string
	K8scli k8s.K8sWrapperClient
}

HostUpdated is an event triggered when a host is updated in the Inventory

func (HostUpdated) Handle

func (e HostUpdated) Handle(ctx context.Context) error

Handle the HostUpdate event

type InventoryClient

type InventoryClient struct {
	// contains filtered or unexported fields
}

InventoryClient is a tenant-aware grpc client for the inventory service

func NewInventoryClientWithOptions

func NewInventoryClientWithOptions(opt Options) (*InventoryClient, error)

NewInventoryClientWithOptions gets or creates a singleton inventory client with the given options

func NewTestInventoryClient

func NewTestInventoryClient(k8sClient k8s.K8sWrapperClient, tenantClient client.TenantAwareInventoryClient) *InventoryClient

NewTestInventoryClient creates an inventory client for testing with injectable dependencies

func (*InventoryClient) CloseEvents

func (c *InventoryClient) CloseEvents()

CloseEvents closes the events channel to stop watching

func (*InventoryClient) GetHostTrustedCompute

func (c *InventoryClient) GetHostTrustedCompute(ctx context.Context, tenantId, hostUuid string) (bool, error)

GetHostTrustedCompute returns true if the host has secure boot and full disk encryption enabled

func (*InventoryClient) InjectEvent

func (c *InventoryClient) InjectEvent(event *client.WatchEvents)

InjectEvent injects a test event into the inventory client's events channel

func (*InventoryClient) IsImmutable

func (c *InventoryClient) IsImmutable(ctx context.Context, tenantId, hostUuid string) (bool, error)

EnableAirGapInstall returns true if the host OS type is immutable (e.g. EMT with pre-installed K8s packages)

func (*InventoryClient) WatchHosts

func (c *InventoryClient) WatchHosts(hostEvents chan<- events.Event)

WatchHosts watches for host resource events and sends them to the given channel

type Options

type Options struct {
	// contains filtered or unexported fields
}

func (*Options) InventoryAddress

func (o *Options) InventoryAddress() string

func (*Options) MetricsEnabled

func (o *Options) MetricsEnabled() bool

func (*Options) TracingEnabled

func (o *Options) TracingEnabled() bool

func (*Options) WaitGroup

func (o *Options) WaitGroup() *sync.WaitGroup

type OptionsBuilder

type OptionsBuilder interface {
	WithWaitGroup(wg *sync.WaitGroup) OptionsBuilder
	WithInventoryAddress(address string) OptionsBuilder
	WithTracing(enableTracing bool) OptionsBuilder
	WithMetrics(enableMetrics bool) OptionsBuilder
	WithK8sClient(client k8s.K8sWrapperClient) OptionsBuilder
	Build() Options
}

func NewOptionsBuilder

func NewOptionsBuilder() OptionsBuilder

Jump to

Keyboard shortcuts

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