Documentation ¶
Index ¶
- Variables
- type API
- type Config
- type Factory
- type Feature
- type GitLabRequestConfig
- type GitLabRequestOption
- func WithRequestBody(body io.Reader) GitLabRequestOption
- func WithRequestHeader(header string, values ...string) GitLabRequestOption
- func WithRequestHeaders(header http.Header) GitLabRequestOption
- func WithRequestMethod(method string) GitLabRequestOption
- func WithRequestQuery(query url.Values) GitLabRequestOption
- func WithRequestQueryParam(key string, values ...string) GitLabRequestOption
- type GitLabResponse
- type Module
- type SubscribeCb
Constants ¶
This section is empty.
Variables ¶
View Source
var ( KnownFeatures = map[Feature]string{ Tunnel: "tunnel", } )
Functions ¶
This section is empty.
Types ¶
type API ¶
type API interface { modshared.API MakeGitLabRequest(ctx context.Context, path string, opts ...GitLabRequestOption) (*GitLabResponse, error) ToggleFeature(feature Feature, enabled bool) SubscribeToFeatureStatus(feature Feature, cb SubscribeCb) }
API provides the API for the module to use.
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 AgentMeta *modshared.AgentMeta Api API // K8sUtilFactory provides means to interact with the Kubernetes cluster agentk is running in. K8sUtilFactory util.Factory // KasConn is the gRPC connection to gitlab-kas. KasConn grpc.ClientConnInterface // Server is a gRPC server that can be used to expose API endpoints to gitlab-kas and/or GitLab. // This can be used to add endpoints in Factory.New. // Request handlers can obtain the per-request logger using grpctool.LoggerFromContext(requestContext). Server *grpc.Server // AgentName is a string "gitlab-agent". Can be used as a user agent, server name, service name, etc. AgentName string }
Config holds configuration for a Module.
type Feature ¶
type Feature int
Feature describes a particular feature that can be enabled or disabled by a module. If module is configured in a way that requires use of a feature, it should indicate that it needs the feature. All features are disabled by default.
type GitLabRequestConfig ¶
type GitLabRequestConfig struct { Method string Header http.Header Query url.Values Body io.ReadCloser }
func ApplyRequestOptions ¶
func ApplyRequestOptions(opts []GitLabRequestOption) *GitLabRequestConfig
type GitLabRequestOption ¶
type GitLabRequestOption func(*GitLabRequestConfig)
func WithRequestBody ¶
func WithRequestBody(body io.Reader) GitLabRequestOption
WithRequestBody specifies request body to send. If body implements io.ReadCloser, its Close() method will be called once the data has been sent.
func WithRequestHeader ¶
func WithRequestHeader(header string, values ...string) GitLabRequestOption
func WithRequestHeaders ¶
func WithRequestHeaders(header http.Header) GitLabRequestOption
func WithRequestMethod ¶
func WithRequestMethod(method string) GitLabRequestOption
WithRequestMethod specifies request HTTP method.
func WithRequestQuery ¶
func WithRequestQuery(query url.Values) GitLabRequestOption
func WithRequestQueryParam ¶
func WithRequestQueryParam(key string, values ...string) GitLabRequestOption
type GitLabResponse ¶
type Module ¶
type Module interface { // Run starts the module. // Run can block until the context is canceled or exit with nil if there is nothing to do. // cfg is a channel that gets configuration updates sent to it. It's closed when the module should shut down. // cfg is a shared instance, must not be mutated. Module should make a copy if it needs to mutate the object. // Applying configuration may take time, the provided context may signal done if module should shut down. // cfg only provides the latest available configuration, intermediate configuration states are discarded. Run(ctx context.Context, cfg <-chan *agentcfg.AgentConfiguration) error // DefaultAndValidateConfiguration applies defaults and validates the passed configuration. // It is called each time on configuration update before sending it via the channel passed to Run(). // cfg is a shared instance, module can mutate only the part of it that it owns and only inside of this method. DefaultAndValidateConfiguration(cfg *agentcfg.AgentConfiguration) error // Name returns module's name. Name() string }
type SubscribeCb ¶
type SubscribeCb func(enabled bool)
Click to show internal directories.
Click to hide internal directories.