controllers

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2021 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Deployment

type Deployment struct {
	// contains filtered or unexported fields
}

Deployment controller handles events related to deployment creations.

func NewDeployment

func NewDeployment(depsvc DeploymentSyncer) *Deployment

NewDeployment returns a new controller for Deployments. This controller keeps track of deployments being created and assure that they contain the right annotations if they leverage tags.

func (*Deployment) Name

func (d *Deployment) Name() string

Name returns a name identifier for this controller.

func (*Deployment) Start

func (d *Deployment) Start(ctx context.Context) error

Start starts the controller's event loop.

type DeploymentSyncer

type DeploymentSyncer interface {
	Sync(context.Context, *appsv1.Deployment) error
	Get(context.Context, string, string) (*appsv1.Deployment, error)
	AddEventHandler(cache.ResourceEventHandler)
}

DeploymentSyncer abstraction exists to make testing easier. You most likely wanna see Deployment struct under services/deployment.go for a concrete implementation of this.

type DockerRequestPayload

type DockerRequestPayload struct {
	PushData struct {
		Tag string `json:"tag"`
	} `json:"push_data"`
	Repository struct {
		Namespace string `json:"namespace"`
		Name      string `json:"name"`
	} `json:"repository"`
}

DockerRequestPayload is sent by docker hub whenever a new push happen to a repository.

type DockerWebHook

type DockerWebHook struct {
	// contains filtered or unexported fields
}

DockerWebHook handles docker.io requests.

func NewDockerWebHook

func NewDockerWebHook(tagsvc TagGenerationUpdater) *DockerWebHook

NewDockerWebHook returns a web hook handler for docker.io webhooks.

func (*DockerWebHook) Name

func (d *DockerWebHook) Name() string

Name returns a name identifier for this controller.

func (*DockerWebHook) ServeHTTP

func (d *DockerWebHook) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP handles requests coming in from docker.io.

func (*DockerWebHook) Start

func (d *DockerWebHook) Start(ctx context.Context) error

Start puts the http server online.

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.

func NewMetric

func NewMetric() *Metric

NewMetric returns a new metric controller.

func (*Metric) Name

func (m *Metric) Name() string

Name returns a name identifier for this controller.

func (*Metric) Start

func (m *Metric) Start(ctx context.Context) error

Start puts the metrics http server online.

type MetricReporter

type MetricReporter interface {
	ReportWorker(bool)
}

MetricReporter abstraction exists to make tests easier. You might be looking for its concrete implementation on services/metrics.go.

type MutatingWebHook

type MutatingWebHook struct {
	// contains filtered or unexported fields
}

MutatingWebHook handles Mutation requests from kubernetes api.

func NewMutatingWebHook

func NewMutatingWebHook(tagsvc PodPatcher) *MutatingWebHook

NewMutatingWebHook returns a web hook handler for kubernetes api mutation requests.

func (*MutatingWebHook) Name

func (m *MutatingWebHook) Name() string

Name returns a name identifier for this controller.

func (*MutatingWebHook) Start

func (m *MutatingWebHook) Start(ctx context.Context) error

Start puts the http server online. Requests for resources related to deploys (Deployments and Pods) are set to deploy() handler while image tag resources are managed by tag() handler.

type PodPatcher

type PodPatcher interface {
	PatchForPod(pod corev1.Pod) ([]jsonpatch.JsonPatchOperation, error)
}

PodPatcher creates a patch for a pod resource, possibly overwritting tag references by their concrete location. You might want to look at the concrete implementation of this at services/tag.go.

type QuayRequestPayload

type QuayRequestPayload struct {
	Name        string   `json:"name"`
	Repository  string   `json:"repository"`
	Namespace   string   `json:"namespace"`
	DockerURL   string   `json:"docker_url"`
	HomePage    string   `json:"homepage"`
	UpdatedTags []string `json:"updated_tags"`
}

QuayRequestPayload holds the information sent by remote quay.io servers when a new push has happened to one of images.

type QuayWebHook

type QuayWebHook struct {
	// contains filtered or unexported fields
}

QuayWebHook handles quay.io requests.

func NewQuayWebHook

func NewQuayWebHook(tagsvc TagGenerationUpdater) *QuayWebHook

NewQuayWebHook returns a web hook handler for quay webhooks.

func (*QuayWebHook) Name

func (q *QuayWebHook) Name() string

Name returns a name identifier for this controller.

func (*QuayWebHook) ServeHTTP

func (q *QuayWebHook) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP handles requests coming in from quay.io.

func (*QuayWebHook) Start

func (q *QuayWebHook) Start(ctx context.Context) error

Start puts the http server online.

type Tag

type Tag struct {
	// contains filtered or unexported fields
}

Tag controller handles events related to Tags. It starts and receives events from the informer, calling appropriate functions on our concrete services layer implementation.

func NewTag

func NewTag(
	tagsvc TagSyncer,
	mtrsvc MetricReporter,
) *Tag

NewTag returns a new controller for Image Tags. This controller runs image tag imports in parallel, at a given time we can have at max "workers" distinct image tags being processed.

func (*Tag) Name

func (t *Tag) Name() string

Name returns a name identifier for this controller.

func (*Tag) Start

func (t *Tag) Start(ctx context.Context) error

Start starts the controller's event loop.

type TagGenerationUpdater

type TagGenerationUpdater interface {
	NewGenerationForImageRef(context.Context, string) error
}

TagGenerationUpdater exists to make tests easier. You may be wondering where this is implemented. Please see Tag struct in services/tag.go for a concrete implementation.

type TagSyncer

type TagSyncer interface {
	Sync(context.Context, *imagtagv1.Tag) error
	Get(context.Context, string, string) (*imagtagv1.Tag, error)
	AddEventHandler(cache.ResourceEventHandler)
}

TagSyncer abstraction exists to make testing easier. You most likely wanna see Tag struct under services/tag.go for a concrete implementation of this.

Jump to

Keyboard shortcuts

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