Documentation ¶
Index ¶
- func InvalidNode(n *api.Node) bool
- func IsGlobalService(service *api.Service) bool
- func IsReplicatedService(service *api.Service) bool
- func IsTaskDirty(s *api.Service, t *api.Task, n *api.Node) bool
- func IsTaskDirtyPlacementConstraintsOnly(serviceTaskSpec api.TaskSpec, t *api.Task) bool
- func NewTask(cluster *api.Cluster, service *api.Service, slot uint64, nodeID string) *api.Task
- func RestartCondition(task *api.Task) api.RestartPolicy_RestartCondition
- func SetServiceTasksRemove(ctx context.Context, s *store.MemoryStore, service *api.Service)
- type Slot
- type SlotTuple
- type TasksByTimestamp
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InvalidNode ¶
InvalidNode is true if the node is nil, down, or drained
func IsGlobalService ¶
IsGlobalService checks if the service is a global service.
func IsReplicatedService ¶
IsReplicatedService checks if a service is a replicated service.
func IsTaskDirty ¶
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 ¶
IsTaskDirtyPlacementConstraintsOnly checks if the Placement field alone in the spec has changed.
func RestartCondition ¶
func RestartCondition(task *api.Task) api.RestartPolicy_RestartCondition
RestartCondition returns the restart condition to apply to this task.
func SetServiceTasksRemove ¶
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 ¶
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 ¶
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.