common

package
v0.0.0-...-0cd89e8 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2016 License: GPL-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MiB = 1024 * 1024
)

Variables

This section is empty.

Functions

func GetCpuLimitFromCgroup

func GetCpuLimitFromCgroup(cgroupParent string) (int32, error)

func GetMemeoryLimitFromCgroup

func GetMemeoryLimitFromCgroup(cgroupParent string) (int32, error)

GetMemeoryLimitFromCgroup get the memory limit from given cgroupParent

func NewClientTLSFromFile

func NewClientTLSFromFile(certFile, serverName string) (credentials.TransportCredentials, error)

NewClientTLSFromFile constructs a TLS from the input certificate file for client.

func ParseCommonAnnotations

func ParseCommonAnnotations(annotations map[string]string) *annotationConfig

Types

type Client

type Client interface {
	CreateContainer(req *kubeapi.CreateContainerRequest) (*kubeapi.CreateContainerResponse, error)
	StartContainer(req *kubeapi.StartContainerRequest) (*kubeapi.StartContainerResponse, error)
	StopContainer(req *kubeapi.StopContainerRequest) (*kubeapi.StopContainerResponse, error)
	RemoveContainer(req *kubeapi.RemoveContainerRequest) (*kubeapi.RemoveContainerResponse, error)
	ListContainers(req *kubeapi.ListContainersRequest) (*kubeapi.ListContainersResponse, error)
	ContainerStatus(req *kubeapi.ContainerStatusRequest) (*kubeapi.ContainerStatusResponse, error)
	ExecSync(req *kubeapi.ExecSyncRequest) (*kubeapi.ExecSyncResponse, error)
	Exec(req *kubeapi.ExecRequest) (*kubeapi.ExecResponse, error)
	Attach(req *kubeapi.AttachRequest) (*kubeapi.AttachResponse, error)
	PortForward(req *kubeapi.PortForwardRequest) (*kubeapi.PortForwardResponse, error)

	StartProxy() error
	RunCmd(req *common.RunCmdRequest) error
	SetPodIP(ip string) error
	GetPodIP() (string, error)
	SetSandboxConfig(config *kubeapi.PodSandboxConfig) error
	GetSandboxConfig() (*kubeapi.PodSandboxConfig, error)
	CopyFile(file string) error
	MountFs(source string, target string, fstype string, readOnly bool) error
	UnmountFs(target string) error
	SetHostname(hostname string) error
	Close()
	Version() (*kubeapi.VersionResponse, error)
	Ready() error
	SaveLogs(container string, path string) error
	GetMetric(req *common.GetMetricsRequest) (*common.GetMetricsResponse, error)
	AddRoute(req *common.AddRouteRequest) (*common.AddRouteResponse, error)
}

func CreateFakeClient

func CreateFakeClient() (Client, error)

func CreateRealClient

func CreateRealClient(ip string) (Client, error)

type PodData

type PodData struct {
	VM          lvm.VirtualMachine
	Id          string
	Metadata    *kubeapi.PodSandboxMetadata
	Annotations map[string]string
	Labels      map[string]string
	CreatedAt   int64
	Ip          string
	Linux       *kubeapi.LinuxPodSandboxConfig

	Client       Client
	PodState     kubeapi.PodSandboxState
	Booted       bool
	BootLock     sync.Mutex
	ProviderData ProviderData
	ContLogs     map[string]string
	// contains filtered or unexported fields
}

func NewPodData

func NewPodData(vm lvm.VirtualMachine, id string, meta *kubeapi.PodSandboxMetadata, anno map[string]string,
	labels map[string]string, ip string, linux *kubeapi.LinuxPodSandboxConfig, client Client, booted bool,
	providerData ProviderData) *PodData

func (*PodData) AddContLogPath

func (p *PodData) AddContLogPath(cont string, path string)

func (*PodData) AttachVol

func (p *PodData) AttachVol(vol string) (string, error)

func (*PodData) Filter

func (p *PodData) Filter(filter *kubeapi.PodSandboxFilter) (bool, string)

func (*PodData) GetContLogPath

func (p *PodData) GetContLogPath(cont string) (string, bool)

func (*PodData) GetPodState

func (p *PodData) GetPodState() kubeapi.PodSandboxState

func (*PodData) GetSandbox

func (p *PodData) GetSandbox() *kubeapi.PodSandbox

func (*PodData) Lock

func (p *PodData) Lock()

func (*PodData) NeedMount

func (p *PodData) NeedMount(vol string) bool

func (*PodData) PodStatus

func (p *PodData) PodStatus() *kubeapi.PodSandboxStatus

func (*PodData) RLock

func (p *PodData) RLock()

func (*PodData) RUnlock

func (p *PodData) RUnlock()

func (*PodData) RemovePod

func (p *PodData) RemovePod() error

func (*PodData) StopPod

func (p *PodData) StopPod() error

Expect StateLock to already be taken

func (*PodData) Unlock

func (p *PodData) Unlock()

func (*PodData) UpdatePodState

func (p *PodData) UpdatePodState()

type ProviderData

type ProviderData interface {
	Attach(volume, device string) (string, error)
	NeedMount(volume string) bool
}

type RealClient

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

func (*RealClient) AddRoute

func (*RealClient) Attach

func (*RealClient) Close

func (c *RealClient) Close()

func (*RealClient) ContainerStatus

func (*RealClient) CopyFile

func (c *RealClient) CopyFile(file string) error

func (*RealClient) CreateContainer

func (*RealClient) Exec

func (*RealClient) ExecSync

func (*RealClient) GetMetric

func (*RealClient) GetPodIP

func (c *RealClient) GetPodIP() (string, error)

func (*RealClient) GetSandboxConfig

func (c *RealClient) GetSandboxConfig() (*kubeapi.PodSandboxConfig, error)

func (*RealClient) ListContainers

func (*RealClient) MountFs

func (c *RealClient) MountFs(source string, target string, fstype string, readOnly bool) error

func (*RealClient) PortForward

func (*RealClient) Ready

func (c *RealClient) Ready() error

func (*RealClient) RemoveContainer

func (*RealClient) RunCmd

func (c *RealClient) RunCmd(req *common.RunCmdRequest) error

func (*RealClient) SaveLogs

func (c *RealClient) SaveLogs(container string, path string) error

func (*RealClient) SetHostname

func (c *RealClient) SetHostname(hostname string) error

func (*RealClient) SetPodIP

func (c *RealClient) SetPodIP(ip string) error

func (*RealClient) SetSandboxConfig

func (c *RealClient) SetSandboxConfig(config *kubeapi.PodSandboxConfig) error

func (*RealClient) StartContainer

func (*RealClient) StartProxy

func (c *RealClient) StartProxy() error

func (*RealClient) StopContainer

func (*RealClient) UnmountFs

func (c *RealClient) UnmountFs(target string) error

func (*RealClient) Version

func (c *RealClient) Version() (*kubeapi.VersionResponse, error)

Jump to

Keyboard shortcuts

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