common

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2020 License: Apache-2.0 Imports: 21 Imported by: 1

Documentation

Index

Constants

View Source
const (
	TestNamespace = "default"

	TestNodeCpu = int64(2000)
	TestNodeMem = int64(4 * 1024 * 1024)

	TestNodeBufferInitSize = 4
	TestNodeBufferFactor   = 2.0
	TestNodeResourceLimit  = 0.1
)
View Source
const (
	HashSuffixLength = 8
)

Variables

This section is empty.

Functions

func CleanDnsName

func CleanDnsName(name string) string

func GetKubernetesClient

func GetKubernetesClient(kubernetesConfig string) (client.Client, error)

func GetKubernetesConfig

func GetKubernetesConfig(kubernetesConfig string) (*rest.Config, error)

func GetNodeName

func GetNodeName(pod *corev1.Pod) string

func GetSelectedSources

func GetSelectedSources(cli client.Client, namespace string, selector labels.Selector) ([]*bitflowv1.BitflowSource, error)

func GetSelectedSteps

func GetSelectedSteps(cli client.Client, namespace string, selector labels.Selector) ([]*bitflowv1.BitflowStep, error)

func GetSource

func GetSource(cli client.Client, source, namespace string) (*bitflowv1.BitflowSource, error)

func GetSources

func GetSources(cli client.Client, namespace string) ([]*bitflowv1.BitflowSource, error)

func GetStep

func GetStep(cli client.Client, step, namespace string) (*bitflowv1.BitflowStep, error)

func GetSteps

func GetSteps(cli client.Client, namespace string) ([]*bitflowv1.BitflowStep, error)

func HashName

func HashName(prefix string, hashInputStrings ...string) string

func IsBeingDeleted

func IsBeingDeleted(pod *corev1.Pod) bool

func IsNodeReady added in v0.0.2

func IsNodeReady(node *corev1.Node) bool

func RequestAllPodsOnNode

func RequestAllPodsOnNode(cli client.Client, nodeName, namespace string, podLabels map[string]string) ([]*corev1.Pod, error)

func RequestNode

func RequestNode(cli client.Client, nodeName string) (*corev1.Node, error)

func RequestNodes

func RequestNodes(cli client.Client) (*corev1.NodeList, error)

func RequestPod

func RequestPod(cli client.Client, podName, namespace string) (*corev1.Pod, error)

func RequestPods

func RequestPods(cli client.Client, namespace string) ([]*corev1.Pod, error)

func RequestReadyNode added in v0.0.2

func RequestReadyNode(cli client.Client, nodeName string) (*corev1.Node, error)

func RequestReadyNodes added in v0.0.2

func RequestReadyNodes(cli client.Client) (*corev1.NodeList, error)

func RequestSelectedPods

func RequestSelectedPods(cli client.Client, namespace string, selector labels.Selector) ([]*corev1.Pod, error)

func UnpackPodList

func UnpackPodList(list *corev1.PodList, err error) ([]*corev1.Pod, error)

Types

type AbstractTestSuite

type AbstractTestSuite struct {
	golib.AbstractTestSuite
}

func (*AbstractTestSuite) AddStepIngest

func (suite *AbstractTestSuite) AddStepIngest(step *bitflowv1.BitflowStep, matches ...string)

func (*AbstractTestSuite) AddStepOutput

func (suite *AbstractTestSuite) AddStepOutput(step *bitflowv1.BitflowStep, name string, labels map[string]string)

func (*AbstractTestSuite) ConfigMap

func (suite *AbstractTestSuite) ConfigMap(name string) *corev1.ConfigMap

func (*AbstractTestSuite) MakeFakeClient

func (suite *AbstractTestSuite) MakeFakeClient(objects ...runtime.Object) client.Client

func (*AbstractTestSuite) Node

func (suite *AbstractTestSuite) Node(name string) *corev1.Node

func (*AbstractTestSuite) Node2

func (suite *AbstractTestSuite) Node2(name string, labels, annotations map[string]string) *corev1.Node

func (*AbstractTestSuite) Pod

func (suite *AbstractTestSuite) Pod(name string) *corev1.Pod

func (*AbstractTestSuite) PodLabels

func (suite *AbstractTestSuite) PodLabels(name string, labels map[string]string) *corev1.Pod

func (*AbstractTestSuite) Source

func (suite *AbstractTestSuite) Source(name string, labels map[string]string) *bitflowv1.BitflowSource

func (*AbstractTestSuite) Step

func (suite *AbstractTestSuite) Step(name string, stepType string, ingestMatches ...string) *bitflowv1.BitflowStep

func (*AbstractTestSuite) StepWithOutput

func (suite *AbstractTestSuite) StepWithOutput(name string, stepType string, outputName string, outputLabels map[string]string, ingestMatches ...string) *bitflowv1.BitflowStep

type ResourceWrapper

type ResourceWrapper struct {
	TotalCpuLimit      resource.Quantity
	TotalMemoryLimit   resource.Quantity
	TotalCpuRequest    resource.Quantity
	TotalMemoryRequest resource.Quantity
}

func RequestPodResources

func RequestPodResources(cli client.Client, podName, namespace string) (ResourceWrapper, error)

func (*ResourceWrapper) AddLimits

func (wrapper *ResourceWrapper) AddLimits(resourceLimits corev1.ResourceList)

func (*ResourceWrapper) AddPod

func (wrapper *ResourceWrapper) AddPod(pod *corev1.Pod)

func (*ResourceWrapper) AddRequests

func (wrapper *ResourceWrapper) AddRequests(resourceRequests corev1.ResourceList)

func (*ResourceWrapper) AddResources

func (wrapper *ResourceWrapper) AddResources(resources ResourceWrapper)

type RespawningPods

type RespawningPods struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewRespawningPods

func NewRespawningPods() *RespawningPods

func (*RespawningPods) Add

func (respawning *RespawningPods) Add(pod *corev1.Pod)

func (*RespawningPods) CountRestarting

func (respawning *RespawningPods) CountRestarting(pods []*corev1.Pod, currentPod, currentNode string) int

func (*RespawningPods) Debug

func (respawning *RespawningPods) Debug()

func (*RespawningPods) Delete

func (respawning *RespawningPods) Delete(name string)

func (*RespawningPods) DeletePodsWithLabel

func (respawning *RespawningPods) DeletePodsWithLabel(labelKey string, labelValue string)

func (*RespawningPods) DeletePodsWithLabelExcept

func (respawning *RespawningPods) DeletePodsWithLabelExcept(labelKey string, labelValue string, valid []string)

func (*RespawningPods) IsPodRestarting

func (respawning *RespawningPods) IsPodRestarting(name string) (RespawningStatus, bool)

func (*RespawningPods) IsPodRestartingOnNode

func (respawning *RespawningPods) IsPodRestartingOnNode(podName, nodeName string) (RespawningStatus, bool)

func (*RespawningPods) ListPods

func (respawning *RespawningPods) ListPods() []string

func (*RespawningPods) Size

func (respawning *RespawningPods) Size() int

type RespawningStatus

type RespawningStatus struct {
	Pod *corev1.Pod
	// contains filtered or unexported fields
}

func (RespawningStatus) CountContainer

func (spec RespawningStatus) CountContainer() int

Jump to

Keyboard shortcuts

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