v1alpha1

package
v0.0.0-...-a88c85e Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2019 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(opts ...OptionFunc) corev1.Container

New returns a new kubernetes container

Types

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

Builder provides utilities required to build a kubernetes container type

func NewBuilder

func NewBuilder() *Builder

NewBuilder returns a new instance of builder

func (*Builder) AddCheck

func (b *Builder) AddCheck(p Predicate) *Builder

AddCheck adds the predicate as a condition to be validated against the container instance

func (*Builder) AddChecks

func (b *Builder) AddChecks(p []Predicate) *Builder

AddChecks adds the provided predicates as conditions to be validated against the container instance

func (*Builder) Build

func (b *Builder) Build() (corev1.Container, error)

Build returns the final kubernetes container

func (*Builder) WithArgumentsNew

func (b *Builder) WithArgumentsNew(args []string) *Builder

WithArgumentsNew sets the command arguments of the container

func (*Builder) WithCommandNew

func (b *Builder) WithCommandNew(cmd []string) *Builder

WithCommandNew sets the command of the container

func (*Builder) WithEnvs

func (b *Builder) WithEnvs(envs []corev1.EnvVar) *Builder

WithEnvs sets the envs of the container

func (*Builder) WithEnvsNew

func (b *Builder) WithEnvsNew(envs []corev1.EnvVar) *Builder

WithEnvsNew sets the envs of the container

func (*Builder) WithImage

func (b *Builder) WithImage(img string) *Builder

WithImage sets the image of the container

func (*Builder) WithImagePullPolicy

func (b *Builder) WithImagePullPolicy(policy corev1.PullPolicy) *Builder

WithImagePullPolicy sets the image pull policy of the container

func (*Builder) WithLifeCycle

func (b *Builder) WithLifeCycle(lc *corev1.Lifecycle) *Builder

WithLifeCycle sets the life cycle of the container

func (*Builder) WithLivenessProbe

func (b *Builder) WithLivenessProbe(liveness *corev1.Probe) *Builder

WithLivenessProbe sets the liveness probe of the container

func (*Builder) WithName

func (b *Builder) WithName(name string) *Builder

WithName sets the name of the container

func (*Builder) WithPortsNew

func (b *Builder) WithPortsNew(ports []corev1.ContainerPort) *Builder

WithPortsNew sets ports of the container

func (*Builder) WithPrivilegedSecurityContext

func (b *Builder) WithPrivilegedSecurityContext(privileged *bool) *Builder

WithPrivilegedSecurityContext sets securitycontext of the container

func (*Builder) WithResources

func (b *Builder) WithResources(
	resources *corev1.ResourceRequirements,
) *Builder

WithResources sets resources of the container

func (*Builder) WithResourcesByValue

func (b *Builder) WithResourcesByValue(resources corev1.ResourceRequirements) *Builder

WithResourcesByValue sets resources of the container

func (*Builder) WithVolumeMountsNew

func (b *Builder) WithVolumeMountsNew(volumeMounts []corev1.VolumeMount) *Builder

WithVolumeMountsNew sets the command arguments of the container

type OptionFunc

type OptionFunc func(*container)

OptionFunc is a typed function that abstracts anykind of operation against the provided container instance

This is the basic building block to create functional operations against the container instance

func WithImage

func WithImage(img string) OptionFunc

WithImage sets the image of the container

func WithName

func WithName(name string) OptionFunc

WithName sets the name of the container

type Predicate

type Predicate func(*container) (nameOrMsg string, ok bool)

Predicate abstracts conditional logic w.r.t the container instance

NOTE: Predicate is a functional approach versus traditional approach to mix conditions such as *if-else* within blocks of business logic

NOTE: Predicate approach enables clear separation of conditionals from imperatives i.e. actions that form the business logic

Jump to

Keyboard shortcuts

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