kubernetes

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2022 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Namespace string
	*kubernetes.Clientset
	*rest.Config
}

Client is kubernetes client set wrapper

func NewClient

func NewClient(clientGetter genericclioptions.RESTClientGetter) (*Client, error)

NewClient return new kubernetes client

func (*Client) CopyFromPod added in v0.3.0

func (k *Client) CopyFromPod(podName, podFilePath, localFilePath string) error

CopyFromPod - copy file from pod to local file

func (*Client) CopyToPod added in v0.3.0

func (k *Client) CopyToPod(localFilePath, podName, podFilePath string) error

CopyToPod - copy local file to pod

func (*Client) DeleteJob

func (k *Client) DeleteJob(name string) error

DeleteJob deleting job

func (*Client) GetPodInfo

func (k *Client) GetPodInfo(name string) (*PodInfo, error)

GetPodInfo get info about pod by name

func (*Client) ReadPodLogs

func (k *Client) ReadPodLogs(podName, containerName string) (io.ReadCloser, error)

ReadPodLogs stream logs from pod

func (*Client) RunJob

func (k *Client) RunJob(spec *JobRunSpec) error

RunJob will run job with specified parameters

func (*Client) WaitPod

func (k *Client) WaitPod(labelSelector map[string]string) (*PodInfo, error)

WaitPod will wait until pod to start or failed

type ContainerConfigInfo added in v0.7.0

type ContainerConfigInfo struct {
	ID            string
	HostProcessID int
	Mounts        []ContainerMount
	RootFS        string
	Runtime       string
}

ContainerConfigInfo is an information about container state located at node

func NewContainerConfigInfo added in v0.7.0

func NewContainerConfigInfo(runtime, id string) (*ContainerConfigInfo, error)

NewContainerConfigInfo returns container configuration state

func (*ContainerConfigInfo) GetTmpSource added in v0.7.0

func (c *ContainerConfigInfo) GetTmpSource() string

GetTmpSource returns mount point for /tmp folder, depending upon container runtime and existing mounts If container contains mounts to /tmp folder, this mount source path will be used, otherwise – container rootfs

type ContainerInfo

type ContainerInfo struct {
	ID      string
	Name    string
	Runtime string
}

ContainerInfo is an information about container struct

func NewContainerInfo added in v0.6.0

func NewContainerInfo(cs *core.ContainerStatus) *ContainerInfo

NewContainerInfo returns container info mapped from core.ContainerStatus

func (*ContainerInfo) GetContainerFSVolume added in v0.6.0

func (c *ContainerInfo) GetContainerFSVolume() JobVolume

GetContainerFSVolume returns JobVolume (mounted from host) that contains container definitions, depending upon container runtime

func (*ContainerInfo) GetContainerSharedVolumes added in v0.6.0

func (c *ContainerInfo) GetContainerSharedVolumes() JobVolume

GetContainerSharedVolumes returns JobVolume (mounted from host) that contains container additional mounts, depending upon container runtime

type ContainerMount added in v0.7.0

type ContainerMount struct {
	Source      string
	Destination string
}

ContainerMount is an information about available container mounts

type JobRunSpec added in v0.6.0

type JobRunSpec struct {
	Args       []string
	Image      string
	Name       string
	Node       string
	Privileged bool
	Selectors  map[string]string
	Volumes    []JobVolume
}

JobRunSpec is helper struct to describe job spec customization

func NewJobRunSpec added in v0.6.0

func NewJobRunSpec(args []string, image string, pod *PodInfo) *JobRunSpec

NewJobRunSpec returns JobRunSpec constructed from specified args, image, pod and container

func (*JobRunSpec) Build added in v0.7.0

func (j *JobRunSpec) Build(namespace string) *batch.Job

Build returns resulted batch.Job spec from JobRunSpec options

func (*JobRunSpec) WithContainerFSVolume added in v0.6.0

func (j *JobRunSpec) WithContainerFSVolume(container *ContainerInfo) *JobRunSpec

WithContainerFSVolume add host volume that used to store container file system volumes

func (*JobRunSpec) WithContainerMountsVolume added in v0.6.0

func (j *JobRunSpec) WithContainerMountsVolume(container *ContainerInfo) *JobRunSpec

WithContainerMountsVolume add host volume that used to store container additional volumes

func (*JobRunSpec) WithHostProcVolume added in v0.7.0

func (j *JobRunSpec) WithHostProcVolume() *JobRunSpec

WithHostProcVolume adds host volume that used to locate target process memory sections

func (*JobRunSpec) WithHostTmpVolume added in v0.6.0

func (j *JobRunSpec) WithHostTmpVolume(path string) *JobRunSpec

WithHostTmpVolume add host /tmp volume that used to store output

func (*JobRunSpec) WithPrivilegedOptions added in v0.7.0

func (j *JobRunSpec) WithPrivilegedOptions() *JobRunSpec

WithPrivilegedOptions adds core.SecurityContext to with SYS_PTRACE capability to core.JobSpec

type JobVolume

type JobVolume struct {
	Name      string
	HostPath  string
	MountPath string
}

JobVolume is helper struct to describe job volume customization

type PodInfo added in v0.6.0

type PodInfo struct {
	Annotations map[string]string
	Name        string
	Namespace   string
	Node        string
	// contains filtered or unexported fields
}

func NewPodInfo added in v0.6.0

func NewPodInfo(pod *core.Pod) *PodInfo

NewPodInfo returns PodInfo generated from core.Pod spec

func (*PodInfo) ContainsMountedTmp added in v0.6.0

func (p *PodInfo) ContainsMountedTmp(container string) bool

ContainsMountedTmp returns true if container has /tmp folder mounted from host or shared with other container

func (*PodInfo) FindContainerInfo added in v0.6.0

func (p *PodInfo) FindContainerInfo(container string) (*ContainerInfo, error)

FindContainerInfo returns container info with specified name or error

func (*PodInfo) GetContainerNames added in v0.6.0

func (p *PodInfo) GetContainerNames() []string

GetContainerNames returns container names associated with pod

Jump to

Keyboard shortcuts

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