kubeops

package
v2.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2023 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewUUIDString

func NewUUIDString() (string, error)

NewUUIDString - generates a new UUID and converts it to string

func RandString

func RandString(length int) string

RandString - generates random string with length

Types

type Service

type Service struct {
	Client kubernetes.Interface // kubernetes client-set
	Log    hclog.Logger         // logger embedded in our service
}

Service exposes the operations on various K8s resources

func New

func New(client kubernetes.Interface, l hclog.Logger) *Service

New - builds a new Service that can interface with Kubernetes

func NewDefaultService

func NewDefaultService(l hclog.Logger) (*Service, error)

NewDefaultService - builds a new Service looking for a KubeConfig in various locations

func NewServiceFromKubeConfigFile

func NewServiceFromKubeConfigFile(kubeConfigPath string, l hclog.Logger) (*Service, error)

NewServiceFromKubeConfigFile - builds a new Service using KubeConfig file location passed by the caller

func (*Service) BuildEphemeralScannerContainer

func (svc *Service) BuildEphemeralScannerContainer(
	name string,
	image string,
	targetHost string,
	targetPort string,
	protocol string,
	message string,
	attempts int,
) (*corev1.EphemeralContainer, error)

BuildEphemeralScannerContainer - builds an ephemeral scanner container

func (*Service) BuildEphemeralSnifferContainer

func (svc *Service) BuildEphemeralSnifferContainer(
	name string,
	image string,
	search string,
	snapLen int,
	protocol string,
	numberMatches int,
	intFace string,
	timeoutSec int,
) (*corev1.EphemeralContainer, error)

BuildEphemeralSnifferContainer - builds an ephemeral sniffer container

func (*Service) CheckEphemeralContainerSupport

func (svc *Service) CheckEphemeralContainerSupport(ctx context.Context) error

CheckEphemeralContainerSupport - Checks support for ephemeral containers

func (*Service) GetExitStatusOfEphemeralContainer

func (svc *Service) GetExitStatusOfEphemeralContainer(
	ctx context.Context,
	containerName string,
	timeOut time.Duration,
	podName string,
	podNamespace string,
) (int, error)

GetExitStatusOfEphemeralContainer - returns the exit status of an EphemeralContainer in a pod

func (*Service) GetPod

func (svc *Service) GetPod(ctx context.Context, name, namespace string) (*corev1.Pod, error)

GetPod - Returns a Running Pod that has an IP address allocated to it

func (*Service) GetPodInDaemonSet

func (svc *Service) GetPodInDaemonSet(ctx context.Context, name, namespace string) (*corev1.Pod, error)

GetPodInDaemonSet - Returns a running Pod with IP address in a DaemonSet

func (*Service) GetPodInDeployment

func (svc *Service) GetPodInDeployment(ctx context.Context, name, namespace string) (*corev1.Pod, error)

GetPodInDeployment - Returns a running Pod in a deployment

func (*Service) GetPodInStatefulSet

func (svc *Service) GetPodInStatefulSet(ctx context.Context, name, namespace string) (*corev1.Pod, error)

GetPodInStatefulSet - Returns a running Pod in a statefulset

func (*Service) LaunchEphemeralContainerInPod

func (svc *Service) LaunchEphemeralContainerInPod(
	ctx context.Context,
	pod *corev1.Pod,
	ec *corev1.EphemeralContainer,
) (*corev1.Pod, string, error)

LaunchEphemeralContainerInPod - Launches an ephemeral container in running Pod

func (*Service) PingHealthEndpoint

func (svc *Service) PingHealthEndpoint(ctx context.Context, endpoint string) error

PingHealthEndpoint - pings a single endpoint of the apiServer using HTTP

func (*Service) WaitForPodInResourceReady

func (svc *Service) WaitForPodInResourceReady(name, namespace, resourceType string,
	poll, timeout time.Duration,
) error

Jump to

Keyboard shortcuts

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