kubernetes

package
v0.0.0-...-a09db05 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2023 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attachment

type Attachment struct {
	*Client
	// contains filtered or unexported fields
}

Attachment represents the console (stdin/stdout) attachment to a given Pod.

func (*Attachment) Run

func (a *Attachment) Run() error

Run implements tea.ExecCommand.

func (*Attachment) SetStderr

func (a *Attachment) SetStderr(writer io.Writer)

SetStderr implements tea.ExecCommand.

func (*Attachment) SetStdin

func (a *Attachment) SetStdin(reader io.Reader)

SetStdin implements tea.ExecCommand.

func (*Attachment) SetStdout

func (a *Attachment) SetStdout(writer io.Writer)

SetStdout implements tea.ExecCommand.

type Client

type Client struct {
	*k8s.Clientset
	// contains filtered or unexported fields
}

Client holds a wrapped Kubernetes client.

func LoadClient

func LoadClient(namespace string) *Client

LoadClient creates a new Client singleton.

func (*Client) CreateInitialPod

func (c *Client) CreateInitialPod(name, image string, pvc *corev1.PersistentVolumeClaim) (*corev1.Pod, error)

Creates a Pod with an init container that provisions the user home, in the cluster with a given name, container image, and a pvc that will be mounted on /home.

func (*Client) CreatePVC

func (c *Client) CreatePVC(name, size string) (*corev1.PersistentVolumeClaim, error)

Creates a PVC by name with a given size.

func (*Client) CreatePod

func (c *Client) CreatePod(name, image string, pvc *corev1.PersistentVolumeClaim) (*corev1.Pod, error)

Creates a Pod in the cluster with a given name, container image, and a pvc that will be mounted on /home.

func (*Client) DeletePod

func (c *Client) DeletePod(pod *corev1.Pod) error

Deletes a Pod.

func (*Client) GetActivePTYs

func (c *Client) GetActivePTYs(pod *corev1.Pod) (int, error)

Query for active PTYs in a Pod.

func (*Client) GetConfig

func (c *Client) GetConfig() *rest.Config

Gets client Config.

func (*Client) GetPVC

func (c *Client) GetPVC(name string) (*corev1.PersistentVolumeClaim, error)

Get a PVC by name from the cluster.

func (*Client) GetPod

func (c *Client) GetPod(name string) (*corev1.Pod, error)

Get a Pod by name from the cluster.

func (*Client) NewAttachment

func (c *Client) NewAttachment(pod *corev1.Pod, user string, sizeChan SizeChan) *Attachment

Returns a new Attachment.

func (*Client) NewLogTail

func (c *Client) NewLogTail(pod *corev1.Pod, linesChan chan string) *LogTail

NewLogTail returns a new LogTail instance.

func (*Client) SendShutdownWallToPod

func (c *Client) SendShutdownWallToPod(pod *corev1.Pod) error

Send a wall about the shutdown to all session in the Pod.

func (*Client) WaitForPVC

func (c *Client) WaitForPVC(pvc *corev1.PersistentVolumeClaim) error

Wait for a PersistentVolumeClaim to be ready.

func (*Client) WaitForPodInitContainer

func (c *Client) WaitForPodInitContainer(pod *corev1.Pod) (PodStatus, error)

Waits for a Pod to be scheduled.

type LogTail

type LogTail struct {
	*Client
	// contains filtered or unexported fields
}

LogTail is the struct that tails the logs for a Pod's container.

func (*LogTail) Run

func (lt *LogTail) Run(container string) error

Run follows the log lines, and sends them to the linesChan.

type PodStatus

type PodStatus int

PodStatus represents if the Pod init container is ready, or if the Pod is ready.

const (
	PodStatusUnknown PodStatus = iota
	PodStatusInitContainerReady
	PodStatusReady
)

type SizeChan

type SizeChan chan remotecommand.TerminalSize

func (SizeChan) Next

Jump to

Keyboard shortcuts

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