pod

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2021 License: Apache-2.0 Imports: 12 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(c *client.Client, p *Instance) error

Create will create a POD

Args:

  • Client struct from client module
  • Instance struct from pod module

Return:

  • error or nil

func CreateWaitRunningState added in v0.0.2

func CreateWaitRunningState(c *client.Client, p *Instance) error

CreateWaitRunningState will create a POD and wait the pod be in running state

Args:

  • Client struct from client module
  • Instance struct from pod module

Return:

  • error or nil

func ExecCmd

func ExecCmd(c *client.Client,
	podName string,
	nameSpace string,
	cmd []string) (bytes.Buffer, bytes.Buffer, error)

ExecCmd executes a command inside a POD

Args:

     Client - struct from client module
	podName	- The pod name
	cmd - Array (string)

Returns:

stdout, stderr as bytes.Buffer or error

func Exists

func Exists(c *client.Client, podName string, namespace string) (string, error)

Exists will check if the pod exists or not

Args:

  • Pointer to a Client struct

Returns:

string (namespace name) OR error type

func FindPodsWithNameContains

func FindPodsWithNameContains(c *client.Client,
	substring string,
	namespace string) ([]string, int)

FindPodsWithNameContains will find pods with substring provided

Args:

  • Client struct from client module
  • substring to be found
  • namespace

Return:

  • error or nil

func GetIP

func GetIP(c *client.Client,
	podName string,
	nameSpace string) (string, error)

GetIP will return the pod IP address

Args:

  • Client struct from client module
  • pod name
  • namespace

Returns:

  • the IP as string or error

func GetLastTimeConditionHappened added in v0.0.2

func GetLastTimeConditionHappened(c *client.Client,
	condition string,
	podName string,
	nameSpace string) (metav1.Time, error)

GetLastTimeConditionHappened Get the last time a condition happened in a pod

Conditions:

PodScheduled: the Pod has been scheduled to a node.
ContainersReady: all containers in the Pod are ready.
Initialized: all init containers have started successfully.
Ready: the Pod is able to serve requests and should be added
       to the load balancing pools of all matching

Args:

  • Client struct from client module
  • pod name
  • namespace

Returns:

  • the IP as string or error

func WaitForPodInRunningState

func WaitForPodInRunningState(c *client.Client, podname string, namespace string) error

WaitForPodInRunningState will execute waitForPodRunning

Args:

  • Pointer to a client struct
  • podname
  • namespace

Returns:

nil or error

Types

type Instance

type Instance struct {
	Name            string
	Namespace       string
	Image           string
	ImagePullPolicy string
	Command         []string
	CommandArgs     []string
	LabelKey        string
	LabelValue      string
}

Instance type refers to the Pod object

Jump to

Keyboard shortcuts

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