builders

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package builders offers functions for building test objects

Package builders offers functions for building test objects

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultServicePorts

func DefaultServicePorts() []corev1.ServicePort

DefaultServicePorts returns an array of ServicePort with default values

Types

type PodBuilder

type PodBuilder interface {
	// Build returns a Pod with the attributes defined in the PodBuilder
	Build() *corev1.Pod
	// WithNamespace sets namespace for the pod to be built
	WithNamespace(namespace string) PodBuilder
	// WithLabels sets the labels for the pod to be built
	WithLabels(labels map[string]string) PodBuilder
	// WithStatus sets the PodPhase for the pod  to be built
	WithStatus(status corev1.PodPhase) PodBuilder
}

PodBuilder defines the methods for building a Pod

func NewPodBuilder

func NewPodBuilder(name string) PodBuilder

NewPodBuilder creates a new instance of PodBuilder with the given pod name and default attributes such as containers and namespace

type ServiceBuilder

type ServiceBuilder interface {
	// Build returns a Service with the attributes defined in the ServiceBuilder
	Build() *corev1.Service
	// WithNamespace sets namespace for the pod to be built
	WithNamespace(namespace string) ServiceBuilder
	// WithPorts sets the ports exposed by the service
	WithPorts(ports []corev1.ServicePort) ServiceBuilder
	// WithSelector sets the service's selector labels
	WithSelector(labels map[string]string) ServiceBuilder
}

ServiceBuilder defines the methods for building a service

func NewServiceBuilder

func NewServiceBuilder(name string) ServiceBuilder

NewServiceBuilder creates a new instance of ServiceBuilder with the given pod name and default attributes

Jump to

Keyboard shortcuts

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