util

package
v0.0.0-...-8810e6a Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddData

func AddData(configMap *corev1.ConfigMap, dataKey, dataValue string) *corev1.ConfigMap

func AddMetadataLabel

func AddMetadataLabel(pod *corev1.Pod, labelName, labelContent string) *corev1.Pod

AddMetadataLabel adds label to the POD metadata section :param labelName - key in map, label name :param labelContent - value, label content

func AddToPodDefinitionCpuLimits

func AddToPodDefinitionCpuLimits(pod *corev1.Pod, cpuNumber, containerNumber int64) *corev1.Pod

AddToPodDefinitionCpuLimits adds CPU limits and requests to the definition of POD

func AddToPodDefinitionHugePages1Gi

func AddToPodDefinitionHugePages1Gi(pod *corev1.Pod, amountLimit, amountRequest, containerNumber int64) *corev1.Pod

AddToPodDefinitionHugePages1Gi adds Hugepages 1Gi limits and requirements to the POD spec

func AddToPodDefinitionHugePages2Mi

func AddToPodDefinitionHugePages2Mi(pod *corev1.Pod, amountLimit, amountRequest, containerNumber int64) *corev1.Pod

AddToPodDefinitionHugePages2Mi adds Hugepages 2Mi limits and requirements to the POD spec

func AddToPodDefinitionMemory

func AddToPodDefinitionMemory(pod *corev1.Pod, amountLimit, amountRequest, containerNumber int64) *corev1.Pod

AddToPodDefinitionMemory adds Memory constraints to the POD spec

func AddToPodDefinitionVolumesWithDownwardAPI

func AddToPodDefinitionVolumesWithDownwardAPI(pod *corev1.Pod, mountPath, volumeName string, containerNumber int64) *corev1.Pod

AddToPodDefinitionVolumesWithDownwardAPI adds to the POD specification at the 'path' downwardAPI volumes that expose POD namespace :param pod - POD object to be modified :param mountPath - path of the folder in which file is going to be available :param volumeName - name of the volume :param containerNumber - number of the container to which volumes have to be added :return updated POD object

func ApplyConfigMap

func ApplyConfigMap(ci coreclient.CoreV1Interface, configMap *corev1.ConfigMap, timeout time.Duration) error

func CreateNamespace

func CreateNamespace(ci coreclient.CoreV1Interface, name string, timeout time.Duration) error

func CreateRunningPod

func CreateRunningPod(ci coreclient.CoreV1Interface, pod *corev1.Pod, timeout, interval time.Duration) error

CreateRunningPod create a pod and wait until it is running

func DeleteConfigMap

func DeleteConfigMap(ci coreclient.CoreV1Interface, configMap *corev1.ConfigMap, timeout time.Duration) error

func DeleteNamespace

func DeleteNamespace(ci coreclient.CoreV1Interface, name string, timeout time.Duration) error

func DeleteNetworkAttachmentDefinition

func DeleteNetworkAttachmentDefinition(ci networkCoreClient.K8sCniCncfIoV1Interface, testNetworkName string, nad *cniv1.NetworkAttachmentDefinition, timeout time.Duration) error

func DeletePod

func DeletePod(ci coreclient.CoreV1Interface, pod *corev1.Pod, timeout time.Duration) error

DeletePod will delete a pod

func ExecuteCommand

func ExecuteCommand(core coreclient.CoreV1Interface, config *restclient.Config, podName, ns, containerName, command string) (string, string, error)

ExecuteCommand execute command on the POD :param core - core V1 Interface :param config - configuration used to establish REST connection with K8s node :param podName - POD name on which command has to be executed :param ns - namespace in which POD exists :param containerName - container name on which command should be executed :param command - command to be executed on POD :return string output of the command (stdout)

	       string output of the command (stderr)
        error Error object or when everthing is correct nil

func GetConfigMap

func GetConfigMap(confgiMapName, namespace string) *corev1.ConfigMap

func GetMultiNetworks

func GetMultiNetworks(nad []string, ns string, podName string) *corev1.Pod

GetMultiNetworks adds a network to annotation

func GetNetworkAttachmentDefinition

func GetNetworkAttachmentDefinition(networkName string, ns string) *cniv1.NetworkAttachmentDefinition

func GetNetworkSpecConfig

func GetNetworkSpecConfig(networkName string) string
{
				"cniVersion": "0.3.0",
				"name":       networkName,
				"type":       "loopback",
			},

func GetNodeSelectorOnly

func GetNodeSelectorOnly(ns string, networkName string, nodeName string) *cniv1.NetworkAttachmentDefinition

func GetOneNetwork

func GetOneNetwork(nad, ns string, podName string) *corev1.Pod

GetOneNetwork add one network to pod

func GetOneNetworkTwoContainers

func GetOneNetworkTwoContainers(nad, ns, podName, secondContainerName string) *corev1.Pod

GetOneNetworkTwoContainers returns POD with two containers and one network

func GetPodDefinition

func GetPodDefinition(ns string, podName string) *corev1.Pod

GetPodDefinition will return a test pod

func GetPodTestImage

func GetPodTestImage() string

GetPodTestImage returns image to be used during testing

func GetResourceAndNodeSelector

func GetResourceAndNodeSelector(ns string, networkName string, nodeName string) *cniv1.NetworkAttachmentDefinition

func GetResourceSelectorOnly

func GetResourceSelectorOnly(ns string, networkName string, resourceName string) *cniv1.NetworkAttachmentDefinition

func GetWithoutAnnotations

func GetWithoutAnnotations(ns string, networkName string) *cniv1.NetworkAttachmentDefinition

func IsMinHugepagesAvailable

func IsMinHugepagesAvailable(ci coreclient.CoreV1Interface, minGi, minMi int) (bool, error)

IsMinHugepagesAvailable checks if a min Gi/Mi hugepage number is available on any nodes

func UpdatePodInfo

func UpdatePodInfo(ci coreclient.CoreV1Interface, pod *corev1.Pod, timeout time.Duration) (*corev1.Pod, error)

UpdatePodInfo will get the current pod state and return it

func WaitForNamespaceDelete

func WaitForNamespaceDelete(core coreclient.CoreV1Interface, namespaceName string, timeout, interval time.Duration) error

func WaitForPodStateRunning

func WaitForPodStateRunning(core coreclient.CoreV1Interface, podName, ns string, timeout, interval time.Duration) error

WaitForPodStateRunning waits for pod to enter running state

Types

This section is empty.

Jump to

Keyboard shortcuts

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