pod

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2020 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MutatePod

func MutatePod(r Mutate, obj *corev1.PodTemplateSpec) error

Types

type Mutate

type Mutate interface {
	GetPodSecurityContext() *corev1.PodSecurityContext
	GetPodVolumes() []corev1.Volume
	GetPodRestartPolicy() corev1.RestartPolicy
	GetPodNodeSelector() map[string]string
	GetPodAffinity() *corev1.Affinity
	GetPodTolerations() []corev1.Toleration
	GetContainers() []container.Mutate
	container.Mutate
}

type Pod

type Pod struct {
	*meta.ObjectMeta `json:"meta,omitempty"`
	*PodSpec         `json:",inline"`
}

+kubebuilder:object:generate=true

func (*Pod) DeepCopy

func (in *Pod) DeepCopy() *Pod

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Pod.

func (*Pod) DeepCopyInto

func (in *Pod) DeepCopyInto(out *Pod)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Pod) GetContainers

func (spec *Pod) GetContainers() []container.Mutate

func (*Pod) GetInitContainers

func (spec *Pod) GetInitContainers() []container.Mutate

func (*Pod) GetObjectGroup

func (o *Pod) GetObjectGroup() string

func (*Pod) GetObjectKind

func (o *Pod) GetObjectKind() string

func (*Pod) Init

func (obj *Pod) Init()

func (*Pod) Mutate

func (o *Pod) Mutate(obj interfaces.Object) error

type PodSpec

type PodSpec struct {
	Resources corev1.ResourceRequirements `json:"resources,omitempty" protobuf:"bytes,8,opt,name=resources"`
	// SecurityContext holds pod-level security attributes and common container settings.
	// Optional: Defaults to empty.  See type description for default values of each field.
	// +optional
	SecurityContext *corev1.PodSecurityContext `json:"securityContext,omitempty" protobuf:"bytes,14,opt,name=securityContext"`
	// If specified, the pod's scheduling constraints
	// +optional
	Affinity *corev1.Affinity `json:"affinity,omitempty"`
	// Restart policy for all containers within the pod.
	// One of Always, OnFailure, Never.
	// Default to Always.
	// More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy
	// +optional
	RestartPolicy corev1.RestartPolicy `json:"restartPolicy,omitempty"`
	// If specified, the pod's tolerations.
	// +optional
	Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
	// NodeSelector is a selector which must be true for the pod to fit on a node.
	// Selector which must match a node's labels for the pod to be scheduled on that node.
	// More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
	// +optional
	NodeSelector        map[string]string `json:"nodeSelector,omitempty"`
	container.Container `json:",inline"`
	// List of containers belonging to the pod.
	// Containers cannot currently be added or removed.
	// There must be at least one container in a Pod.
	// Cannot be updated.
	// +patchMergeKey=name
	// +patchStrategy=merge
	ExtraContainers []container.Container `json:"extraContainers,omitempty"`
	// List of initialization containers belonging to the pod.
	// Init containers are executed in order prior to containers being started. If any
	// init container fails, the pod is considered to have failed and is handled according
	// to its restartPolicy. The name for an init container or normal container must be
	// unique among all containers.
	// Init containers may not have Lifecycle actions, Readiness probes, Liveness probes, or Startup probes.
	// The resourceRequirements of an init container are taken into account during scheduling
	// by finding the highest request/limit for each resource type, and then using the max of
	// of that value or the sum of the normal containers. Limits are applied to init containers
	// in a similar fashion.
	// Init containers cannot currently be added or removed.
	// Cannot be updated.
	// More info: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/
	// +patchMergeKey=name
	// +patchStrategy=merge
	InitContainers []container.Container `json:"initContainers,omitempty"`
	// ImagePullSecrets is an optional list of references to secrets in the same namespace to use for pulling any of the images used by this PodSpec.
	// If specified, these secrets will be passed to individual puller implementations for them to use. For example,
	// in the case of docker, only DockerConfig type secrets are honored.
	// More info: https://kubernetes.io/docs/concepts/containers/images#specifying-imagepullsecrets-on-a-pod
	// +optional
	// +patchMergeKey=name
	// +patchStrategy=merge
	ImagePullSecrets []corev1.LocalObjectReference `json:"imagePullSecrets,omitempty"`
}

PodSpec is the specification of the desired behavior of the Pod. It is a stripped down version of https://godoc.org/k8s.io/api/core/v1#PodSpec with only user definied specs

Here we consider that a pod has a main container that is embedded in the PodSpec definition

Extra and init containers can also be definied

This is similar to the container / sidecar container pattern

+kubebuilder:object:generate=true

func (*PodSpec) DeepCopy

func (in *PodSpec) DeepCopy() *PodSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodSpec.

func (*PodSpec) DeepCopyInto

func (in *PodSpec) DeepCopyInto(out *PodSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*PodSpec) GetPodAffinity

func (r *PodSpec) GetPodAffinity() *corev1.Affinity

func (*PodSpec) GetPodNodeSelector

func (r *PodSpec) GetPodNodeSelector() map[string]string

func (*PodSpec) GetPodRestartPolicy

func (r *PodSpec) GetPodRestartPolicy() corev1.RestartPolicy

func (*PodSpec) GetPodSecurityContext

func (r *PodSpec) GetPodSecurityContext() *corev1.PodSecurityContext

func (*PodSpec) GetPodTolerations

func (r *PodSpec) GetPodTolerations() []corev1.Toleration

Jump to

Keyboard shortcuts

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