Documentation ¶
Index ¶
- Variables
- func GetGVR() schema.GroupVersionResource
- func StaticAnnotation(name string) *multus.NetworkSelectionElement
- func StaticIPAnnotation(name string, ipAddr []string) []*multus.NetworkSelectionElement
- func StaticIPAnnotationWithInterfaceAndNamespace(name, namespace, intName string, ipAddr []string) []*multus.NetworkSelectionElement
- func StaticIPAnnotationWithInterfaceMacAndNamespace(name, namespace, intName, macAddr string) []*multus.NetworkSelectionElement
- func StaticIPAnnotationWithMacAddress(name string, ipAddr []string, macAddr string) []*multus.NetworkSelectionElement
- func StaticIPAnnotationWithMacAndNamespace(name, namespace, macAddr string) []*multus.NetworkSelectionElement
- func StaticIPAnnotationWithNamespace(name, namespace string, ipAddr []string) []*multus.NetworkSelectionElement
- func StaticIPBondAnnotationWithInterface(bondNadName, bondIntName string, sriovNetworkNameList, ipAddrBond []string) []*multus.NetworkSelectionElement
- func StaticIPMultiNetDualStackAnnotation(sriovNets, ipAddr []string) ([]*multus.NetworkSelectionElement, error)
- func WaitForAllPodsInNamespaceRunning(apiClient *clients.Settings, nsname string, timeout time.Duration, ...) (bool, error)
- type AdditionalOptions
- type Builder
- func List(apiClient *clients.Settings, nsname string, options ...v1.ListOptions) ([]*Builder, error)
- func ListByNamePattern(apiClient *clients.Settings, namePattern, nsname string) ([]*Builder, error)
- func ListInAllNamespaces(apiClient *clients.Settings, options ...v1.ListOptions) ([]*Builder, error)
- func NewBuilder(apiClient *clients.Settings, name, nsname, image string) *Builder
- func Pull(apiClient *clients.Settings, name, nsname string) (*Builder, error)
- func (builder *Builder) Copy(path, containerName string, tar bool) (bytes.Buffer, error)
- func (builder *Builder) Create() (*Builder, error)
- func (builder *Builder) CreateAndWaitUntilRunning(timeout time.Duration) (*Builder, error)
- func (builder *Builder) DefineOnNode(nodeName string) *Builder
- func (builder *Builder) Delete() (*Builder, error)
- func (builder *Builder) DeleteAndWait(timeout time.Duration) (*Builder, error)
- func (builder *Builder) ExecCommand(command []string, containerName ...string) (bytes.Buffer, error)
- func (builder *Builder) Exists() bool
- func (builder *Builder) GetFullLog(containerName string) (string, error)
- func (builder *Builder) GetLog(logStartTime time.Duration, containerName string) (string, error)
- func (builder *Builder) PullImage(timeout time.Duration, testCmd []string) error
- func (builder *Builder) RedefineDefaultCMD(command []string) *Builder
- func (builder *Builder) RedefineDefaultContainer(container corev1.Container) *Builder
- func (builder *Builder) WaitUntilCondition(condition corev1.PodConditionType, timeout time.Duration) error
- func (builder *Builder) WaitUntilDeleted(timeout time.Duration) error
- func (builder *Builder) WaitUntilInStatus(status corev1.PodPhase, timeout time.Duration) error
- func (builder *Builder) WaitUntilReady(timeout time.Duration) error
- func (builder *Builder) WaitUntilRunning(timeout time.Duration) error
- func (builder *Builder) WithAdditionalContainer(container *corev1.Container) *Builder
- func (builder *Builder) WithAdditionalInitContainer(container *corev1.Container) *Builder
- func (builder *Builder) WithHostNetwork() *Builder
- func (builder *Builder) WithHostPid(hostPid bool) *Builder
- func (builder *Builder) WithHugePages() *Builder
- func (builder *Builder) WithLabel(labelKey, labelValue string) *Builder
- func (builder *Builder) WithLabels(labels map[string]string) *Builder
- func (builder *Builder) WithLocalVolume(volumeName, mountPath string) *Builder
- func (builder *Builder) WithNodeSelector(nodeSelector map[string]string) *Builder
- func (builder *Builder) WithOptions(options ...AdditionalOptions) *Builder
- func (builder *Builder) WithPrivilegedFlag() *Builder
- func (builder *Builder) WithRestartPolicy(restartPolicy corev1.RestartPolicy) *Builder
- func (builder *Builder) WithSecondaryNetwork(network []*multus.NetworkSelectionElement) *Builder
- func (builder *Builder) WithSecurityContext(securityContext *corev1.PodSecurityContext) *Builder
- func (builder *Builder) WithToleration(toleration corev1.Toleration) *Builder
- func (builder *Builder) WithTolerationToControlPlane() *Builder
- func (builder *Builder) WithTolerationToMaster() *Builder
- func (builder *Builder) WithVolume(volume corev1.Volume) *Builder
- type ContainerBuilder
- func (builder *ContainerBuilder) GetContainerCfg() (*corev1.Container, error)
- func (builder *ContainerBuilder) WithCustomResourcesLimits(resourceList corev1.ResourceList) *ContainerBuilder
- func (builder *ContainerBuilder) WithCustomResourcesRequests(resourceList corev1.ResourceList) *ContainerBuilder
- func (builder *ContainerBuilder) WithDropSecurityCapabilities(sCapabilities []string, redefine bool) *ContainerBuilder
- func (builder *ContainerBuilder) WithEnvVar(name, value string) *ContainerBuilder
- func (builder *ContainerBuilder) WithImagePullPolicy(pullPolicy corev1.PullPolicy) *ContainerBuilder
- func (builder *ContainerBuilder) WithResourceLimit(hugePages, memory string, cpu int64) *ContainerBuilder
- func (builder *ContainerBuilder) WithResourceRequest(hugePages, memory string, cpu int64) *ContainerBuilder
- func (builder *ContainerBuilder) WithSecurityCapabilities(sCapabilities []string, redefine bool) *ContainerBuilder
- func (builder *ContainerBuilder) WithSecurityContext(securityContext *corev1.SecurityContext) *ContainerBuilder
- func (builder *ContainerBuilder) WithVolumeMount(volMount corev1.VolumeMount) *ContainerBuilder
Constants ¶
This section is empty.
Variables ¶
var ( // AllowedSCList list of allowed SecurityCapabilities. AllowedSCList = []string{"NET_RAW", "NET_ADMIN", "SYS_ADMIN", "IPC_LOCK", "ALL"} )
Functions ¶
func GetGVR ¶
func GetGVR() schema.GroupVersionResource
GetGVR returns pod's GroupVersionResource which could be used for Clean function.
func StaticAnnotation ¶
func StaticAnnotation(name string) *multus.NetworkSelectionElement
StaticAnnotation defines network annotation for pod object.
func StaticIPAnnotation ¶
func StaticIPAnnotation(name string, ipAddr []string) []*multus.NetworkSelectionElement
StaticIPAnnotation defines static ip address network annotation for pod object.
func StaticIPAnnotationWithInterfaceAndNamespace ¶
func StaticIPAnnotationWithInterfaceAndNamespace( name, namespace, intName string, ipAddr []string) []*multus.NetworkSelectionElement
StaticIPAnnotationWithInterfaceAndNamespace defines static ip address, interface name and namespace network annotation for pod object.
func StaticIPAnnotationWithInterfaceMacAndNamespace ¶
func StaticIPAnnotationWithInterfaceMacAndNamespace( name, namespace, intName, macAddr string) []*multus.NetworkSelectionElement
StaticIPAnnotationWithInterfaceMacAndNamespace defines static ip address and namespace, interface name, mac address network annotation for pod object.
func StaticIPAnnotationWithMacAddress ¶
func StaticIPAnnotationWithMacAddress(name string, ipAddr []string, macAddr string) []*multus.NetworkSelectionElement
StaticIPAnnotationWithMacAddress defines static ip address and static macaddress network annotation for pod object.
func StaticIPAnnotationWithMacAndNamespace ¶
func StaticIPAnnotationWithMacAndNamespace(name, namespace, macAddr string) []*multus.NetworkSelectionElement
StaticIPAnnotationWithMacAndNamespace defines static ip address and namespace, mac address network annotation for pod object.
func StaticIPAnnotationWithNamespace ¶
func StaticIPAnnotationWithNamespace(name, namespace string, ipAddr []string) []*multus.NetworkSelectionElement
StaticIPAnnotationWithNamespace defines static ip address and namespace network annotation for pod object.
func StaticIPBondAnnotationWithInterface ¶
func StaticIPBondAnnotationWithInterface( bondNadName, bondIntName string, sriovNetworkNameList, ipAddrBond []string) []*multus.NetworkSelectionElement
StaticIPBondAnnotationWithInterface defines static name for bonded interfaces and name, interface and IP for the main bond int.
func StaticIPMultiNetDualStackAnnotation ¶
func StaticIPMultiNetDualStackAnnotation(sriovNets, ipAddr []string) ([]*multus.NetworkSelectionElement, error)
StaticIPMultiNetDualStackAnnotation defines network annotation for multiple interfaces with dual stack addresses.
Types ¶
type AdditionalOptions ¶
AdditionalOptions additional options for pod object.
type Builder ¶
type Builder struct { // Pod definition, used to create the pod object. Definition *corev1.Pod // Created pod object. Object *corev1.Pod // contains filtered or unexported fields }
Builder provides a struct for pod object from the cluster and a pod definition.
func List ¶
func List(apiClient *clients.Settings, nsname string, options ...v1.ListOptions) ([]*Builder, error)
List returns pod inventory in the given namespace.
func ListByNamePattern ¶
ListByNamePattern returns pod inventory in the given namespace filtered by name pattern.
func ListInAllNamespaces ¶
func ListInAllNamespaces(apiClient *clients.Settings, options ...v1.ListOptions) ([]*Builder, error)
ListInAllNamespaces returns a cluster-wide pod inventory.
func NewBuilder ¶
NewBuilder creates a new instance of Builder.
func (*Builder) Copy ¶
Copy returns the contents of a file or path from a specified container into a buffer. Setting the tar option returns a tar archive of the specified path.
func (*Builder) Create ¶
Create makes a pod according to the pod definition and stores the created object in the pod builder.
func (*Builder) CreateAndWaitUntilRunning ¶
CreateAndWaitUntilRunning creates the pod object and waits until the pod is running.
func (*Builder) DefineOnNode ¶
DefineOnNode adds nodeName to the pod's definition.
func (*Builder) DeleteAndWait ¶
DeleteAndWait deletes the pod object and waits until the pod is deleted.
func (*Builder) ExecCommand ¶
func (builder *Builder) ExecCommand(command []string, containerName ...string) (bytes.Buffer, error)
ExecCommand runs command in the pod and returns the buffer output.
func (*Builder) GetFullLog ¶
GetFullLog connects to a pod and fetches the full log since pod creation.
func (*Builder) RedefineDefaultCMD ¶
RedefineDefaultCMD redefines default command in pod's definition.
func (*Builder) RedefineDefaultContainer ¶
RedefineDefaultContainer redefines default container with the new one.
func (*Builder) WaitUntilCondition ¶
func (builder *Builder) WaitUntilCondition(condition corev1.PodConditionType, timeout time.Duration) error
WaitUntilCondition waits for the duration of the defined timeout or until the pod gets to a specific condition.
func (*Builder) WaitUntilDeleted ¶
WaitUntilDeleted waits for the duration of the defined timeout or until the pod is deleted.
func (*Builder) WaitUntilInStatus ¶
WaitUntilInStatus waits for the duration of the defined timeout or until the pod gets to a specific status.
func (*Builder) WaitUntilReady ¶
WaitUntilReady waits for the duration of the defined timeout or until the pod reaches the Ready condition.
func (*Builder) WaitUntilRunning ¶
WaitUntilRunning waits for the duration of the defined timeout or until the pod is running.
func (*Builder) WithAdditionalContainer ¶
WithAdditionalContainer appends additional container to pod.
func (*Builder) WithAdditionalInitContainer ¶
WithAdditionalInitContainer appends additional init container to pod.
func (*Builder) WithHostNetwork ¶
WithHostNetwork applies HostNetwork to pod's definition.
func (*Builder) WithHostPid ¶
WithHostPid configures a pod's access to the host process ID namespace based on a boolean parameter.
func (*Builder) WithHugePages ¶
WithHugePages sets hugePages on all containers inside the pod.
func (*Builder) WithLabels ¶
WithLabels applies a set of labels to a Pod's definition.
func (*Builder) WithLocalVolume ¶
WithLocalVolume attaches given volume to all pod's containers.
func (*Builder) WithNodeSelector ¶
WithNodeSelector adds a nodeSelector configuration inside the pod.
func (*Builder) WithOptions ¶
func (builder *Builder) WithOptions(options ...AdditionalOptions) *Builder
WithOptions creates pod with generic mutation options.
func (*Builder) WithPrivilegedFlag ¶
WithPrivilegedFlag sets privileged flag on all containers.
func (*Builder) WithRestartPolicy ¶
func (builder *Builder) WithRestartPolicy(restartPolicy corev1.RestartPolicy) *Builder
WithRestartPolicy applies restart policy to pod's definition.
func (*Builder) WithSecondaryNetwork ¶
func (builder *Builder) WithSecondaryNetwork(network []*multus.NetworkSelectionElement) *Builder
WithSecondaryNetwork applies Multus secondary network on pod definition.
func (*Builder) WithSecurityContext ¶
func (builder *Builder) WithSecurityContext(securityContext *corev1.PodSecurityContext) *Builder
WithSecurityContext sets SecurityContext on pod definition.
func (*Builder) WithToleration ¶
func (builder *Builder) WithToleration(toleration corev1.Toleration) *Builder
WithToleration adds a toleration configuration inside the pod.
func (*Builder) WithTolerationToControlPlane ¶
WithTolerationToControlPlane sets toleration policy which allows pod to be running on control plane node.
func (*Builder) WithTolerationToMaster ¶
WithTolerationToMaster sets toleration policy which allows pod to be running on master node.
type ContainerBuilder ¶
type ContainerBuilder struct {
// contains filtered or unexported fields
}
ContainerBuilder provides a struct for container's object definition.
func NewContainerBuilder ¶
func NewContainerBuilder(name, image string, cmd []string) *ContainerBuilder
NewContainerBuilder creates a new instance of ContainerBuilder.
func (*ContainerBuilder) GetContainerCfg ¶
func (builder *ContainerBuilder) GetContainerCfg() (*corev1.Container, error)
GetContainerCfg returns Container struct.
func (*ContainerBuilder) WithCustomResourcesLimits ¶
func (builder *ContainerBuilder) WithCustomResourcesLimits(resourceList corev1.ResourceList) *ContainerBuilder
WithCustomResourcesLimits applies custom resource limit struct on container.
func (*ContainerBuilder) WithCustomResourcesRequests ¶
func (builder *ContainerBuilder) WithCustomResourcesRequests(resourceList corev1.ResourceList) *ContainerBuilder
WithCustomResourcesRequests applies custom resource requests struct on container.
func (*ContainerBuilder) WithDropSecurityCapabilities ¶
func (builder *ContainerBuilder) WithDropSecurityCapabilities(sCapabilities []string, redefine bool) *ContainerBuilder
WithDropSecurityCapabilities drops SecurityCapabilities from the container definition.
func (*ContainerBuilder) WithEnvVar ¶
func (builder *ContainerBuilder) WithEnvVar(name, value string) *ContainerBuilder
WithEnvVar adds environment variables to container.
func (*ContainerBuilder) WithImagePullPolicy ¶
func (builder *ContainerBuilder) WithImagePullPolicy(pullPolicy corev1.PullPolicy) *ContainerBuilder
WithImagePullPolicy applies specific image pull policy on container.
func (*ContainerBuilder) WithResourceLimit ¶
func (builder *ContainerBuilder) WithResourceLimit(hugePages, memory string, cpu int64) *ContainerBuilder
WithResourceLimit applies resource limit on container.
func (*ContainerBuilder) WithResourceRequest ¶
func (builder *ContainerBuilder) WithResourceRequest(hugePages, memory string, cpu int64) *ContainerBuilder
WithResourceRequest applies resource request on container.
func (*ContainerBuilder) WithSecurityCapabilities ¶
func (builder *ContainerBuilder) WithSecurityCapabilities(sCapabilities []string, redefine bool) *ContainerBuilder
WithSecurityCapabilities applies SecurityCapabilities to the container definition.
func (*ContainerBuilder) WithSecurityContext ¶
func (builder *ContainerBuilder) WithSecurityContext(securityContext *corev1.SecurityContext) *ContainerBuilder
WithSecurityContext applies security Context on container.
func (*ContainerBuilder) WithVolumeMount ¶
func (builder *ContainerBuilder) WithVolumeMount(volMount corev1.VolumeMount) *ContainerBuilder
WithVolumeMount adds a pod volume mount inside the container.