rep

package module
v0.0.0-...-82c1071 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2017 License: Apache-2.0 Imports: 17 Imported by: 0

README

The Rep

Note: This repository should be imported as code.cloudfoundry.org/rep.

Vote Quimby

The Rep bids on tasks and schedules them on an associated Executor.

####Learn more about Diego and its components at diego-design-notes

Documentation

Index

Constants

View Source
const (
	LifecycleTag  = "lifecycle"
	ResultFileTag = "result-file"
	DomainTag     = "domain"

	TaskLifecycle = "task"
	LRPLifecycle  = "lrp"

	ProcessGuidTag  = "process-guid"
	InstanceGuidTag = "instance-guid"
	ProcessIndexTag = "process-index"
)
View Source
const (
	StateRoute   = "STATE"
	PerformRoute = "PERFORM"

	StopLRPInstanceRoute = "StopLRPInstance"
	CancelTaskRoute      = "CancelTask"

	Sim_ResetRoute = "RESET"

	PingRoute     = "Ping"
	EvacuateRoute = "Evacuate"
)

Variables

View Source
var (
	ErrContainerMissingTags = errors.New("container is missing tags")
	ErrInvalidProcessIndex  = errors.New("container does not have a valid process index")
)
View Source
var ErrorIncompatibleRootfs = errors.New("rootfs not found")
View Source
var RoutesInsecure = NewRoutes(false)
View Source
var RoutesSecure = NewRoutes(true)

Functions

func ActualLRPInstanceKeyFromContainer

func ActualLRPInstanceKeyFromContainer(container executor.Container, cellID string) (*models.ActualLRPInstanceKey, error)

func ActualLRPKeyFromTags

func ActualLRPKeyFromTags(tags executor.Tags) (*models.ActualLRPKey, error)

func ActualLRPNetInfoFromContainer

func ActualLRPNetInfoFromContainer(container executor.Container) (*models.ActualLRPNetInfo, error)

func BestFitFashion

func BestFitFashion(st *ScoreType)

func ConvertCachedDependencies

func ConvertCachedDependencies(modelDeps []*models.CachedDependency) []executor.CachedDependency

func ConvertCachedDependency

func ConvertCachedDependency(modelDep *models.CachedDependency) executor.CachedDependency

func ConvertPortMappings

func ConvertPortMappings(containerPorts []uint32) []executor.PortMapping

func LRPContainerGuid

func LRPContainerGuid(processGuid, instanceGuid string) string

func NewRoutes

func NewRoutes(secure bool) rata.Routes

func NewRunRequestFromDesiredLRP

func NewRunRequestFromDesiredLRP(
	containerGuid string,
	desiredLRP *models.DesiredLRP,
	lrpKey *models.ActualLRPKey,
	lrpInstanceKey *models.ActualLRPInstanceKey,
) (executor.RunRequest, error)

func NewRunRequestFromTask

func NewRunRequestFromTask(task *models.Task) (executor.RunRequest, error)

func WorstFitFashion

func WorstFitFashion(st *ScoreType)

Types

type ArbitraryRootFSProvider

type ArbitraryRootFSProvider struct{}

func (ArbitraryRootFSProvider) MarshalJSON

func (provider ArbitraryRootFSProvider) MarshalJSON() ([]byte, error)

func (ArbitraryRootFSProvider) Match

func (ArbitraryRootFSProvider) Type

type CellState

type CellState struct {
	RootFSProviders        RootFSProviders
	AvailableResources     Resources
	TotalResources         Resources
	LRPs                   []LRP
	Tasks                  []Task
	StartingContainerCount int
	Zone                   string
	Evacuating             bool
	VolumeDrivers          []string
	PlacementTags          []string
	OptionalPlacementTags  []string
}

func NewCellState

func NewCellState(
	root RootFSProviders,
	avail Resources,
	total Resources,
	lrps []LRP,
	tasks []Task,
	zone string,
	startingContainerCount int,
	isEvac bool,
	volumeDrivers []string,
	placementTags []string,
	optionalPlacementTags []string,
) CellState

func (*CellState) AddLRP

func (c *CellState) AddLRP(lrp *LRP)

func (*CellState) AddTask

func (c *CellState) AddTask(task *Task)

func (CellState) ComputeScore

func (c CellState) ComputeScore(res *Resource, startingContainerWeight float64) float64

func (*CellState) MatchPlacementTags

func (c *CellState) MatchPlacementTags(desiredPlacementTags []string) bool

func (*CellState) MatchRootFS

func (c *CellState) MatchRootFS(rootfs string) bool

func (*CellState) MatchVolumeDrivers

func (c *CellState) MatchVolumeDrivers(volumeDrivers []string) bool

func (*CellState) ResourceMatch

func (c *CellState) ResourceMatch(res *Resource) error

type Client

type Client interface {
	State(logger lager.Logger) (CellState, error)
	Perform(logger lager.Logger, work Work) (Work, error)
	StopLRPInstance(logger lager.Logger, key models.ActualLRPKey, instanceKey models.ActualLRPInstanceKey) error
	CancelTask(logger lager.Logger, taskGuid string) error
	SetStateClient(stateClient *http.Client)
	StateClientTimeout() time.Duration
}

type ClientFactory

type ClientFactory interface {
	CreateClient(address, url string) (Client, error)
}

func NewClientFactory

func NewClientFactory(httpClient, stateClient *http.Client, tlsConfig *TLSConfig) (ClientFactory, error)

type FixedSetRootFSProvider

type FixedSetRootFSProvider struct {
	FixedSet StringSet
}

func NewFixedSetRootFSProvider

func NewFixedSetRootFSProvider(rootfses ...string) FixedSetRootFSProvider

func (FixedSetRootFSProvider) MarshalJSON

func (provider FixedSetRootFSProvider) MarshalJSON() ([]byte, error)

func (FixedSetRootFSProvider) Match

func (provider FixedSetRootFSProvider) Match(rootfs url.URL) bool

func (FixedSetRootFSProvider) Type

func (*FixedSetRootFSProvider) UnmarshalJSON

func (provider *FixedSetRootFSProvider) UnmarshalJSON(payload []byte) error

type InsufficientResourcesError

type InsufficientResourcesError struct {
	Problems map[string]struct{}
}

func (InsufficientResourcesError) Error

type LRP

func NewLRP

func NewLRP(key models.ActualLRPKey, res Resource, pc PlacementConstraint) LRP

func (*LRP) Copy

func (lrp *LRP) Copy() LRP

func (*LRP) Identifier

func (lrp *LRP) Identifier() string

type PlacementConstraint

type PlacementConstraint struct {
	PlacementTags []string
	VolumeDrivers []string
	RootFs        string
}

func NewPlacementConstraint

func NewPlacementConstraint(rootFs string, placementTags, volumeDrivers []string) PlacementConstraint

func (*PlacementConstraint) Valid

func (p *PlacementConstraint) Valid() bool

type Resource

type Resource struct {
	MemoryMB int32
	DiskMB   int32
	MaxPids  int32
}

func NewResource

func NewResource(memoryMb, diskMb int32, maxPids int32) Resource

func (*Resource) Copy

func (r *Resource) Copy() Resource

func (*Resource) Valid

func (r *Resource) Valid() bool

type Resources

type Resources struct {
	MemoryMB   int32
	DiskMB     int32
	Containers int
}

func NewResources

func NewResources(memoryMb, diskMb int32, containerCount int) Resources

func (*Resources) ComputeScore

func (r *Resources) ComputeScore(total *Resources) float64

func (*Resources) Copy

func (r *Resources) Copy() Resources

func (*Resources) Subtract

func (r *Resources) Subtract(res *Resource)

type RootFSProvider

type RootFSProvider interface {
	Type() RootFSProviderType
	Match(url.URL) bool
}

type RootFSProviderType

type RootFSProviderType string
const (
	RootFSProviderTypeArbitrary RootFSProviderType = "arbitrary"
	RootFSProviderTypeFixedSet  RootFSProviderType = "fixed_set"
)

type RootFSProviders

type RootFSProviders map[string]RootFSProvider

func (RootFSProviders) Copy

func (RootFSProviders) Match

func (p RootFSProviders) Match(rootFS url.URL) bool

func (*RootFSProviders) UnmarshalJSON

func (providers *RootFSProviders) UnmarshalJSON(payload []byte) error

type ScoreFunc

type ScoreFunc func(*CellState, *Resource, float64) float64

type ScoreType

type ScoreType struct {
	Compute ScoreFunc
}

func NewScoreType

func NewScoreType(f ScoreTypeFunc) *ScoreType

type ScoreTypeFunc

type ScoreTypeFunc func(*ScoreType)

type SimClient

type SimClient interface {
	Client
	Reset() error
}

type StackPathMap

type StackPathMap map[string]string

func UnmarshalStackPathMap

func UnmarshalStackPathMap(payload []byte) (StackPathMap, error)

type StringSet

type StringSet map[string]struct{}

func NewStringSet

func NewStringSet(entries ...string) StringSet

func (StringSet) Contains

func (set StringSet) Contains(candidate string) bool

type TLSConfig

type TLSConfig struct {
	RequireTLS                    bool
	CertFile, KeyFile, CaCertFile string
	ClientCacheSize               int // the tls client cache size, 0 means use golang default value
}

capture the behavior described in the comment of this story https://www.pivotaltracker.com/story/show/130664747/comments/152863773

type Task

type Task struct {
	TaskGuid string
	Domain   string
	PlacementConstraint
	Resource
}

func NewTask

func NewTask(guid string, domain string, res Resource, pc PlacementConstraint) Task

func (Task) Copy

func (task Task) Copy() Task

func (*Task) Identifier

func (task *Task) Identifier() string

type Work

type Work struct {
	LRPs  []LRP
	Tasks []Task
}

Directories

Path Synopsis
auctioncellrepfakes
This file was generated by counterfeiter
This file was generated by counterfeiter
cmd
rep command
evacuation_context/fake_evacuation_context
This file was generated by counterfeiter
This file was generated by counterfeiter
generator creates operations for container processing
generator creates operations for container processing
fake_generator
This file was generated by counterfeiter
This file was generated by counterfeiter
internal/fake_internal
This file was generated by counterfeiter
This file was generated by counterfeiter
maintainfakes
This file was generated by counterfeiter
This file was generated by counterfeiter
This file was generated by counterfeiter
This file was generated by counterfeiter

Jump to

Keyboard shortcuts

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