Documentation ¶
Index ¶
- Constants
- Variables
- func ActualLRPInstanceKeyFromContainer(container executor.Container, cellID string) (*models.ActualLRPInstanceKey, error)
- func ActualLRPKeyFromTags(tags executor.Tags) (*models.ActualLRPKey, error)
- func ActualLRPNetInfoFromContainer(container executor.Container) (*models.ActualLRPNetInfo, error)
- func ConvertCachedDependencies(modelDeps []*models.CachedDependency) []executor.CachedDependency
- func ConvertCachedDependency(modelDep *models.CachedDependency) executor.CachedDependency
- func ConvertPortMappings(containerPorts []uint32) []executor.PortMapping
- func ConvertPreloadedRootFS(rootFS string, imageLayers []*models.ImageLayer, layeringMode string) (string, []*models.ImageLayer)
- func LRPContainerGuid(processGuid, instanceGuid string) string
- func NewRoutes(networkAccessible bool) rata.Routes
- type ArbitraryRootFSProvider
- type CellState
- func (c *CellState) AddLRP(lrp *LRP)
- func (c *CellState) AddTask(task *Task)
- func (c CellState) ComputeScore(res *Resource, startingContainerWeight float64) float64
- func (c *CellState) MatchPlacementTags(desiredPlacementTags []string) bool
- func (c *CellState) MatchRootFS(rootfs string) bool
- func (c *CellState) MatchVolumeDrivers(volumeDrivers []string) bool
- func (c *CellState) ResourceMatch(res *Resource) error
- type Client
- type ClientFactory
- type ContainerMetricsCollection
- type ContainerMetricsProvider
- type FixedSetRootFSProvider
- type InsufficientResourcesError
- type LRP
- type LRPMetric
- type LRPUpdate
- type PlacementConstraint
- type Resource
- type Resources
- type RootFSProvider
- type RootFSProviderType
- type RootFSProviders
- type RunRequestConversionHelper
- func (rrch RunRequestConversionHelper) NewRunRequestFromDesiredLRP(containerGuid string, desiredLRP *models.DesiredLRP, ...) (executor.RunRequest, error)
- func (rrch RunRequestConversionHelper) NewRunRequestFromTask(task *models.Task, stackPathMap StackPathMap, layeringMode string) (executor.RunRequest, error)
- type SimClient
- type StackPathMap
- type StringSet
- type TLSConfig
- type Task
- type TaskMetric
- type Work
Constants ¶
const ( LifecycleTag = "lifecycle" ResultFileTag = "result-file" DomainTag = "domain" TaskLifecycle = "task" LRPLifecycle = "lrp" ProcessGuidTag = "process-guid" InstanceGuidTag = "instance-guid" ProcessIndexTag = "process-index" VolumeDriversTag = "volume-drivers" PlacementTagsTag = "placement-tags" )
const ( LayeringModeSingleLayer = "single-layer" LayeringModeTwoLayer = "two-layer" )
const ( StateRoute = "STATE" ContainerMetricsRoute = "ContainerMetrics" PerformRoute = "PERFORM" UpdateLRPInstanceRoute = "UpdateLRPInstance" UpdateLRPInstanceRoute_r0 = "UpdateLRPInstance_r0" StopLRPInstanceRoute = "StopLRPInstance" CancelTaskRoute = "CancelTask" SimResetRoute = "RESET" PingRoute = "Ping" EvacuateRoute = "Evacuate" )
Variables ¶
var ( ErrContainerMissingTags = errors.New("container is missing tags") ErrInvalidProcessIndex = errors.New("container does not have a valid process index") ErrIntergerOverflow = errors.New("integer overflow") )
var ErrPreloadedRootFSNotFound = errors.New("preloaded rootfs path not found")
ErrPreloadedRootFSNotFound is returned when the given hostname of the rootFS could not be resolved if the scheme is the PreloadedRootFSScheme or the PreloadedOCIRootFSScheme. This isn't the error for when the actual path on the system could not be found.
var ErrorIncompatibleRootfs = errors.New("rootfs not found")
var Routes = append(RoutesLocalhostOnly, RoutesNetworkAccessible...)
var RoutesLocalhostOnly = NewRoutes(false)
var RoutesNetworkAccessible = NewRoutes(true)
Functions ¶
func ActualLRPKeyFromTags ¶
func ActualLRPKeyFromTags(tags executor.Tags) (*models.ActualLRPKey, error)
func ActualLRPNetInfoFromContainer ¶
func ActualLRPNetInfoFromContainer(container executor.Container) (*models.ActualLRPNetInfo, error)
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 ConvertPreloadedRootFS ¶
func ConvertPreloadedRootFS(rootFS string, imageLayers []*models.ImageLayer, layeringMode string) (string, []*models.ImageLayer)
ConvertPreloadedRootFS takes in a rootFS URL and a list of image layers and in most cases just returns the same rootFS URL and list of image layers.
In the case where all of the following are true:
- layeringMode == LayeringModeTwoLayer
- the rootfs URL has a `preloaded` scheme
- the list of image layers contains at least one image layer that has an `exclusive` layer type, `tgz` media type, and a `sha256` digest algorithm.
then the rootfs URL will be converted to have a `preloaded+layer` scheme and a query string that references the first image layer that matches all of those restrictions. This image layer will also be removed from the list.
func LRPContainerGuid ¶
Types ¶
type ArbitraryRootFSProvider ¶
type ArbitraryRootFSProvider struct{}
func (ArbitraryRootFSProvider) MarshalJSON ¶
func (provider ArbitraryRootFSProvider) MarshalJSON() ([]byte, error)
func (ArbitraryRootFSProvider) Type ¶
func (ArbitraryRootFSProvider) Type() RootFSProviderType
type CellState ¶
type CellState struct { RepURL string `json:"rep_url"` CellID string `json:"cell_id"` CellIndex int `json:"cell_index"` RootFSProviders RootFSProviders AvailableResources Resources TotalResources Resources LRPs []LRP Tasks []Task StartingContainerCount int Zone string Evacuating bool VolumeDrivers []string PlacementTags []string OptionalPlacementTags []string ProxyMemoryAllocationMB int }
func NewCellState ¶
func NewCellState( cellID string, cellIndex int, repURL string, root RootFSProviders, avail Resources, total Resources, lrps []LRP, tasks []Task, zone string, startingContainerCount int, isEvac bool, volumeDrivers []string, placementTags []string, optionalPlacementTags []string, proxyMemoryAllocation int, ) CellState
func (CellState) ComputeScore ¶
func (*CellState) MatchPlacementTags ¶
func (*CellState) MatchRootFS ¶
func (*CellState) MatchVolumeDrivers ¶
func (*CellState) ResourceMatch ¶
type Client ¶
type Client interface { State(logger lager.Logger) (CellState, error) Perform(logger lager.Logger, work Work) (Work, error) UpdateLRPInstance(logger lager.Logger, update LRPUpdate) 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 ¶
func NewClientFactory ¶
func NewClientFactory(httpClient, stateClient *http.Client, tlsConfig *TLSConfig) (ClientFactory, error)
type ContainerMetricsCollection ¶
type ContainerMetricsCollection struct { CellID string `json:"cell_id"` LRPs []LRPMetric `json:"lrps"` Tasks []TaskMetric `json:"tasks"` }
type ContainerMetricsProvider ¶
type ContainerMetricsProvider interface {
Metrics() map[string]*containermetrics.CachedContainerMetrics
}
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) Type() RootFSProviderType
func (*FixedSetRootFSProvider) UnmarshalJSON ¶
func (provider *FixedSetRootFSProvider) UnmarshalJSON(payload []byte) error
type InsufficientResourcesError ¶
type InsufficientResourcesError struct {
Problems map[string]struct{}
}
func (InsufficientResourcesError) Error ¶
func (i InsufficientResourcesError) Error() string
type LRP ¶
type LRP struct { InstanceGUID string `json:"instance_guid"` models.ActualLRPKey PlacementConstraint Resource State string `json:"state"` }
func NewLRP ¶
func NewLRP(instanceGUID string, key models.ActualLRPKey, res Resource, pc PlacementConstraint) LRP
func (*LRP) Identifier ¶
type LRPMetric ¶
type LRPMetric struct { InstanceGUID string `json:"instance_guid"` ProcessGUID string `json:"process_guid"` Index int32 `json:"index"` containermetrics.CachedContainerMetrics }
type LRPUpdate ¶
type LRPUpdate struct { InstanceGUID string `json:"instance_guid"` models.ActualLRPKey InternalRoutes internalroutes.InternalRoutes `json:"internal_routes"` MetricTags map[string]string `json:"metric_tags"` }
func NewLRPUpdate ¶
func NewLRPUpdate(instanceGUID string, key models.ActualLRPKey, internalRoutes internalroutes.InternalRoutes, metricTags map[string]string) LRPUpdate
type PlacementConstraint ¶
func NewPlacementConstraint ¶
func NewPlacementConstraint(rootFs string, placementTags, volumeDrivers []string) PlacementConstraint
func (*PlacementConstraint) Valid ¶
func (p *PlacementConstraint) Valid() bool
type Resource ¶
func NewResource ¶
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 (p RootFSProviders) Copy() RootFSProviders
func (*RootFSProviders) UnmarshalJSON ¶
func (providers *RootFSProviders) UnmarshalJSON(payload []byte) error
type RunRequestConversionHelper ¶
func (RunRequestConversionHelper) NewRunRequestFromDesiredLRP ¶
func (rrch RunRequestConversionHelper) NewRunRequestFromDesiredLRP( containerGuid string, desiredLRP *models.DesiredLRP, lrpKey *models.ActualLRPKey, lrpInstanceKey *models.ActualLRPInstanceKey, stackPathMap StackPathMap, layeringMode string, ) (executor.RunRequest, error)
func (RunRequestConversionHelper) NewRunRequestFromTask ¶
func (rrch RunRequestConversionHelper) NewRunRequestFromTask(task *models.Task, stackPathMap StackPathMap, layeringMode string) (executor.RunRequest, error)
type StackPathMap ¶
StackPathMap maps aliases to rootFS paths on the system.
func (StackPathMap) PathForRootFS ¶
func (m StackPathMap) PathForRootFS(rootFS string) (string, error)
PathForRootFS resolves the hostname portion of the RootFS URL to the actual path to the preloaded rootFS on the system according to the StackPathMap
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 State models.Task_State `json:"state"` Failed bool `json:"failed"` }
func (*Task) Identifier ¶
type TaskMetric ¶
type TaskMetric struct { TaskGUID string `json:"task_guid"` containermetrics.CachedContainerMetrics }
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
auctioncellrepfakes
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
cmd
|
|
evacuation_context/fake_evacuation_context
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
generator creates operations for container processing
|
generator creates operations for container processing |
fake_generator
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
internal/fake_internal
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
handlersfakes
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
Code generated by counterfeiter.
|
Code generated by counterfeiter. |