podspec

package
v1.23.1 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package podspec contains various utilities to deal with Pod Specs

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

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

Builder enables to user to create a PodTemplate starting from a baseline and adding patches

func New

func New() *Builder

New creates a new empty podTemplate builder

func NewFrom

func NewFrom(podTemplate *apiv1.PodTemplateSpec) *Builder

NewFrom creates a podTemplate builder from a certain Pod template

func (*Builder) Build

func (builder *Builder) Build() *apiv1.PodTemplateSpec

Build gets the final Pod template

func (*Builder) WithAnnotation

func (builder *Builder) WithAnnotation(name, value string) *Builder

WithAnnotation adds an annotation to the current status

func (*Builder) WithContainer

func (builder *Builder) WithContainer(name string) *Builder

WithContainer ensures that in the current status there is a container with the passed name

func (*Builder) WithContainerCommand

func (builder *Builder) WithContainerCommand(name string, command []string, overwrite bool) *Builder

WithContainerCommand ensures that, if in the current status there is a container with the passed name and the command is empty, the command will be set to the one passed. If `overwrite` is true the command is overwritten even when it's not empty

func (*Builder) WithContainerEnv

func (builder *Builder) WithContainerEnv(name string, env corev1.EnvVar, overwrite bool) *Builder

WithContainerEnv add the provided EnvVar to a container

func (*Builder) WithContainerImage

func (builder *Builder) WithContainerImage(name, image string, overwrite bool) *Builder

WithContainerImage ensures that, if in the current status there is a container with the passed name and the image is empty, the image will be set to the one passed. If `overwrite` is true the image is overwritten even when it's not empty

func (*Builder) WithContainerPort

func (builder *Builder) WithContainerPort(name string, value *corev1.ContainerPort) *Builder

WithContainerPort ensures that, if in the current status there is a container with the passed name the passed container port will be added, possibly overriding the one already present with the same name

func (*Builder) WithContainerSecurityContext added in v1.15.3

func (builder *Builder) WithContainerSecurityContext(
	name string,
	ctx *corev1.SecurityContext,
	overwrite bool,
) *Builder

WithContainerSecurityContext ensures that, if in the current status there is a container with the passed name and the securityContext is empty, the securityContext will be set to the one passed. If `overwrite` is true the command is overwritten even when it's not empty

func (*Builder) WithContainerVolumeMount

func (builder *Builder) WithContainerVolumeMount(
	name string, volumeMount *corev1.VolumeMount, overwrite bool,
) *Builder

WithContainerVolumeMount ensure that the passed the volume mount exist in the current status, overriding the present one when needed

func (*Builder) WithInitContainer

func (builder *Builder) WithInitContainer(name string) *Builder

WithInitContainer ensures that in the current status there is an init container with the passed name

func (*Builder) WithInitContainerCommand

func (builder *Builder) WithInitContainerCommand(name string, command []string, overwrite bool) *Builder

WithInitContainerCommand ensures that, if in the current status there is an init container with the passed name and the command is empty, the command will be set to the one passed. If `overwrite` is true the command is overwritten even when it's not empty

func (*Builder) WithInitContainerImage

func (builder *Builder) WithInitContainerImage(name, image string, overwrite bool) *Builder

WithInitContainerImage ensures that, if in the current status there is an init container with the passed name and the image is empty, the image will be set to the one passed. If `overwrite` is true the image is overwritten even when it's not empty

func (*Builder) WithInitContainerSecurityContext added in v1.15.3

func (builder *Builder) WithInitContainerSecurityContext(
	name string,
	ctx *corev1.SecurityContext,
	overwrite bool,
) *Builder

WithInitContainerSecurityContext ensures that, if in the current status there is an init container with the passed name and the securityContext is empty, the securityContext will be set to the one passed. If `overwrite` is true the securityContext is overwritten even when it's not empty

func (*Builder) WithInitContainerVolumeMount

func (builder *Builder) WithInitContainerVolumeMount(
	name string, volumeMount *corev1.VolumeMount, overwrite bool,
) *Builder

WithInitContainerVolumeMount ensure that the passed the volume mount exist in the current status, overriding the present one when needed

func (*Builder) WithLabel

func (builder *Builder) WithLabel(name, value string) *Builder

WithLabel adds a label to the current status

func (*Builder) WithLivenessProbe

func (builder *Builder) WithLivenessProbe(name string, livenessProbe *corev1.Probe, overwrite bool) *Builder

WithLivenessProbe add the provided liveness probe to a container

func (*Builder) WithReadinessProbe

func (builder *Builder) WithReadinessProbe(name string, readinessProbe *corev1.Probe, overwrite bool) *Builder

WithReadinessProbe add the provided readiness probe to a container

func (*Builder) WithSecurityContext added in v1.15.3

func (builder *Builder) WithSecurityContext(
	securityCtx *corev1.PodSecurityContext,
	overwrite bool,
) *Builder

WithSecurityContext adds a securityContext to the current podTemplate is nil. If `overwrite` is true the securityContext is overwritten even when it's not empty

func (*Builder) WithServiceAccountName

func (builder *Builder) WithServiceAccountName(name string, overwrite bool) *Builder

WithServiceAccountName add the provided ServiceAccountName

func (*Builder) WithVolume

func (builder *Builder) WithVolume(volume *corev1.Volume) *Builder

WithVolume adds a volume to the current podTemplate, replacing the current definition if present

Jump to

Keyboard shortcuts

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