Documentation ¶
Overview ¶
Package podspec contains various utilities to deal with Pod Specs
Index ¶
- type Builder
- func (builder *Builder) Build() *apiv1.PodTemplateSpec
- func (builder *Builder) WithAnnotation(name, value string) *Builder
- func (builder *Builder) WithContainer(name string) *Builder
- func (builder *Builder) WithContainerCommand(name string, command []string, overwrite bool) *Builder
- func (builder *Builder) WithContainerEnv(name string, env corev1.EnvVar, overwrite bool) *Builder
- func (builder *Builder) WithContainerImage(name, image string, overwrite bool) *Builder
- func (builder *Builder) WithContainerPort(name string, value *corev1.ContainerPort) *Builder
- func (builder *Builder) WithContainerSecurityContext(name string, ctx *corev1.SecurityContext, overwrite bool) *Builder
- func (builder *Builder) WithContainerVolumeMount(name string, volumeMount *corev1.VolumeMount, overwrite bool) *Builder
- func (builder *Builder) WithInitContainer(name string) *Builder
- func (builder *Builder) WithInitContainerCommand(name string, command []string, overwrite bool) *Builder
- func (builder *Builder) WithInitContainerImage(name, image string, overwrite bool) *Builder
- func (builder *Builder) WithInitContainerSecurityContext(name string, ctx *corev1.SecurityContext, overwrite bool) *Builder
- func (builder *Builder) WithInitContainerVolumeMount(name string, volumeMount *corev1.VolumeMount, overwrite bool) *Builder
- func (builder *Builder) WithLabel(name, value string) *Builder
- func (builder *Builder) WithLivenessProbe(name string, livenessProbe *corev1.Probe, overwrite bool) *Builder
- func (builder *Builder) WithReadinessProbe(name string, readinessProbe *corev1.Probe, overwrite bool) *Builder
- func (builder *Builder) WithSecurityContext(securityCtx *corev1.PodSecurityContext, overwrite bool) *Builder
- func (builder *Builder) WithServiceAccountName(name string, overwrite bool) *Builder
- func (builder *Builder) WithVolume(volume *corev1.Volume) *Builder
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 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 ¶
WithAnnotation adds an annotation to the current status
func (*Builder) WithContainer ¶
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 ¶
WithContainerEnv add the provided EnvVar to a container
func (*Builder) WithContainerImage ¶
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 ¶
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 ¶
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) 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 ¶
WithServiceAccountName add the provided ServiceAccountName