orchestrator

package
v0.0.0-...-35d28e4 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InvalidNode

func InvalidNode(n *api.Node) bool

InvalidNode is true if the node is nil, down, or drained

func IsGlobalService

func IsGlobalService(service *api.Service) bool

IsGlobalService checks if the service is a global service.

func IsReplicatedService

func IsReplicatedService(service *api.Service) bool

IsReplicatedService checks if a service is a replicated service.

func IsTaskDirty

func IsTaskDirty(s *api.Service, t *api.Task, n *api.Node) bool

IsTaskDirty determines whether a task matches the given service's spec and if the given node satisfies the placement constraints. Returns false if the spec version didn't change, only the task placement constraints changed and the assigned node satisfies the new constraints, or the service task spec and the endpoint spec didn't change at all. Returns true otherwise. Note: for non-failed tasks with a container spec runtime that have already pulled the required image (i.e., current state is between READY and RUNNING inclusively), the value of the `PullOptions` is ignored.

func IsTaskDirtyPlacementConstraintsOnly

func IsTaskDirtyPlacementConstraintsOnly(serviceTaskSpec api.TaskSpec, t *api.Task) bool

IsTaskDirtyPlacementConstraintsOnly checks if the Placement field alone in the spec has changed.

func NewTask

func NewTask(cluster *api.Cluster, service *api.Service, slot uint64, nodeID string) *api.Task

NewTask creates a new task.

func RestartCondition

func RestartCondition(task *api.Task) api.RestartPolicy_RestartCondition

RestartCondition returns the restart condition to apply to this task.

func SetServiceTasksRemove

func SetServiceTasksRemove(ctx context.Context, s *store.MemoryStore, service *api.Service)

SetServiceTasksRemove sets the desired state of tasks associated with a service to REMOVE, so that they can be properly shut down by the agent and later removed by the task reaper.

Types

type Slot

type Slot []*api.Task

Slot is a list of the running tasks occupying a certain slot. Generally this will only be one task, but some rolling update situations involve temporarily having two running tasks in the same slot. Note that this use of "slot" is more generic than the Slot number for replicated services - a node is also considered a slot for global services.

type SlotTuple

type SlotTuple struct {
	Slot      uint64 // unset for global service tasks
	ServiceID string
	NodeID    string // unset for replicated service tasks
}

SlotTuple identifies a unique slot, in the broad sense described above. It's a combination of either a service ID and a slot number (replicated services), or a service ID and a node ID (global services).

type TasksByTimestamp

type TasksByTimestamp []*api.Task

TasksByTimestamp sorts tasks by applied timestamp if available, otherwise status timestamp.

func (TasksByTimestamp) Len

func (t TasksByTimestamp) Len() int

Len implements the Len method for sorting.

func (TasksByTimestamp) Less

func (t TasksByTimestamp) Less(i, j int) bool

Less implements the Less method for sorting.

func (TasksByTimestamp) Swap

func (t TasksByTimestamp) Swap(i, j int)

Swap implements the Swap method for sorting.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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