subscriber

package
v0.0.0-...-ce3d181 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KubeClientInterface

type KubeClientInterface interface {
	CreateProwJob(job *kube.ProwJob) (*kube.ProwJob, error)
}

KubeClientInterface mostly for testing.

type Metrics

type Metrics struct {
	// Common
	MessageCounter *prometheus.CounterVec
	ErrorCounter   *prometheus.CounterVec

	// Pull Server
	ACKMessageCounter  *prometheus.CounterVec
	NACKMessageCounter *prometheus.CounterVec

	// Push Server
	ResponseCounter *prometheus.CounterVec
}

func NewMetrics

func NewMetrics() *Metrics

type PeriodicProwJobEvent

type PeriodicProwJobEvent struct {
	Name        string            `json:"name"`
	Type        string            `json:"type"`
	Envs        map[string]string `json:"envs,omitempty"`
	Annotations map[string]string `json:"annotations,omitempty"`
}

PeriodicProwJobEvent contains the minimum information required to start a ProwJob.

func (*PeriodicProwJobEvent) FromPayload

func (pe *PeriodicProwJobEvent) FromPayload(data []byte) error

FromPayload set the PeriodicProwJobEvent from the PubSub message payload.

func (*PeriodicProwJobEvent) ToMessage

func (pe *PeriodicProwJobEvent) ToMessage() (*pubsub.Message, error)

ToMessage generates a PubSub Message from a PeriodicProwJobEvent.

type PullServer

type PullServer struct {
	Subscriber *Subscriber
	Client     pubsubClientInterface
}

PullServer listen to Pull Pub/Sub subscriptions and handle them.

func NewPullServer

func NewPullServer(s *Subscriber) *PullServer

NewPullServer creates a new PullServer

func (*PullServer) Run

func (s *PullServer) Run(ctx context.Context) error

Run will block listening to all subscriptions and return once the context is cancelled or one of the subscription has a unrecoverable error.

type PushServer

type PushServer struct {
	Subscriber     *Subscriber
	TokenGenerator func() []byte
}

PushServer implements http.Handler. It validates incoming Pub/Sub subscriptions handle them.

func (*PushServer) ServeHTTP

func (s *PushServer) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP validates an incoming Push Pub/Sub subscription and handle them.

type Subscriber

type Subscriber struct {
	ConfigAgent *config.Agent
	Metrics     *Metrics
	KubeClient  KubeClientInterface
}

Subscriber handles Pub/Sub subscriptions, update metrics, validates them using Prow Configuration and use a KubeClientInterface to create Prow Jobs.

Jump to

Keyboard shortcuts

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