Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Image ¶
type Image struct {
// contains filtered or unexported fields
}
Image controller handles events related to Images. It starts and receives events from the informer, calling appropriate functions on our concrete services layer implementation.
func NewImage ¶
func NewImage(imgsvc ImageSyncer) *Image
NewImage returns a new controller for Images. This controller runs image imports in parallel, at a given time we can have at max "tokens" distinct images being processed (hardcoded to 10).
func (*Image) RequiresLeaderElection ¶
RequiresLeaderElection returns if this controller requires or not a leader lease to run.
type ImageIO ¶
type ImageIO struct { pb.UnimplementedImageIOServiceServer // contains filtered or unexported fields }
ImageIO handles requests for pulling and pushing current image pointed by a Image.
func NewImageIO ¶
func NewImageIO(imgexp ImagePusherPuller, usrval UserValidator) *ImageIO
NewImageIO returns a grpc handler for image Pull and Push requests. I have hardcoded what seems to be reasonable values in terms of keep alive and connection lifespan management (we may need to better tune this). The implementation here is made so we have a stateless handler. Panics if unable to load certificates.
func (*ImageIO) Pull ¶
Pull handles an image pull through grpc. We receive a request informing what is the Image to be pulled from (namespace and name) and also a kubernetes token for authentication and authorization.
func (*ImageIO) Push ¶
func (t *ImageIO) Push(stream pb.ImageIOService_PushServer) error
Push handles image pushes through grpc. The first message received indicates the image destination (Image's namespace and name) and a authorization token, all subsequent messages are of type Chunk where we can find a slice of bytes. We reassemble the image on disk and later on Load it into a registry.
func (*ImageIO) RequiresLeaderElection ¶
RequiresLeaderElection returns if this controller requires or not a leader lease to run. On our case, as we are a grpc server, we do not require to be a leader in order to work properly.
type ImageImport ¶
type ImageImport struct {
// contains filtered or unexported fields
}
ImageImport controller handles events related to ImageImports. It starts and receives events from the informer, calling appropriate functions on our concrete services layer implementation.
func NewImageImport ¶
func NewImageImport(tisvc ImageImportSyncer) *ImageImport
NewImageImport returns a new controller for ImageImports. This controller runs image imports in parallel, at a given time we can have at max "tokens" distinct imports being processed. Max number of parallel imports has been hardcoded to 10.
func (*ImageImport) Name ¶
func (t *ImageImport) Name() string
Name returns a name identifier for this controller.
func (*ImageImport) RequiresLeaderElection ¶
func (t *ImageImport) RequiresLeaderElection() bool
RequiresLeaderElection returns if this controller requires or not a leader lease to run.
type ImageImportSyncer ¶
type ImageImportSyncer interface { Sync(context.Context, *imgv1b1.ImageImport) error Get(context.Context, string, string) (*imgv1b1.ImageImport, error) AddEventHandler(cache.ResourceEventHandler) }
ImageImportSyncer abstraction exists to make testing easier. You most likely wanna see ImageImport struct under services/imageimport.go for a concrete implementation of this.
type ImageImportValidator ¶
type ImageImportValidator interface {
Validate(context.Context, *imgv1b1.ImageImport) error
}
ImageImportValidator is implemented in services/imageimport.go. This abstraction exists to make tests easier. It is anything capable of checking if a given ImageImport is valid (contain all needed fields and refers to a valid Image).
type ImagePusherPuller ¶
type ImagePusherPuller interface { Push(context.Context, string, string, string) error Pull(context.Context, string, string) (*os.File, func(), error) }
ImagePusherPuller is here to make tests easier. You may be looking for its concrete implementation in services/imageio.go. The goal of an ImagePusherPuller is to allow us to Push and Pull images to and from our mirror registry.
type ImageSyncer ¶
type ImageSyncer interface { Sync(context.Context, *imgv1b1.Image) error Get(context.Context, string, string) (*imgv1b1.Image, error) AddEventHandler(cache.ResourceEventHandler) }
ImageSyncer abstraction exists to make testing easier. You most likely wanna see Image struct under services/image.go for a concrete implementation of this.
type ImageValidator ¶
ImageValidator is implemented in services/image.go. Validates that provided Image contain all mandatory fields.
type Metric ¶
type Metric struct {
// contains filtered or unexported fields
}
Metric is our controller for metric requests. Spawns an http metric and exposes all metrics registered on prometheus (see infra/metrics package to see what are we monitoring).
func (*Metric) RequiresLeaderElection ¶
RequiresLeaderElection returns if this controller requires or not a leader lease to run.
type MutatingWebHook ¶
type MutatingWebHook struct {
// contains filtered or unexported fields
}
MutatingWebHook handles Mutation requests from kubernetes api, e.g. validate Image and ImageImport objects.
func NewMutatingWebHook ¶
func NewMutatingWebHook(tival ImageImportValidator, imgval ImageValidator) *MutatingWebHook
NewMutatingWebHook returns a web hook handler for kubernetes api mutation requests. This webhook validate Image and ImageImport objects when user saves them. This function will panic if certificates are not found under "olmCertDir". When deploying this operator using OLM the certificates will be automatically mounted in this location.
func (*MutatingWebHook) Name ¶
func (m *MutatingWebHook) Name() string
Name returns a name identifier for this controller.
func (*MutatingWebHook) RequiresLeaderElection ¶
func (m *MutatingWebHook) RequiresLeaderElection() bool
RequiresLeaderElection returns if this controller requires or not a leader lease to run.