common

package
v0.0.0-...-8528295 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PollRate defines maximum polling request per second towards the backend
	PollRate = 1
	// PollBurst defines maximum burst poll requests towards the backend
	PollBurst = 3
)

Variables

This section is empty.

Functions

func ContainerAttach

func ContainerAttach(cr *ContextRouter, c *gin.Context)

ContainerAttach - attach to a container to read its output or send input. https://docs.docker.com/engine/api/v1.41/#operation/ContainerAttach https://docs.podman.io/en/latest/_static/api.html?version=v4.2#tag/containers/operation/ContainerAttachLibpod POST "/containers/:id/attach" POST "/libpod/containers/:id/attach"

func ContainerExec

func ContainerExec(cr *ContextRouter, c *gin.Context)

ContainerExec - create an exec instance. https://docs.docker.com/engine/api/v1.41/#operation/ContainerExec https://docs.podman.io/en/latest/_static/api.html?version=v4.2#tag/exec/operation/ContainerExecLibpod POST "/containers/:id/exec" POST "/libpod/containers/:id/exec"

func ContainerLogs

func ContainerLogs(cr *ContextRouter, c *gin.Context)

ContainerLogs - get container logs. https://docs.docker.com/engine/api/v1.41/#operation/ContainerLogs POST "/containers/:id/logs"

func ContainerResize

func ContainerResize(cr *ContextRouter, c *gin.Context)

ContainerResize - resize the tty for a container. https://docs.docker.com/engine/api/v1.41/#operation/ContainerResize https://docs.podman.io/en/latest/_static/api.html?version=v4.2#tag/containers/operation/ContainerResizeLibpod POST "/containers/:id/rezise" POST "/libpod/containers/:id/rezise"

func ContainerRestart

func ContainerRestart(cr *ContextRouter, c *gin.Context)

ContainerRestart - restart a container. https://docs.docker.com/engine/api/v1.41/#operation/ContainerRestart https://docs.podman.io/en/latest/_static/api.html?version=v4.2#tag/containers/operation/ContainerRestartLibpod POST "/containers/:id/restart" POST "/libpod/containers/:id/restart"

func ContainerStart

func ContainerStart(cr *ContextRouter, c *gin.Context)

ContainerStart - start a container. https://docs.docker.com/engine/api/v1.41/#operation/ContainerStart https://docs.podman.io/en/latest/_static/api.html?version=v4.2#tag/containers/operation/ContainerStartLibpod POST "/containers/:id/start" POST "/libpod/containers/:id/start"

func ExecInfo

func ExecInfo(cr *ContextRouter, c *gin.Context)

ExecInfo - return low-level information about an exec instance. https://docs.docker.com/engine/api/v1.41/#operation/ExecInspect https://docs.podman.io/en/latest/_static/api.html?version=v4.2#tag/exec/operation/ExecInspectLibpod GET "/exec/:id/json" GET "/libpod/exec/:id/json"

func ExecResize

func ExecResize(cr *ContextRouter, c *gin.Context)

ExecResize - start an exec instance. https://docs.docker.com/engine/api/v1.41/#operation/ExecResize https://docs.podman.io/en/latest/_static/api.html?version=v4.2#tag/exec/operation/ExecResizeLibpod POST "/exec/:id/resize" POST "/libpod/exec/:id/resize"

func ExecStart

func ExecStart(cr *ContextRouter, c *gin.Context)

ExecStart - start an exec instance. https://docs.docker.com/engine/api/v1.41/#operation/ExecStart POST "/exec/:id/start"

func GetArchive

func GetArchive(cr *ContextRouter, c *gin.Context)

GetArchive - get a tar archive of a resource in the filesystem of container id. https://docs.docker.com/engine/api/v1.41/#operation/ContainerArchive GET "/containers/:id/archive" GET "/libpod/containers/:id/archive"

func HeadArchive

func HeadArchive(cr *ContextRouter, c *gin.Context)

HeadArchive - get information about files in a container. https://docs.docker.com/engine/api/v1.41/#operation/ContainerArchiveInfo HEAD "/containers/:id/archive" HEAD "/libpod/containers/:id/archive"

func ImageJSON

func ImageJSON(cr *ContextRouter, c *gin.Context)

ImageJSON - return low-level information about an image. https://docs.docker.com/engine/api/v1.41/#operation/ImageInspect GET "/images/:image/json"

func ImageList

func ImageList(cr *ContextRouter, c *gin.Context)

ImageList - list Images. Stubbed, not relevant on k8s. https://docs.docker.com/engine/api/v1.41/#operation/ImageList https://docs.podman.io/en/latest/_static/api.html?version=v4.2#tag/images/operation/ImageListLibpod GET "/images/json" GET "/libpod/images/json"

func PutArchive

func PutArchive(cr *ContextRouter, c *gin.Context)

PutArchive - extract an archive of files or folders to a directory in a container. https://docs.docker.com/engine/api/v1.41/#operation/PutContainerArchive https://docs.podman.io/en/latest/_static/api.html?version=v4.2#tag/containers/operation/PutContainerArchiveLibpod PUT "/containers/:id/archive" PUT "/libpod/containers/:id/archive"

func StartContainer

func StartContainer(cr *ContextRouter, tainr *types.Container) error

StartContainer will start given container and saves the appropriate state in the database.

func UpdateContainerStatus

func UpdateContainerStatus(cr *ContextRouter, tainr *types.Container)

UpdateContainerStatus will check if the started container is finished and will update the container database record accordingly.

Types

type Config

type Config struct {
	// Inspector specifies if the image inspect feature is enabled
	Inspector bool
	// PortForward specifies if the the services should be port-forwarded
	PortForward bool
	// ReverseProxy enables a reverse-proxy to the services via 0.0.0.0 on the kubedock host
	ReverseProxy bool
	// RequestCPU contains an optional default k8s cpu request
	RequestCPU string
	// RequestMemory contains an optional default k8s memory request
	RequestMemory string
	// RunasUser contains the UID to run pods as
	RunasUser string
	// PullPolicy contains the default pull policy for images
	PullPolicy string
	// PreArchive will enable copying files without starting containers
	PreArchive bool
	// ServiceAccount contains the service account name to be used for running containers
	ServiceAccount string
	// ActiveDeadlineSeconds contains the active deadline seconds to be used for running containers
	ActiveDeadlineSeconds int64
	// NamePrefix contains a prefix for the names used for the container deployments (optional).
	NamePrefix string
	// NodeSelector contains a comma-separated list of key=value pairs that is used to schedule pods to specific nodes
	NodeSelector string
}

Config is the structure to instantiate a Router object

type ContainerExecRequest

type ContainerExecRequest struct {
	Cmd    []string `json:"Cmd"`
	Stdin  bool     `json:"AttachStdin"`
	Stdout bool     `json:"AttachStdout"`
	Stderr bool     `json:"AttachStderr"`
	Tty    bool     `json:"Tty"`
	Env    []string `json:"Env"`
}

ContainerExecRequest represents the json structure that is used for the /conteiner/:id/exec request.

type ContextRouter

type ContextRouter struct {
	Config  Config
	DB      *model.Database
	Backend backend.Backend
	Events  events.Events
	Limiter *rate.Limiter
}

ContextRouter is the object that contains shared context for the kubedock API endpoints.

func NewContextRouter

func NewContextRouter(kub backend.Backend, cfg Config) (*ContextRouter, error)

NewContextRouter will instantiate a ContextRouter object.

type ExecStartRequest

type ExecStartRequest struct {
	Detach bool `json:"Detach"`
	Tty    bool `json:"Tty"`
}

ExecStartRequest represents the json structure that is used for the /exec/:id/start request.

Jump to

Keyboard shortcuts

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