pod

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: Apache-2.0 Imports: 21 Imported by: 4

Documentation

Index

Constants

View Source
const (
	OUTPUT_DELIMITER        = ","
	PORT_SEPARATOR          = ":"
	PRIM_INSPECT_RESULT_LEN = 7
	INSPECT_RESULT_LEN      = 6
)

Variables

View Source
var ComposeExecutorDriver executor.ExecutorDriver
View Source
var ComposeFiles []string
View Source
var ComposeTaskInfo *mesos.TaskInfo
View Source
var CurPodStatus = &Status{
	Status: types.POD_STAGING,
}
View Source
var HealthCheckListId = make(map[string]bool)
View Source
var LaunchCmdAttempted = false

LaunchCmdAttempted indicates that an attempt to run the command to launch the pod (docker compose up with params) was made. This does not indicate that the result of the command execution.

View Source
var MonitorContainerList []types.SvcContainer
View Source
var PluginOrder []string
View Source
var ServiceDetail = make(map[string]map[string]interface{})

store all docker-composed yaml file, key is filepath, value is the yaml unmarshelled object

View Source
var SinglePort bool
View Source
var StepMetrics = make(map[string][]*types.StepData)

Functions

func CheckContainer

func CheckContainer(containerId string, healthCheck bool) (types.HealthStatus, bool, int, error)

CheckContainer does check container details return healthy,run,err

func CheckPodExitCode

func CheckPodExitCode(files []string) (int, error)

Check exit code of all the containers in the pod. If all the exit codes are zero, then assign zero as pod's exit code, otherwise assign the first non zero exit code to pod

func CopySvcContainers added in v0.12.1

func CopySvcContainers(to []types.SvcContainer, from []types.SvcContainer) []types.SvcContainer

func DockerDump

func DockerDump()

DockerDump does dump docker.pid and docker-containerd.pid and docker log if docker dump is enabled in config

func EndStep

func EndStep(stepData map[string][]*types.StepData, stepName string, tag map[string]string, err error)

EndStep ends the current dce step, and update the result, duraiton. current dce step can be fetch from stepData, key is the stepName, value is each retry results. Update the latest result

func ForceKill

func ForceKill() error

Force kill pod docker kill -f

func GenerateCmdParts

func GenerateCmdParts(files []string, cmd string) ([]string, error)

Generate cmd parts docker-compose parts example : docker-compose -f compose.yaml up "docker-compose" will be the main cmd, "-f compose.yaml up" will be parts and return as an array

func GetAndRemoveLabel

func GetAndRemoveLabel(key string, taskInfo *mesos.TaskInfo) string

GetAndRemoveLabel will fetch the value for the key and removes it from the list

func GetContainerIdByService

func GetContainerIdByService(files []string, service string) (string, error)

GetContainerIdByService does query container id by service name

func GetContainerNetwork

func GetContainerNetwork(id string) (string, error)

func GetContainerPid added in v0.12.0

func GetContainerPid(containerID string) (string, error)

func GetDockerPorts

func GetDockerPorts(containerId string, privatePort string) (string, error)

func GetLabel

func GetLabel(key string, taskInfo *mesos.TaskInfo) string

GetLabel checks if the whole key is the suffix of a label and fetches the value of that label

func GetPodContainerIds

func GetPodContainerIds(files []string) ([]string, error)

Get set of containers id in pod docker-compose -f docker-compose.yaml ps -q

func GetPodDetail

func GetPodDetail(files []string, primaryContainerId string, healthcheck bool)

docker-compose -f docker-compose.yaml ps

func GetPodStatus

func GetPodStatus() types.PodStatus

Read pod status

func GetPorts

func GetPorts(taskInfo *mesos.TaskInfo) *list.Element

Get port range assigned by mesos

func GetServiceContainers added in v0.8.1

func GetServiceContainers(files, services []string) ([]types.SvcContainer, error)

GetServiceContainers get list of (service, container_id) pair by a list of services

func GetServiceDetail

func GetServiceDetail() types.ServiceDetail

func HealthCheck

func HealthCheck(files []string, podServices map[string]bool, out chan<- string)

healthCheck includes health checking for primary container and exit code checking for other containers

func InspectContainerDetails

func InspectContainerDetails(containerId string, healthcheck bool) (types.ContainerStatusDetails, error)

docker inspect

func IsService

func IsService(taskInfo *mesos.TaskInfo) bool

func KillContainer

func KillContainer(sig string, svcContainer types.SvcContainer) error

func LaunchPod

func LaunchPod(files []string) (types.PodStatus, error)

Launch pod docker-compose up

func ListenOnTaskStatus

func ListenOnTaskStatus(driver executor.ExecutorDriver, taskInfo *mesos.TaskInfo)

ListenOnTaskStatus listens

func ParseToContainerDetail

func ParseToContainerDetail(output string, healthcheck bool) (types.ContainerStatusDetails, error)

func PluginPanicHandler

func PluginPanicHandler(condition ConditionFunc) (res string, err error)

func PrintInspectDetail

func PrintInspectDetail(containerId string) error

get docker health check logs

func PullImage

func PullImage(files []string) error

pull image docker-compose pull

func RemoveNetwork

func RemoveNetwork(name string) error

func RemovePodImage

func RemovePodImage(files []string) error

remove pod images docker-compose down --rmi

func RemovePodVolume

func RemovePodVolume(files []string) error

remove pod volume docker-compose down -v

func SendMesosStatus

func SendMesosStatus(ctx context.Context, driver executor.ExecutorDriver, taskId *mesos.TaskID, state *mesos.TaskState) error

Update mesos and pod status

func SendPodStatus

func SendPodStatus(ctx context.Context, status types.PodStatus)

func SetPodStatus

func SetPodStatus(status types.PodStatus)

Set pod status

func SetServiceDetail

func SetServiceDetail(sd types.ServiceDetail)

func StartStep

func StartStep(stepData map[string][]*types.StepData, stepName string)

StartStep start a step of dce, and add a new item into the values, key is the stepName In the map, key will be step, value will be each retry result, and duration.

func StopPod

func StopPod(ctx context.Context, files []string) error

Stop pod docker-compose stop

func TaskInfoInitPodStatusHooks added in v0.11.2

func TaskInfoInitPodStatusHooks(ctx context.Context, taskInfo *mesos.TaskInfo) error

TaskInfoInitPodStatusHooks finds the hooks (implementations of ExecutorHook interface) configured for executor phase and init them error is returned if any of the hooks failed, and ExecutorHook.BestEffort() returns true

func ToHealthStatus

func ToHealthStatus(s string) types.HealthStatus

func ToPodStatus

func ToPodStatus(s string) types.PodStatus

func UpdateHealthCheckStatus added in v0.11.2

func UpdateHealthCheckStatus(stepData map[string][]*types.StepData)

func ValidateCompose

func ValidateCompose(files []string) error

validate compose before image pull

func WaitOnPod

func WaitOnPod(ctx context.Context)

Wait for pod running/finished until timeout or failed

Types

type ConditionFunc

type ConditionFunc func() (string, error)

type Status

type Status struct {
	sync.RWMutex
	Status types.PodStatus
	// if set to true, indicates that the pod was launched successfully and task moved to RUNNING state
	Launched bool
}

type TaskStatus

type TaskStatus struct {
	Ctx    context.Context
	Status string
}

Jump to

Keyboard shortcuts

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