api

package
v18.1.0-rc42 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TraceAgentIDAttr is tracing attribute that holds an agent id.
	TraceAgentIDAttr attribute.Key = "agent_id"
	// TraceAgentTypeAttr is tracing attribute that holds an agent type.
	TraceAgentTypeAttr attribute.Key = "agent_type"

	JWTAgentk = "gitlab-agent"
	JWTKAS    = "gitlab-kas"

	// The field manager name for the ones agentk  or kas own, see
	// https://kubernetes.io/docs/reference/using-api/server-side-apply/#field-management
	FieldManager = "agentk"

	// AgentNameRegex
	// https://gitlab.com/gitlab-org/cluster-integration/gitlab-agent/-/blob/master/doc/identity_and_auth.md#agent-identity-and-name
	AgentNameRegex = `[a-z0-9](?:[-a-z0-9]*[a-z0-9])?`

	// AgentKeyPrefix is the prefix to use for labels and annotations owned by kas/agentk.
	// See https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/#syntax-and-character-set.
	// See https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#syntax-and-character-set.
	AgentKeyPrefix     = "agent.gitlab.com"
	AgentIDKey         = AgentKeyPrefix + "/id"
	ConfigProjectIDKey = AgentKeyPrefix + "/config_project_id"
	ProjectIDKey       = AgentKeyPrefix + "/project_id"
	// ProjectKey is the annotation/label key that has a GitLab project full path as its value, e.g. `gitlab-org/gitlab`.
	ProjectKey         = AgentKeyPrefix + "/project"
	CIPipelineIDKey    = AgentKeyPrefix + "/ci_pipeline_id"
	CIJobIDKey         = AgentKeyPrefix + "/ci_job_id"
	UsernameKey        = AgentKeyPrefix + "/username"
	EnvironmentSlugKey = AgentKeyPrefix + "/environment_slug"
	EnvironmentTierKey = AgentKeyPrefix + "/environment_tier"

	// WebSocketMaxMessageSize is an arbitrary historical limit we used from the early days.
	WebSocketMaxMessageSize = 10 * 1024 * 1024
	// GRPCMaxMessageSize is a limit that is under WebSocketMaxMessageSize.
	// Historically we didn't set gRPC limits:
	// - On the server the default value was 4MB.
	// - On the client the default value was 2GB.
	// We use 4MB explicitly to match the historical value.
	GRPCMaxMessageSize = 4 * 1024 * 1024
)

Variables

This section is empty.

Functions

func AgentToken2key

func AgentToken2key(token AgentToken) []byte

Types

type AgentInfo

type AgentInfo struct {
	// Key is the agent's type and id in the database.
	Key AgentKey
	// ProjectID is the id of the configuration project of the agent.
	ProjectID int64

	// Name is the agent's name.
	// Can contain only /a-z\d-/
	Name       string
	GitalyInfo *entity.GitalyInfo
	Repository *gitalypb.Repository
	// DefaultBranch is the name of the default branch in the agent's configuration repository.
	DefaultBranch string
}

AgentInfo contains information about an agent.

type AgentKey added in v18.1.0

type AgentKey struct {
	ID   int64
	Type AgentType
}

AgentKey is agent's key consisting of type and id.

func (AgentKey) String added in v18.1.0

func (a AgentKey) String() string

String returns the string representation of the agent key

type AgentToken

type AgentToken string

AgentToken is agent's bearer access token.

type AgentType added in v18.1.0

type AgentType byte

AgentType is agent's type.

const (
	AgentTypeKubernetes AgentType = iota
	AgentTypeWorkspace
	AgentTypeUnknown
)

NOTE: AgentTypeKubernetes should always be at the top to ensure backwards compatibility.

func ParseAgentType added in v18.1.0

func ParseAgentType(s string) (AgentType, error)

ParseAgentType converts a string to an AgentType When parsing an agent type, we only expect real values like `agentk`, `agentw`. If we encounter any other value, we treat it as `AgentTypeUnknown` and raise an error.

func (AgentType) String added in v18.1.0

func (at AgentType) String() string

String returns the string representation of the agent type

type ProjectInfo

type ProjectInfo struct {
	ProjectID  int64
	GitalyInfo *entity.GitalyInfo
	Repository *gitalypb.Repository
	// DefaultBranch is the name of the default branch in a repository.
	DefaultBranch string
}

Jump to

Keyboard shortcuts

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