builders

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 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 EndpointsBuilder added in v0.2.1

type EndpointsBuilder interface {
	// WithNamespace sets namespace for the pod to be built
	WithNamespace(namespace string) EndpointsBuilder
	// WithSubset adds a subset to the Endpoints
	WithSubset(ports []corev1.EndpointPort, pods []string) EndpointsBuilder
	// Build builds the Endpoints
	Build() *corev1.Endpoints
}

EndpointsBuilder defines the methods for building a service EndPoints

func NewEndPointsBuilder added in v0.2.1

func NewEndPointsBuilder(service string) EndpointsBuilder

NewEndPointsBuilder creates a new EndpointsBuilder for a given service

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