app

package
v1.29.0-alpha.137 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2023 License: MIT Imports: 33 Imported by: 0

Documentation

Overview

Package app xxx

Index

Constants

View Source
const (
	// ContainerNamePrefix docker container name prefix
	ContainerNamePrefix = "bcs-container-"
	// ContainerCoreFilePrefix container corefile directory
	ContainerCoreFilePrefix = "/data/corefile"
	// ExecutorStatus_NOTRUNNING not running state
	ExecutorStatus_NOTRUNNING = "NotRunning"
	// ExecutorStatus_LAUNCHING launching state
	ExecutorStatus_LAUNCHING = "Launching"
	// ExecutorStatus_RUNNING running state
	ExecutorStatus_RUNNING = "Running"
	// ExecutorStatus_KILLING killing state
	ExecutorStatus_KILLING = "Killing"
	// ExecutorStatus_SHUTDOWN shutdown state
	ExecutorStatus_SHUTDOWN = "Shutdown"
)
View Source
const ContainerCheckTicker = 1

ContainerCheckTicker duration for checking Running Container Status

View Source
const (
	// DefaultCNIDirectory default cni directory
	DefaultCNIDirectory = "/data/bcs/bcs-cni"
)

Variables

This section is empty.

Functions

func NewBcsExecutor

func NewBcsExecutor(flag *CommandFlags) exec.Executor

NewBcsExecutor create Executor instance

func Run

func Run(cmd *CommandFlags) error

Run is entry point for container executor

Types

type BcsExecutor

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

BcsExecutor implement interface MesosContainerExecutor

func (*BcsExecutor) Disconnected

func (executor *BcsExecutor) Disconnected(driver exec.ExecutorDriver)

Disconnected call by ExecutorDriver if cnnection to mesos slave broken

func (*BcsExecutor) Error

func (executor *BcsExecutor) Error(driver exec.ExecutorDriver, err string)

Error Executor receiving Error message from mesos slave.

func (*BcsExecutor) FrameworkMessage

func (executor *BcsExecutor) FrameworkMessage(driver exec.ExecutorDriver, msg string)

FrameworkMessage receiving message from scheduler framework

func (*BcsExecutor) KillTask

func (executor *BcsExecutor) KillTask(driver exec.ExecutorDriver, taskID *mesos.TaskID)

KillTask kill task by taskId

func (*BcsExecutor) LaunchTask

func (executor *BcsExecutor) LaunchTask(driver exec.ExecutorDriver, taskInfo *mesos.TaskInfo)

LaunchTask launch a task, create taskgroup for this TaskInfo all launchTask request will be handled by LaunchTaskGroup

func (*BcsExecutor) LaunchTaskGroup

func (executor *BcsExecutor) LaunchTaskGroup(driver exec.ExecutorDriver, taskGroup *mesos.TaskGroupInfo)

LaunchTaskGroup Invoked when a task has been launched on this executor (initiated via SchedulerDriver.LaunchTasks). Note that this task can be realized with a goroutine, an external process, or some simple computation, however, no other callbacks will be invoked on this executor until this callback has returned.

func (*BcsExecutor) Registered

func (executor *BcsExecutor) Registered(driver exec.ExecutorDriver, execInfo *mesos.ExecutorInfo,
	fwinfo *mesos.FrameworkInfo, slaveInfo *mesos.AgentInfo)

Registered call by ExecutorDriver when receiving Subscribed from mesos slave

func (*BcsExecutor) Reregistered

func (executor *BcsExecutor) Reregistered(driver exec.ExecutorDriver, slaveInfo *mesos.AgentInfo)

Reregistered call by ExecutorDriver when receiving Subscribed from mesos slave

func (*BcsExecutor) SetDriver

func (executor *BcsExecutor) SetDriver(driver exec.ExecutorDriver)

SetDriver driver injection

func (*BcsExecutor) Shutdown

func (executor *BcsExecutor) Shutdown(driver exec.ExecutorDriver)

Shutdown Executor Shutdown & exit

func (*BcsExecutor) Stop

func (executor *BcsExecutor) Stop()

Stop send stop signal

type BcsTaskInfo

type BcsTaskInfo struct {
	ContainerRef  map[string]string                      // ContainerName to TaskID
	TaskRef       map[string]string                      // TaskID to ContainerName
	TaskInfo      map[string]*mesos.TaskInfo             // mesos task info, key is taskID
	ContainerInfo map[string]*container.BcsContainerInfo // BcsContainerInfo, key is containerName
	// contains filtered or unexported fields
}

BcsTaskInfo task info relate to Mesos TaskGroupInfo & ContainerInfo we not only can find TaskInfo by containerID, but also can find ContainerInfo by TaskID

func (*BcsTaskInfo) Clean

func (bcsTask *BcsTaskInfo) Clean()

Clean clean all data

func (*BcsTaskInfo) CleanContainer

func (bcsTask *BcsTaskInfo) CleanContainer(containerID string) (*mesos.TaskInfo, *container.BcsContainerInfo)

CleanContainer clean task & container by containerID

func (*BcsTaskInfo) CleanTask

func (bcsTask *BcsTaskInfo) CleanTask(taskID string) (*mesos.TaskInfo, *container.BcsContainerInfo)

CleanTask clean task & container by taskID

func (*BcsTaskInfo) GetAllContainerID

func (bcsTask *BcsTaskInfo) GetAllContainerID() (list []string)

GetAllContainerID return all containerID

func (*BcsTaskInfo) GetContainer

func (bcsTask *BcsTaskInfo) GetContainer(containerID string) *container.BcsContainerInfo

GetContainer get BcsContainer by containerId

func (*BcsTaskInfo) GetContainerByTaskID

func (bcsTask *BcsTaskInfo) GetContainerByTaskID(taskID string) *container.BcsContainerInfo

GetContainerByTaskID get container

func (*BcsTaskInfo) GetTask

func (bcsTask *BcsTaskInfo) GetTask(taskID string) *mesos.TaskInfo

GetTask get TaskInfo by taskId

func (*BcsTaskInfo) GetTaskByContainerID

func (bcsTask *BcsTaskInfo) GetTaskByContainerID(containerID string) *mesos.TaskInfo

GetTaskByContainerID get container

func (*BcsTaskInfo) GetTaskGroup

func (bcsTask *BcsTaskInfo) GetTaskGroup() *mesos.TaskGroupInfo

GetTaskGroup return task group

func (*BcsTaskInfo) SetContainerWithTaskID

func (bcsTask *BcsTaskInfo) SetContainerWithTaskID(taskID string, container *container.BcsContainerInfo) error

SetContainerWithTaskID setting container with taskID.

func (*BcsTaskInfo) SetTaskInfo

func (bcsTask *BcsTaskInfo) SetTaskInfo(task *mesos.TaskInfo) error

SetTaskInfo Set TaskInfo

type CommandFlags

type CommandFlags struct {
	User                string // user for authentication
	Passwd              string // password for authentication
	DockerSocket        string // docker socket path
	MappedDirectory     string // The sandbox directory path that is mapped in the docker container.
	NetworkMode         string // mode for cni/cnm
	CNIPluginDir        string // cni plugin directory, $CNIPluginDir/bin for binary, $CNIPluginDir/conf for configuration
	NetworkImage        string // cni network images
	ExtendedResourceDir string // dir for extended resources
}

CommandFlags hold all command line flags from mesos-slave

func NewCommandFlags

func NewCommandFlags() *CommandFlags

NewCommandFlags return new DockerFalgs with default value

func ParseCmdFlags

func ParseCmdFlags() *CommandFlags

ParseCmdFlags from command line input

Jump to

Keyboard shortcuts

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