pod

package
v0.0.0-...-a5c132e Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArePodSpecEqual

func ArePodSpecEqual(lhs, rhs corev1.PodSpec, strictTolerations bool) bool

ArePodSpecEqual compares two corev1.PodSpec objects and returns true only if they are equal in any of the following: - Length of containers slice - Node selectors - Tolerations, if strict they need to be the same, non-strict for superset check - Containers: Name, Image, VolumeMounts, EnvVar, Args, Ports, ResourceRequirements

func ArePodTemplateSpecEqual

func ArePodTemplateSpecEqual(lhs, rhs corev1.PodTemplateSpec) bool

ArePodTemplateSpecEqual compares two corev1.PodTemplateSpec objects and returns true only if pod spec are equal and tolerations are strictly the same

func List

func List(ctx context.Context, c client.Client, namespace string, selector map[string]string) ([]corev1.Pod, error)

List returns a list of pods in a namespace that match the given selector

Types

type Builder

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

Builder represents the struct to build k9s podspecs

func NewSpec

func NewSpec(serviceAccountName string, containers []corev1.Container, volumes []corev1.Volume) *Builder

NewSpec returns a new Builder instance with a default initialized podspec

func (*Builder) Build

func (b *Builder) Build() *corev1.PodSpec

Build returns the final podspec

func (*Builder) WithAffinity

func (b *Builder) WithAffinity(a *corev1.Affinity) *Builder

WithAffinity sets the affinity rule for the podspec

func (*Builder) WithNodeSelectors

func (b *Builder) WithNodeSelectors(s map[string]string) *Builder

WithNodeSelectors sets the podsec selectors and ensures that the default linux node selector is always present.

func (*Builder) WithRestartPolicy

func (b *Builder) WithRestartPolicy(rp corev1.RestartPolicy) *Builder

WithRestartPolicy sets the restart policy for the podspec

func (*Builder) WithSecurityContext

func (b *Builder) WithSecurityContext(sc corev1.PodSecurityContext) *Builder

WithSecurityContext sets the security context for the podspec

func (*Builder) WithTerminationGracePeriodSeconds

func (b *Builder) WithTerminationGracePeriodSeconds(p time.Duration) *Builder

WithTerminationGracePeriodSeconds sets the termination grace period for the podspec

func (*Builder) WithTolerations

func (b *Builder) WithTolerations(t ...corev1.Toleration) *Builder

WithTolerations appends tolerations to the podspec

Jump to

Keyboard shortcuts

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