backend

package
v0.0.0-...-9b4d37b Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend interface {
	StartContainer(*types.Container) (DeployState, error)
	GetContainerStatus(*types.Container) (DeployState, error)
	CreatePortForwards(*types.Container)
	CreateReverseProxies(*types.Container)
	GetPodIP(*types.Container) (string, error)
	DeleteAll() error
	DeleteWithKubedockID(string) error
	DeleteContainer(*types.Container) error
	DeleteOlderThan(time.Duration) error
	WatchDeleteContainer(*types.Container) (chan struct{}, error)
	CopyFromContainer(*types.Container, string, io.Writer) error
	CopyToContainer(*types.Container, io.Reader, string) error
	GetFileModeInContainer(tainr *types.Container, path string) (fs.FileMode, error)
	FileExistsInContainer(tainr *types.Container, path string) (bool, error)
	ExecContainer(*types.Container, *types.Exec, io.Reader, io.Writer) (int, error)
	GetLogs(*types.Container, *LogOptions, chan struct{}, io.Writer) error
	GetImageExposedPorts(string) (map[string]struct{}, error)
}

Backend is the interface to orchestrate and manage kubernetes objects.

func New

func New(cfg Config) (Backend, error)

New will return a Backend instance.

type Config

type Config struct {
	// Client is the kubernetes clientset
	Client kubernetes.Interface
	// RestConfig is the kubernetes config
	RestConfig *rest.Config
	// Namespace is the namespace in which all actions are performed
	Namespace string
	// ImagePullSecrets is an optional list of image pull secrets that need
	// to be added to the used pod templates
	ImagePullSecrets []string
	// InitImage is the image that is used as init container to prepare vols
	InitImage string
	// DindImage is the image that is used as a sidecar container to
	// support docker-in-docker
	DindImage string
	// DisableDind will disable docker-in-docker support when set to true
	DisableDind bool
	// TimeOut is the max amount of time to wait until a container started
	// or deleted.
	TimeOut time.Duration
	// PodTemplate refers to an optional file containing a pod resource that
	// should be used as the base for creating pod resources.
	PodTemplate string
	// KubedockURL contains the url of this kubedock instance, to be used in
	// docker-in-docker instances/sidecars.
	KubedockURL string
}

Config is the structure to instantiate a Backend object

type DeployState

type DeployState int

DeployState describes the state of a deployment.

const (
	// DeployPending represents a pending deployment
	DeployPending DeployState = iota
	// DeployFailed represents a failed deployment
	DeployFailed
	// DeployRunning represents a running deployment
	DeployRunning
	// DeployCompleted represents a completed deployment
	DeployCompleted
)

type LogOptions

type LogOptions struct {
	// Keep connection after returning logs.
	Follow bool
	// Only return logs since this time, as a UNIX timestamp
	SinceTime *time.Time
	// Add timestamps to every log line
	Timestamps bool
	// Number of lines to show from the end of the logs
	TailLines *uint64
}

LogOptions describe the supported log options

Jump to

Keyboard shortcuts

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