strategy

package
v0.0.0-...-6877637 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: Apache-2.0 Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type External

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

External is a strategy that schedules a ProwJob on a specific cluster based on the response of the ProwJob's Job name to given URL

func NewExternal

func NewExternal(cfg config.ExternalScheduling, log *logrus.Entry) *External

NewExternal creates a new External instance with caching

func (*External) Schedule

func (e *External) Schedule(_ context.Context, pj *prowv1.ProwJob) (Result, error)

Schedule checks the cache for a valid response or queries the REST API if the cache is stale

type Failover

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

Failover is a scheduling strategy that handles clusters known to be in a faulty state. It holds a list of mapping from a broken cluster to an healthy one. This strategy get the cluster from a ProwJob and replaces it with another one if it was found on the mapping list.

func NewFailover

func NewFailover(cfg config.FailoverScheduling) *Failover

func (*Failover) Schedule

func (f *Failover) Schedule(_ context.Context, pj *prowv1.ProwJob) (Result, error)

type Interface

type Interface interface {
	Schedule(context.Context, *prowv1.ProwJob) (Result, error)
}

Interface is an interface over scheduling strategies

func Get

func Get(cfg *config.Config, log *logrus.Entry) Interface

Get gets a scheduling strategy in accordance to configuration. It defaults to Passthrough strategy if none has been configured.

type Passthrough

type Passthrough struct {
}

Passthrough is the backward compatible, transparent scheduling strategy, and in fact it pretends a scheduler didn't exist at all. This strategy assumes a cluster has been assigned to a ProwJob at the time it was defined.

func (*Passthrough) Schedule

func (p *Passthrough) Schedule(_ context.Context, pj *prowv1.ProwJob) (Result, error)

type Result

type Result struct {
	// A candidate cluster, the chosen one
	Cluster string
}

Result is an answer that came out of a scheduling strategy

type SchedulingRequest

type SchedulingRequest struct {
	Job string `json:"job"`
}

SchedulingRequest represents the incoming request structure

type SchedulingResponse

type SchedulingResponse struct {
	Cluster string `json:"cluster"`
}

SchedulingResponse represents the response structure

Jump to

Keyboard shortcuts

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