clusters

package
v0.0.0-...-f2c360d Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTemplateBuilderNotFound          = errors.New("template builder not found")
	ErrAvailableTemplateBuilderNotFound = errors.New("available template builder not found")
)

Functions

func LogQueryWindow

func LogQueryWindow(cursor *time.Time, direction api.LogsDirection) (time.Time, time.Time)

Types

type Cluster

type Cluster struct {
	ID            uuid.UUID
	SandboxDomain *string
	AuthOrgID     string
	// contains filtered or unexported fields
}

func NewCluster

func NewCluster(
	clusterID uuid.UUID,
	domain *string,
	authOrgID string,
	sandboxes *smap.Map[*Instance],
	synchronization *synchronization.Synchronize[discovery.Item, *Instance],
	resources ClusterResource,
) *Cluster

func (*Cluster) Close

func (c *Cluster) Close(ctx context.Context) error

func (*Cluster) GetAvailableTemplateBuilder

func (c *Cluster) GetAvailableTemplateBuilder(ctx context.Context, expectedInfo machineinfo.MachineInfo) (*Instance, error)

func (*Cluster) GetByServiceInstanceID

func (c *Cluster) GetByServiceInstanceID(serviceInstanceID string) (*Instance, bool)

func (*Cluster) GetOrchestrators

func (c *Cluster) GetOrchestrators() []*Instance

func (*Cluster) GetResources

func (c *Cluster) GetResources() ClusterResource

func (*Cluster) GetTemplateBuilderByNodeID

func (c *Cluster) GetTemplateBuilderByNodeID(nodeID string) (*Instance, error)

func (*Cluster) SyncInstances

func (c *Cluster) SyncInstances(ctx context.Context) error

SyncInstances performs an immediate synchronization of cluster instances from the service discovery source. It is called on-demand when a node lookup fails, to handle newly joined orchestrators that may not yet be in the in-memory pool.

type ClusterResource

type ClusterResource interface {
	GetSandboxMetrics(ctx context.Context, teamID string, sandboxID string, qStart *int64, qEnd *int64) ([]api.SandboxMetric, *api.APIError)
	GetSandboxesMetrics(ctx context.Context, teamID string, sandboxIDs []string) (map[string]api.SandboxMetric, *api.APIError)
	GetSandboxLogs(ctx context.Context, teamID string, sandboxID string, start *int64, end *int64, limit *int32, direction *api.LogsDirection, level *logs.LogLevel, search *string) (api.SandboxLogs, *api.APIError)
	GetBuildLogs(ctx context.Context, nodeID *string, templateID string, buildID string, offset int32, limit int32, level *logs.LogLevel, cursor *time.Time, direction api.LogsDirection, source *api.LogsSource) ([]logs.LogEntry, *api.APIError)
}

type ClusterResourceProviderImpl

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

func (*ClusterResourceProviderImpl) GetBuildLogs

func (r *ClusterResourceProviderImpl) GetBuildLogs(
	ctx context.Context,
	nodeID *string,
	templateID string,
	buildID string,
	offset int32,
	limit int32,
	level *logs.LogLevel,
	cursor *time.Time,
	direction api.LogsDirection,
	source *api.LogsSource,
) ([]logs.LogEntry, *api.APIError)

func (*ClusterResourceProviderImpl) GetSandboxLogs

func (r *ClusterResourceProviderImpl) GetSandboxLogs(ctx context.Context, teamID string, sandboxID string, start *int64, end *int64, limit *int32, dr *api.LogsDirection, level *logs.LogLevel, search *string) (api.SandboxLogs, *api.APIError)

func (*ClusterResourceProviderImpl) GetSandboxMetrics

func (r *ClusterResourceProviderImpl) GetSandboxMetrics(ctx context.Context, teamID string, sandboxID string, qStart *int64, qEnd *int64) ([]api.SandboxMetric, *api.APIError)

func (*ClusterResourceProviderImpl) GetSandboxesMetrics

func (r *ClusterResourceProviderImpl) GetSandboxesMetrics(ctx context.Context, teamID string, sandboxIDs []string) (map[string]api.SandboxMetric, *api.APIError)

func (*ClusterResourceProviderImpl) GetVolumeTypes

func (r *ClusterResourceProviderImpl) GetVolumeTypes(_ context.Context) ([]string, error)

type GRPCClient

type GRPCClient struct {
	Info     infogrpc.InfoServiceClient
	Sandbox  orchestratorgrpc.SandboxServiceClient
	Volumes  orchestratorgrpc.VolumeServiceClient
	Template templatemanagergrpc.TemplateServiceClient

	Connection *grpc.ClientConn
	// contains filtered or unexported fields
}

func NewGRPCClient

func NewGRPCClient(conn *grpc.ClientConn, observeTarget string) *GRPCClient

func (*GRPCClient) Close

func (a *GRPCClient) Close() error

func (*GRPCClient) Init

func (a *GRPCClient) Init(ctx context.Context)

type Instance

type Instance struct {
	ClusterID uuid.UUID
	NodeID    string

	LocalIPAddress string
	// contains filtered or unexported fields
}

func (*Instance) Close

func (i *Instance) Close() error

func (*Instance) GetClient

func (i *Instance) GetClient() *GRPCClient

func (*Instance) GetInfo

func (i *Instance) GetInfo() InstanceInfo

func (*Instance) GetMachineInfo

func (i *Instance) GetMachineInfo() machineinfo.MachineInfo

func (*Instance) Sync

func (i *Instance) Sync(ctx context.Context) error

Sync function can be called on freshly initialized instance to populate its data In initial case its possible that service instance id needed for proper remote cluster routing is not yet set.

type InstanceInfo

type InstanceInfo struct {
	ServiceInstanceID    string
	ServiceVersion       string
	ServiceVersionCommit string
	Status               infogrpc.ServiceInfoStatus
	IsOrchestrator       bool
	IsBuilder            bool
}

InstanceInfo contains synchronized instance information

type LocalClusterResourceProvider

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

func (*LocalClusterResourceProvider) GetBuildLogs

func (l *LocalClusterResourceProvider) GetBuildLogs(
	ctx context.Context,
	nodeID *string,
	templateID string,
	buildID string,
	offset int32,
	limit int32,
	level *logs.LogLevel,
	cursor *time.Time,
	direction api.LogsDirection,
	source *api.LogsSource,
) ([]logs.LogEntry, *api.APIError)

func (*LocalClusterResourceProvider) GetSandboxLogs

func (l *LocalClusterResourceProvider) GetSandboxLogs(ctx context.Context, teamID string, sandboxID string, qStart *int64, qEnd *int64, qLimit *int32, qDirection *api.LogsDirection, level *logs.LogLevel, search *string) (api.SandboxLogs, *api.APIError)

func (*LocalClusterResourceProvider) GetSandboxMetrics

func (l *LocalClusterResourceProvider) GetSandboxMetrics(ctx context.Context, teamID string, sandboxID string, qStart *int64, qEnd *int64) ([]api.SandboxMetric, *api.APIError)

func (*LocalClusterResourceProvider) GetSandboxesMetrics

func (l *LocalClusterResourceProvider) GetSandboxesMetrics(ctx context.Context, teamID string, sandboxIDs []string) (map[string]api.SandboxMetric, *api.APIError)

type Pool

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

func NewPool

func NewPool(
	ctx context.Context,
	tel *telemetry.Client,
	db *client.Client,
	localDiscovery discovery.Discovery,
	queryMetricsProvider clickhouse.Clickhouse,
	queryLogsProvider *loki.LokiQueryProvider,
	config cfg.Config,
) (*Pool, error)

func (*Pool) Close

func (p *Pool) Close(ctx context.Context)

func (*Pool) GetClusterById

func (p *Pool) GetClusterById(id uuid.UUID) (*Cluster, bool)

func (*Pool) GetClusters

func (p *Pool) GetClusters() map[string]*Cluster

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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