Documentation ¶
Index ¶
- func CompareFiles(fileone string, filetwo string) (bool, error)
- func CreateDeployment(c *Client, d *Deployment) error
- func CreateEndpoint(c *Client, e *Endpoint) error
- func CreateNamespace(c *Client, namespace string) error
- func CreatePod(c *Client, p *Pod) error
- func CreateService(c *Client, s *Service) error
- func CreateTempFile(dirname string, filename string) (*os.File, error)
- func DeleteDeployment(c *Client, deployment string, namespace string) error
- func DeleteEndpoint(c *Client, endpoint string, namespace string) error
- func DeleteNamespace(c *Client, namespace string) error
- func DeleteService(c *Client, service string, namespace string) error
- func DetectContainerPortProtocol(protocol string) (v1.Protocol, error)
- func DiffCommand(fileone string, filetwo string) ([]byte, error)
- func ExecCmdPod(c *Client, podName string, nameSpace string, cmd []string) (bytes.Buffer, bytes.Buffer, error)
- func ExecuteHTTPReqInsideContainer(c *Client, container string, namespace string, URL string) (string, error)
- func ExistsDeployment(c *Client, deployment string, namespace string) (string, error)
- func ExistsEndpoint(c *Client, e *Endpoint) (string, error)
- func ExistsNamespace(c *Client, namespace string) (string, error)
- func ExistsPod(c *Client, podName string, namespace string) (string, error)
- func ExistsService(c *Client, service string, namespace string) (string, error)
- func FindPodsWithNameContains(c *Client, substring string, namespace string) ([]string, int)
- func GenerateRandomString(numberOfChars int, modeString string) (string, error)
- func GetIPFromPod(c *Client, podName string, nameSpace string) (string, error)
- func GetIPFromService(c *Client, svcName string, nameSpace string) (string, error)
- func IPTablesSaveNatTable(c *Client, i *IPTables, container string, namespace string) (*os.File, error)
- func ListAllEndpoints(c *Client, e *Endpoint)
- func PatchEndpoint(c *Client, e *Endpoint) error
- func SetLogrusLogging()
- func ShowEndpoint(c *Client, endpoint string, namespace string) error
- type Client
- type Deployment
- type Endpoint
- type IPTables
- type Pod
- type Service
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompareFiles ¶
CompareFiles will compare two files, byte by byte to see if they are equal
Args:
fileone - first file to compare filetwo - second file to compare Returns: bool and error
func CreateDeployment ¶
func CreateDeployment(c *Client, d *Deployment) error
Create will create a deployment
Args:
- Client struct from client module
- Deployment from this module
Returns:
- error
func CreateEndpoint ¶
Create will create an endpoint
Args:
- Client struct from client module
- Instance from endpoint module
Return:
- error or nil
func CreateNamespace ¶
CreateNamespace will create a namespace
Args:
- Pointer to a Client struct
- namespace name
Returns:
error or nil
func CreatePod ¶
CreatePod will create a POD
Args:
- Client struct from client module
- Instance struct from pod module
Return:
- error or nil
func CreateService ¶
CreateService creates a service using the values from the Service struct via the Client.Clientset
Args:
Service - Service struct Client - Client strucut Returns: error or nil
func CreateTempFile ¶
CreateTempFile will create temporary file
Args:
dirname - dir name filename - file name Returns: filename as string or error
func DeleteDeployment ¶
DeleteDeployment will delete an deployment
Args:
- Client struct from client module
- deployment name
- namespace
Return:
- error or nil
func DeleteEndpoint ¶
DeleteEndpoint will delete an endpoint
Args:
- Client struct from client module
- endpoint name
- namespace
Return:
- error or nil
func DeleteNamespace ¶
DeleteNamespace will delete a namespace
Args:
- Pointer to a Client struct
- namespace name
Returns:
error or nil
func DeleteService ¶
Delete deletes a service
Args:
Client - client struct from the client module service - Service Name namespace - Namespace Returns: error or nil
func DetectContainerPortProtocol ¶
DetectContainerPortProtocol is a helper for users use only TCP or UDP string instead of require them to manage k8s.io/api/core/v1. This will convert TCP or UDP to v1.ProtocolTCP or v1.ProtocolUDP
Args:
protocol - TCP or UDP as string
Returns:
v1.ProtocolUDP, v1.ProtocolTCP or error
func DiffCommand ¶
DiffCommand will diff two files
Args:
fileone filtwo Returns: bytes from the file or error
func ExecCmdPod ¶
func ExecCmdPod(c *Client, podName string, nameSpace string, cmd []string) (bytes.Buffer, bytes.Buffer, error)
ExecCmdPod 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 ExecuteHTTPReqInsideContainer ¶
func ExecuteHTTPReqInsideContainer(c *Client, container string, namespace string, URL string) (string, error)
ExecuteHTTPReqFromInsideContainer will execute http request to a specific address
Args:
client struct container name namespace URL
Returns:
output as string or error
func ExistsDeployment ¶
Exists will check if the service exists or not
Args:
Pointer to a Client struct Service Name Namespace
Returns:
string (namespace name) OR error type
func ExistsEndpoint ¶
ExistsEndpoint will check if the endpoint exists or not
Args:
- Client struct from client module
- Instance struct from this module
Returns:
bool OR error type
func ExistsNamespace ¶
Exists will check if the namespace exists or not
Args:
- Pointer to a Client struct
- namespace name
Returns:
string (namespace name) OR error type
func ExistsPod ¶
ExistsPod will check if the pod exists or not
Args:
- Pointer to a Client struct
Returns:
string (namespace name) OR error type
func ExistsService ¶
Exists will check if the service exists or not
Args:
- Pointer to a Client struct
Returns:
string (namespace name) OR error type
func FindPodsWithNameContains ¶
FindPodsWithNameContains will find pods with substring provided
Args:
- Client struct from client module
- substring to be found
- namespace
Return:
- error or nil
func GenerateRandomString ¶
GenerateRandomString will generate a random string
Args:
number of chars to be generated modeString lower or all Returns: random string
func GetIPFromPod ¶
GetIPFromPod will return the pod IP address
Args:
- Client struct from client module
- pod name
- namespace
Returns:
- the IP as string or error
func GetIPFromService ¶
GetIPFromService will return the pod IP address
Args:
- Client struct from client module
- pod name
- namespace
Returns:
- the IP as string or error
func IPTablesSaveNatTable ¶
func IPTablesSaveNatTable(c *Client, i *IPTables, container string, namespace string) (*os.File, error)
SaveNatTable save the current state of NAT table from the container provider in the parameter
Args:
container name namespace
Returns:
file object filesystem which triggered this method
func ListAllEndpoints ¶
ListAllEndpoints will list ALL endpoints from a namespace
Args:
- Client struct from client module
- Instance from endpoint module
Return:
- error or nil
func PatchEndpoint ¶
Patch will patch an endpoint object
Args:
- Client struct from client module
- Instance from endpoint module
Return:
- error or nil
func SetLogrusLogging ¶
func SetLogrusLogging()
SetLogrusLogging will set the log format for logrus
Args:
- None
Returns:
- None
Types ¶
type Client ¶
type Client struct { Clientset *kubernetes.Clientset Restclientset *kubernetes.Clientset Namespace string Restconfig *rest.Config Kubeconfig clientcmd.ClientConfig TimeoutTaksInSec int NumberMaxOfAttemptsPerTask int }
Client struct contains all info about client to connect into the cluster
func (*Client) Connect ¶
Connect will connect to specific Cluster read from kubeconfig
Args:
Returns:
- Client struct
func (*Client) KubeClientFromConfig ¶
KubeClientFromConfig will provide the REST interface to cluster
Args:
Returns:
- Client struct or error
type Deployment ¶
type Deployment struct { Name string Namespace string Replicas int32 LabelKey string LabelValue string Pod struct { Name string Image string ContainerPortName string ContainerPortProtocol string // "TCP" or "UDP" ContainerPort int32 } }
Deployment type refers to the Deployment object
type Endpoint ¶
type Endpoint struct { Name string IP string LabelKey string LabelValue string Namespace string EndpointPort struct { Name string Port int32 Protocol string } }
Endpoint type refers to the Endpoint object
type IPTables ¶
type IPTables struct { ReadNatTable []string ReadFilterTable []string ReadNatTableKubeServices []string }
IPTables type refers to the iptables object
func IPTablesLoadPreDefinedCommands ¶
func IPTablesLoadPreDefinedCommands() IPTables
LoadPreDefinedIPTables loads several pre-defined iptables commands.
Args:
None
Returns:
Filled IPTablesIPTables struct with commands