Documentation ¶
Index ¶
- Constants
- Variables
- func InjectAgentRpcApi(ctx context.Context, rpcApi AgentRpcApi) context.Context
- func InjectRpcApi(ctx context.Context, rpcApi RpcApi) context.Context
- func StreamAgentRpcApiInterceptor(factory AgentRpcApiFactory) grpc.StreamServerInterceptor
- func StreamRpcApiInterceptor(factory RpcApiFactory) grpc.StreamServerInterceptor
- func UnaryAgentRpcApiInterceptor(factory AgentRpcApiFactory) grpc.UnaryServerInterceptor
- func UnaryRpcApiInterceptor(factory RpcApiFactory) grpc.UnaryServerInterceptor
- type AgentRpcApi
- type AgentRpcApiFactory
- type Api
- type ApplyDefaults
- type Config
- type Factory
- type GitPushEventCallback
- type GitalyAddress
- func (*GitalyAddress) Descriptor() ([]byte, []int)deprecated
- func (x *GitalyAddress) GetAddress() string
- func (x *GitalyAddress) GetToken() string
- func (*GitalyAddress) ProtoMessage()
- func (x *GitalyAddress) ProtoReflect() protoreflect.Message
- func (x *GitalyAddress) Reset()
- func (x *GitalyAddress) String() string
- func (m *GitalyAddress) Validate() error
- func (m *GitalyAddress) ValidateAll() error
- type GitalyAddressMultiError
- type GitalyAddressValidationError
- func (e GitalyAddressValidationError) Cause() error
- func (e GitalyAddressValidationError) Error() string
- func (e GitalyAddressValidationError) ErrorName() string
- func (e GitalyAddressValidationError) Field() string
- func (e GitalyAddressValidationError) Key() bool
- func (e GitalyAddressValidationError) Reason() string
- type Module
- type Project
- func (*Project) Descriptor() ([]byte, []int)deprecated
- func (x *Project) GetFullPath() string
- func (x *Project) GetId() int64
- func (*Project) ProtoMessage()
- func (x *Project) ProtoReflect() protoreflect.Message
- func (x *Project) Reset()
- func (x *Project) String() string
- func (m *Project) Validate() error
- func (m *Project) ValidateAll() error
- type ProjectMultiError
- type ProjectValidationError
- type Repository
- func (*Repository) Descriptor() ([]byte, []int)deprecated
- func (x *Repository) GetGitAlternateObjectDirectories() []string
- func (x *Repository) GetGitObjectDirectory() string
- func (x *Repository) GetGlProjectPath() string
- func (x *Repository) GetGlRepository() string
- func (x *Repository) GetRelativePath() string
- func (x *Repository) GetStorageName() string
- func (*Repository) ProtoMessage()
- func (x *Repository) ProtoReflect() protoreflect.Message
- func (x *Repository) Reset()
- func (x *Repository) String() string
- func (m *Repository) Validate() error
- func (m *Repository) ValidateAll() error
- type RepositoryMultiError
- type RepositoryValidationError
- type RpcApi
- type RpcApiFactory
Constants ¶
const ( // RoutingHopPrefix is a metadata key prefix that is used for metadata keys that should be consumed by // the gateway kas instances and not passed along to agentk. RoutingHopPrefix = "kas-hop-" // RoutingAgentIdMetadataKey is used to pass destination agent id in request metadata // from the routing kas instance, that is handling the incoming request, to the gateway kas instance, // that is forwarding the request to an agentk. RoutingAgentIdMetadataKey = RoutingHopPrefix + "routing-agent-id" RoutingFeaturePrefix = RoutingHopPrefix + "feat-" RoutingFeatureNoTunnel = RoutingFeaturePrefix + "no-tun" // TODO remove somewhere in e.g. v16.5 // SentryFieldTraceId is the name of the Sentry field for trace ID. SentryFieldTraceId = "trace_id" SentryFieldTraceSampled = "trace_sampled" GrpcServiceSentryField = "grpc.service" GrpcMethodSentryField = "grpc.method" )
Variables ¶
var File_internal_module_modserver_modserver_proto protoreflect.FileDescriptor
Functions ¶
func InjectAgentRpcApi ¶
func InjectAgentRpcApi(ctx context.Context, rpcApi AgentRpcApi) context.Context
func StreamAgentRpcApiInterceptor ¶
func StreamAgentRpcApiInterceptor(factory AgentRpcApiFactory) grpc.StreamServerInterceptor
StreamAgentRpcApiInterceptor returns a new stream server interceptor that augments connection context with a AgentRpcApi.
func StreamRpcApiInterceptor ¶
func StreamRpcApiInterceptor(factory RpcApiFactory) grpc.StreamServerInterceptor
StreamRpcApiInterceptor returns a new stream server interceptor that augments connection context with a RpcApi.
func UnaryAgentRpcApiInterceptor ¶
func UnaryAgentRpcApiInterceptor(factory AgentRpcApiFactory) grpc.UnaryServerInterceptor
UnaryAgentRpcApiInterceptor returns a new unary server interceptor that augments connection context with a AgentRpcApi.
func UnaryRpcApiInterceptor ¶
func UnaryRpcApiInterceptor(factory RpcApiFactory) grpc.UnaryServerInterceptor
UnaryRpcApiInterceptor returns a new unary server interceptor that augments connection context with a RpcApi.
Types ¶
type AgentRpcApi ¶
type AgentRpcApi interface { modshared.RpcApi // AgentToken returns the token of an agent making the RPC. AgentToken() api.AgentToken // AgentInfo returns information about the agent making the RPC. // Returns a gRPC-compatible error. // Returns an error with the Unavailable code if there was a retriable error. // If there was an error, it takes care of tracking it via HandleProcessingError(). AgentInfo(ctx context.Context, log *zap.Logger) (*api.AgentInfo, error) }
AgentRpcApi provides the API for the module's gRPC handlers to use. It should be used only by modules, that handle requests from agents.
func AgentRpcApiFromContext ¶
func AgentRpcApiFromContext(ctx context.Context) AgentRpcApi
type AgentRpcApiFactory ¶
type AgentRpcApiFactory func(ctx context.Context, fullMethodName string) (AgentRpcApi, error)
type Api ¶
type Api interface { modshared.Api OnGitPushEvent(ctx context.Context, callback GitPushEventCallback) }
Api provides the API for the module to use.
type ApplyDefaults ¶
type ApplyDefaults func(*kascfg.ConfigurationFile)
ApplyDefaults is a signature of a public function, exposed by modules to perform defaulting. The function should be called ApplyDefaults.
type Config ¶
type Config struct { // Log can be used for logging from the module. // It should not be used for logging from gRPC Api methods. Use grpctool.LoggerFromContext(ctx) instead. Log *zap.Logger Api Api Config *kascfg.ConfigurationFile GitLabClient gitlab.ClientInterface // Registerer allows to register metrics. // Metrics should be registered in Run and unregistered before Run returns. Registerer prometheus.Registerer UsageTracker usage_metrics.UsageTrackerRegisterer // AgentServer is the gRPC server agentk is talking to. // This can be used to add endpoints in Factory.New. // Request handlers can obtain the per-request logger using grpctool.LoggerFromContext(requestContext). AgentServer *grpc.Server // ApiServer is the gRPC server GitLab is talking to. // This can be used to add endpoints in Factory.New. // Request handlers can obtain the per-request logger using grpctool.LoggerFromContext(requestContext). ApiServer *grpc.Server // RegisterAgentApi allows to register a gRPC Api endpoint that kas proxies to agentk. RegisterAgentApi func(*grpc.ServiceDesc) // AgentConn is a gRPC connection that can be used to send requests to an agentk instance. // Agent Id must be specified in the request metadata in RoutingAgentIdMetadataKey field. // Make sure factory returns modshared.ModuleStartAfterServers if module uses this connection. AgentConn grpc.ClientConnInterface Gitaly gitaly.PoolInterface TraceProvider trace.TracerProvider TracePropagator propagation.TextMapPropagator MeterProvider metric.MeterProvider RedisClient redis.UniversalClient // KasName is a string "gitlab-kas". Can be used as a user agent, server name, service name, etc. KasName string // Version is gitlab-kas version. Version string // CommitId is gitlab-kas commit sha. CommitId string // ProbeRegistry is for registering liveness probes and readiness probes ProbeRegistry *observability.ProbeRegistry }
Config holds configuration for a Module.
type GitPushEventCallback ¶
type GitalyAddress ¶
type GitalyAddress struct { Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` Token string `protobuf:"bytes,2,opt,name=token,proto3" json:"token,omitempty"` // contains filtered or unexported fields }
func (*GitalyAddress) Descriptor
deprecated
func (*GitalyAddress) Descriptor() ([]byte, []int)
Deprecated: Use GitalyAddress.ProtoReflect.Descriptor instead.
func (*GitalyAddress) GetAddress ¶
func (x *GitalyAddress) GetAddress() string
func (*GitalyAddress) GetToken ¶
func (x *GitalyAddress) GetToken() string
func (*GitalyAddress) ProtoMessage ¶
func (*GitalyAddress) ProtoMessage()
func (*GitalyAddress) ProtoReflect ¶
func (x *GitalyAddress) ProtoReflect() protoreflect.Message
func (*GitalyAddress) Reset ¶
func (x *GitalyAddress) Reset()
func (*GitalyAddress) String ¶
func (x *GitalyAddress) String() string
func (*GitalyAddress) Validate ¶
func (m *GitalyAddress) Validate() error
Validate checks the field values on GitalyAddress with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.
func (*GitalyAddress) ValidateAll ¶
func (m *GitalyAddress) ValidateAll() error
ValidateAll checks the field values on GitalyAddress with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in GitalyAddressMultiError, or nil if none found.
type GitalyAddressMultiError ¶
type GitalyAddressMultiError []error
GitalyAddressMultiError is an error wrapping multiple validation errors returned by GitalyAddress.ValidateAll() if the designated constraints aren't met.
func (GitalyAddressMultiError) AllErrors ¶
func (m GitalyAddressMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (GitalyAddressMultiError) Error ¶
func (m GitalyAddressMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type GitalyAddressValidationError ¶
type GitalyAddressValidationError struct {
// contains filtered or unexported fields
}
GitalyAddressValidationError is the validation error returned by GitalyAddress.Validate if the designated constraints aren't met.
func (GitalyAddressValidationError) Cause ¶
func (e GitalyAddressValidationError) Cause() error
Cause function returns cause value.
func (GitalyAddressValidationError) Error ¶
func (e GitalyAddressValidationError) Error() string
Error satisfies the builtin error interface
func (GitalyAddressValidationError) ErrorName ¶
func (e GitalyAddressValidationError) ErrorName() string
ErrorName returns error name.
func (GitalyAddressValidationError) Field ¶
func (e GitalyAddressValidationError) Field() string
Field function returns field value.
func (GitalyAddressValidationError) Key ¶
func (e GitalyAddressValidationError) Key() bool
Key function returns key value.
func (GitalyAddressValidationError) Reason ¶
func (e GitalyAddressValidationError) Reason() string
Reason function returns reason value.
type Project ¶
type Project struct { Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` FullPath string `protobuf:"bytes,2,opt,name=full_path,json=fullPath,proto3" json:"full_path,omitempty"` // contains filtered or unexported fields }
func (*Project) Descriptor
deprecated
func (*Project) GetFullPath ¶
func (*Project) ProtoMessage ¶
func (*Project) ProtoMessage()
func (*Project) ProtoReflect ¶
func (x *Project) ProtoReflect() protoreflect.Message
func (*Project) Validate ¶
Validate checks the field values on Project with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.
func (*Project) ValidateAll ¶
ValidateAll checks the field values on Project with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in ProjectMultiError, or nil if none found.
type ProjectMultiError ¶
type ProjectMultiError []error
ProjectMultiError is an error wrapping multiple validation errors returned by Project.ValidateAll() if the designated constraints aren't met.
func (ProjectMultiError) AllErrors ¶
func (m ProjectMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (ProjectMultiError) Error ¶
func (m ProjectMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type ProjectValidationError ¶
type ProjectValidationError struct {
// contains filtered or unexported fields
}
ProjectValidationError is the validation error returned by Project.Validate if the designated constraints aren't met.
func (ProjectValidationError) Cause ¶
func (e ProjectValidationError) Cause() error
Cause function returns cause value.
func (ProjectValidationError) Error ¶
func (e ProjectValidationError) Error() string
Error satisfies the builtin error interface
func (ProjectValidationError) ErrorName ¶
func (e ProjectValidationError) ErrorName() string
ErrorName returns error name.
func (ProjectValidationError) Field ¶
func (e ProjectValidationError) Field() string
Field function returns field value.
func (ProjectValidationError) Key ¶
func (e ProjectValidationError) Key() bool
Key function returns key value.
func (ProjectValidationError) Reason ¶
func (e ProjectValidationError) Reason() string
Reason function returns reason value.
type Repository ¶
type Repository struct { StorageName string `protobuf:"bytes,2,opt,name=storage_name,json=storageName,proto3" json:"storage_name,omitempty"` RelativePath string `protobuf:"bytes,3,opt,name=relative_path,json=relativePath,proto3" json:"relative_path,omitempty"` GitObjectDirectory string `protobuf:"bytes,4,opt,name=git_object_directory,json=gitObjectDirectory,proto3" json:"git_object_directory,omitempty"` GitAlternateObjectDirectories []string `` /* 152-byte string literal not displayed */ GlRepository string `protobuf:"bytes,6,opt,name=gl_repository,json=glRepository,proto3" json:"gl_repository,omitempty"` GlProjectPath string `protobuf:"bytes,8,opt,name=gl_project_path,json=glProjectPath,proto3" json:"gl_project_path,omitempty"` // contains filtered or unexported fields }
func (*Repository) Descriptor
deprecated
func (*Repository) Descriptor() ([]byte, []int)
Deprecated: Use Repository.ProtoReflect.Descriptor instead.
func (*Repository) GetGitAlternateObjectDirectories ¶
func (x *Repository) GetGitAlternateObjectDirectories() []string
func (*Repository) GetGitObjectDirectory ¶
func (x *Repository) GetGitObjectDirectory() string
func (*Repository) GetGlProjectPath ¶
func (x *Repository) GetGlProjectPath() string
func (*Repository) GetGlRepository ¶
func (x *Repository) GetGlRepository() string
func (*Repository) GetRelativePath ¶
func (x *Repository) GetRelativePath() string
func (*Repository) GetStorageName ¶
func (x *Repository) GetStorageName() string
func (*Repository) ProtoMessage ¶
func (*Repository) ProtoMessage()
func (*Repository) ProtoReflect ¶
func (x *Repository) ProtoReflect() protoreflect.Message
func (*Repository) Reset ¶
func (x *Repository) Reset()
func (*Repository) String ¶
func (x *Repository) String() string
func (*Repository) Validate ¶
func (m *Repository) Validate() error
Validate checks the field values on Repository with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.
func (*Repository) ValidateAll ¶
func (m *Repository) ValidateAll() error
ValidateAll checks the field values on Repository with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in RepositoryMultiError, or nil if none found.
type RepositoryMultiError ¶
type RepositoryMultiError []error
RepositoryMultiError is an error wrapping multiple validation errors returned by Repository.ValidateAll() if the designated constraints aren't met.
func (RepositoryMultiError) AllErrors ¶
func (m RepositoryMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (RepositoryMultiError) Error ¶
func (m RepositoryMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type RepositoryValidationError ¶
type RepositoryValidationError struct {
// contains filtered or unexported fields
}
RepositoryValidationError is the validation error returned by Repository.Validate if the designated constraints aren't met.
func (RepositoryValidationError) Cause ¶
func (e RepositoryValidationError) Cause() error
Cause function returns cause value.
func (RepositoryValidationError) Error ¶
func (e RepositoryValidationError) Error() string
Error satisfies the builtin error interface
func (RepositoryValidationError) ErrorName ¶
func (e RepositoryValidationError) ErrorName() string
ErrorName returns error name.
func (RepositoryValidationError) Field ¶
func (e RepositoryValidationError) Field() string
Field function returns field value.
func (RepositoryValidationError) Key ¶
func (e RepositoryValidationError) Key() bool
Key function returns key value.
func (RepositoryValidationError) Reason ¶
func (e RepositoryValidationError) Reason() string
Reason function returns reason value.
type RpcApi ¶
RpcApi provides the API for the module's gRPC handlers to use.