client

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package client is a thin, ready-to-use gRPC client for the LabManager agent. It handles connection setup and mutual TLS so a caller (e.g. the control plane) only imports this package and calls the typed LabManager RPCs.

Ported from the legacy agent's client wrapper, adapted to the LabManager contract and to mTLS (the LabManager agent authenticates callers by client certificate + CN allowlist, not a JWT token).

Index

Constants

View Source
const (
	MaxMessageSize = 64 << 20
	MaxRequestSize = 4 << 20
	MaxItems       = 5000
)

MaxMessageSize is the largest answer the client accepts, equal to the agent's send limit; MaxRequestSize is the largest request it sends, equal to what the agent reads (a bigger one is refused locally); MaxItems is the most items one call may carry.

View Source
const (
	StopSnapshotMode_STOP_SNAPSHOT_MODE_UNSPECIFIED = protobuf.StopSnapshotMode_STOP_SNAPSHOT_MODE_UNSPECIFIED
	StopSnapshotMode_STOP_SNAPSHOT_MODE_SKIP        = protobuf.StopSnapshotMode_STOP_SNAPSHOT_MODE_SKIP
	StopSnapshotMode_STOP_SNAPSHOT_MODE_REQUIRED    = protobuf.StopSnapshotMode_STOP_SNAPSHOT_MODE_REQUIRED
)
View Source
const (
	// ErrorDomain is the errdetails.ErrorInfo domain of agent-specific errors.
	ErrorDomain = "agent.cybericebox"
	// ReasonTerminating is the ErrorInfo reason of a write refused because the
	// object with that deterministic name is still being deleted (finalizers run
	// asynchronously). The write was NOT applied; retry after a short delay.
	ReasonTerminating = "TERMINATING"
)
View Source
const ReasonCountMismatch = "COUNT_MISMATCH"

ReasonCountMismatch is the ErrorInfo reason of a selector call refused because more objects matched than the call's expected_count. Nothing was done.

Variables

This section is empty.

Functions

func CountMismatch

func CountMismatch(err error) (actual int, ok bool)

CountMismatch reports whether err is the agent's expected_count refusal (codes.FailedPrecondition + reason COUNT_MISMATCH) and the actual number of objects the selector matched.

func CreationDefinitionHash added in v1.1.0

func CreationDefinitionHash(specJSON []byte, group string, after []string) (string, error)

CreationDefinitionHash binds immutable dispatch evidence to the exact JSON definition before Create. Lifecycle is separate mutable intent; environment values and labels never enter this public fingerprint.

func IsTerminating

func IsTerminating(err error) bool

IsTerminating reports whether err is the agent's retryable "object is still being deleted" refusal (codes.Unavailable + ErrorInfo reason TERMINATING). The object's deletion is finished once Get* returns codes.NotFound.

Types

type Client

type Client interface {
	protobuf.LabManagerClient
	Close() error
}

Client is the typed LabManager client plus connection ownership.

func NewConnection

func NewConnection(config Config) (Client, error)

NewConnection dials the LabManager agent and returns a typed client. The caller owns the connection and must Close it. grpc.NewClient is lazy — the actual connection is established on the first RPC.

type Config

type Config struct {
	// Endpoint is the agent address, host:port. Dial the agent by its
	// certificate hostname (the agent's domain): gRPC then uses that as the
	// TLS SNI and verifies it against the server certificate SAN, so no
	// separate server-name setting is needed.
	Endpoint string
	TLS      TLS
}

Config describes how to reach a LabManager agent.

type GroupLifecycleSpec added in v1.1.0

type GroupLifecycleSpec = protobuf.GroupLifecycleSpec

Lifecycle aliases expose the additive protocol through the public client. Client embeds LabManagerClient, including StopLabs and StartLabs.

type GroupPodFormula added in v1.1.0

type GroupPodFormula = protobuf.GroupPodFormula

Sizing v2 aliases describe validated profiles without selecting one or changing defaults.

type GroupPodsFeature added in v1.1.0

type GroupPodsFeature = protobuf.GroupPodsFeature

Sizing v2 aliases describe validated profiles without selecting one or changing defaults.

type GroupPodsSizingProfile added in v1.1.0

type GroupPodsSizingProfile = protobuf.GroupPodsSizingProfile

Sizing v2 aliases describe validated profiles without selecting one or changing defaults.

type GroupPodsSizingV2 added in v1.1.0

type GroupPodsSizingV2 = protobuf.GroupPodsSizingV2

Sizing v2 aliases describe validated profiles without selecting one or changing defaults.

type GroupRetirementTarget added in v1.1.0

type GroupRetirementTarget = protobuf.GroupRetirementTarget

Lifecycle aliases expose the additive protocol through the public client. Client embeds LabManagerClient, including StopLabs and StartLabs.

type GroupSizingInputs added in v1.1.0

type GroupSizingInputs = protobuf.GroupSizingInputs

Sizing v2 aliases describe validated profiles without selecting one or changing defaults.

type GroupTarget added in v1.1.0

type GroupTarget = protobuf.GroupTarget

Lifecycle aliases expose the additive protocol through the public client. Client embeds LabManagerClient, including StopLabs and StartLabs.

type GroupTrafficEnvelope added in v1.1.0

type GroupTrafficEnvelope = protobuf.GroupTrafficEnvelope

Sizing v2 aliases describe validated profiles without selecting one or changing defaults.

type LabLifecycleStatus added in v1.1.0

type LabLifecycleStatus = protobuf.LabLifecycleStatus

Lifecycle aliases expose the additive protocol through the public client. Client embeds LabManagerClient, including StopLabs and StartLabs.

type LabLifecycleTarget added in v1.1.0

type LabLifecycleTarget = protobuf.LabLifecycleTarget

Lifecycle aliases expose the additive protocol through the public client. Client embeds LabManagerClient, including StopLabs and StartLabs.

type LabRetirementTarget added in v1.1.0

type LabRetirementTarget = protobuf.LabRetirementTarget

Lifecycle aliases expose the additive protocol through the public client. Client embeds LabManagerClient, including StopLabs and StartLabs.

type LifecycleFeature added in v1.1.0

type LifecycleFeature = protobuf.LifecycleFeature

Lifecycle aliases expose the additive protocol through the public client. Client embeds LabManagerClient, including StopLabs and StartLabs.

type PodSize added in v1.1.0

type PodSize = protobuf.PodSize

Sizing v2 aliases describe validated profiles without selecting one or changing defaults.

type ResourceAllocation added in v1.1.0

type ResourceAllocation = protobuf.ResourceAllocation

Lifecycle aliases expose the additive protocol through the public client. Client embeds LabManagerClient, including StopLabs and StartLabs.

type ResourceAmounts added in v1.1.0

type ResourceAmounts = protobuf.ResourceAmounts

Lifecycle aliases expose the additive protocol through the public client. Client embeds LabManagerClient, including StopLabs and StartLabs.

type RetireLabGroupsRequest added in v1.1.0

type RetireLabGroupsRequest = protobuf.RetireLabGroupsRequest

Lifecycle aliases expose the additive protocol through the public client. Client embeds LabManagerClient, including StopLabs and StartLabs.

type RetireLabsRequest added in v1.1.0

type RetireLabsRequest = protobuf.RetireLabsRequest

Lifecycle aliases expose the additive protocol through the public client. Client embeds LabManagerClient, including StopLabs and StartLabs.

type RetirementStatus added in v1.1.0

type RetirementStatus = protobuf.RetirementStatus

Lifecycle aliases expose the additive protocol through the public client. Client embeds LabManagerClient, including StopLabs and StartLabs.

type StartLabGroupsRequest added in v1.1.0

type StartLabGroupsRequest = protobuf.StartLabGroupsRequest

Lifecycle aliases expose the additive protocol through the public client. Client embeds LabManagerClient, including StopLabs and StartLabs.

type StartLabsRequest added in v1.1.0

type StartLabsRequest = protobuf.StartLabsRequest

Lifecycle aliases expose the additive protocol through the public client. Client embeds LabManagerClient, including StopLabs and StartLabs.

type StopLabGroupItem added in v1.1.0

type StopLabGroupItem = protobuf.StopLabGroupItem

Lifecycle aliases expose the additive protocol through the public client. Client embeds LabManagerClient, including StopLabs and StartLabs.

type StopLabGroupsRequest added in v1.1.0

type StopLabGroupsRequest = protobuf.StopLabGroupsRequest

Lifecycle aliases expose the additive protocol through the public client. Client embeds LabManagerClient, including StopLabs and StartLabs.

type StopLabItem added in v1.1.0

type StopLabItem = protobuf.StopLabItem

Lifecycle aliases expose the additive protocol through the public client. Client embeds LabManagerClient, including StopLabs and StartLabs.

type StopLabsRequest added in v1.1.0

type StopLabsRequest = protobuf.StopLabsRequest

Lifecycle aliases expose the additive protocol through the public client. Client embeds LabManagerClient, including StopLabs and StartLabs.

type StopSnapshotMode added in v1.1.0

type StopSnapshotMode = protobuf.StopSnapshotMode

Lifecycle aliases expose the additive protocol through the public client. Client embeds LabManagerClient, including StopLabs and StartLabs.

type TLS

type TLS struct {
	Enabled  bool
	CertFile string // client certificate (PEM) presented for mTLS
	KeyFile  string // client private key (PEM)
	CAFile   string // CA (PEM) that signed the agent's server certificate; empty = system roots
}

TLS configures the transport. When Enabled, the connection is mutual TLS: the client presents CertFile/KeyFile (whose CN must be a Tenant) and verifies the server against CAFile, or against the system roots when CAFile is empty (a publicly trusted certificate). With no CertFile and KeyFile it is server-authenticated TLS only, for Enroll.

Jump to

Keyboard shortcuts

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