Documentation
¶
Index ¶
- type Config
- type ImageServer
- func (s *ImageServer) CommitImage(ctx context.Context, req *v1beta1.CommitRequest) (*v1beta1.CommitResponse, error)
- func (s *ImageServer) PushImage(ctx context.Context, req *v1beta1.PushRequest) (*v1beta1.PushResponse, error)
- func (s *ImageServer) StartRPCServer() (*grpc.Server, chan error)
- func (s *ImageServer) Version(_ context.Context, _ *v1beta1.VersionRequest) (*v1beta1.VersionResponse, error)
- type MetricsServer
- type Registry
- func (r *Registry) AddCounter(name string, labels map[string]string, delta float64)
- func (r *Registry) DecGauge(name string, labels map[string]string)
- func (r *Registry) HTTPHandler() http.Handler
- func (r *Registry) IncCounter(name string, labels map[string]string)
- func (r *Registry) IncGauge(name string, labels map[string]string)
- func (r *Registry) ObserveSeconds(name string, labels map[string]string, seconds float64)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
SocketAddress string
Version string
GitCommit string
RequestTimeout time.Duration
MaxConcurrentCommit int
MaxConcurrentPush int
ContainerdNamespace string
RuntimeOverride string
// AllowedUIDs restricts which Unix peer UIDs may invoke the agent.
// Empty/nil means "allow everyone with access to the socket" (the
// pre-existing behaviour).
AllowedUIDs []uint32
// Metrics, if non-nil, enables observation of RPC counts/latencies.
Metrics *Registry
// PushRetry overrides the runtime push retry policy. Zero values pick
// sensible defaults inside operate.NewRuntime.
PushRetry operate.RetryPolicy
}
Config drives runtime behaviour of the gRPC image server.
type ImageServer ¶
type ImageServer struct {
v1beta1.UnimplementedImageServiceServer
// contains filtered or unexported fields
}
ImageServer is the gRPC handler implementing v1beta1.ImageServiceServer.
func New ¶
func New(cfg Config) (*ImageServer, error)
New validates configuration and returns an ImageServer ready to start.
func (*ImageServer) CommitImage ¶
func (s *ImageServer) CommitImage(ctx context.Context, req *v1beta1.CommitRequest) (*v1beta1.CommitResponse, error)
CommitImage implements the gRPC method.
func (*ImageServer) PushImage ¶
func (s *ImageServer) PushImage(ctx context.Context, req *v1beta1.PushRequest) (*v1beta1.PushResponse, error)
PushImage implements the gRPC method.
func (*ImageServer) StartRPCServer ¶
func (s *ImageServer) StartRPCServer() (*grpc.Server, chan error)
StartRPCServer starts serving in a goroutine and returns the underlying *grpc.Server so callers can perform graceful shutdown. The error channel is closed when Serve returns.
func (*ImageServer) Version ¶
func (s *ImageServer) Version(_ context.Context, _ *v1beta1.VersionRequest) (*v1beta1.VersionResponse, error)
Version implements the gRPC method.
type MetricsServer ¶
type MetricsServer struct {
Registry *Registry
Address string
// contains filtered or unexported fields
}
MetricsServer wraps an http.Server hosting the registry. ListenAndServe returns nil if address is empty.
func (*MetricsServer) Shutdown ¶
func (m *MetricsServer) Shutdown(ctx context.Context) error
Shutdown gracefully stops the metrics HTTP server.
func (*MetricsServer) Start ¶
func (m *MetricsServer) Start() chan error
Start begins serving in the background. It returns an error channel which receives the eventual ListenAndServe error (one value, then closed).
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry is the metrics container exposed at /metrics.
func NewRegistry ¶
func NewRegistry() *Registry
NewRegistry constructs an empty registry. The latency buckets are tuned for commit/push: from sub-second up to 30 minutes.
func (*Registry) AddCounter ¶
AddCounter atomically increments the named counter by `delta`.
func (*Registry) HTTPHandler ¶
HTTPHandler exposes the registry in Prometheus text exposition format.
func (*Registry) IncCounter ¶
IncCounter atomically increments the named counter by 1.