defaultinterpreter

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SecretsField indicates the 'secrets' field of a service account
	SecretsField = "secrets"
)

Variables

ValidatePodName can be used to check whether the given pod name is valid. Prefix indicates this name will be used as part of generation, in which case trailing dashes are allowed.

Functions

func GetPodFromTemplate added in v1.1.0

func GetPodFromTemplate(template *corev1.PodTemplateSpec, parentObject runtime.Object, controllerRef *metav1.OwnerReference) (*corev1.Pod, error)

GetPodFromTemplate generates pod object from a template.

func VisitContainers added in v1.1.0

func VisitContainers(podSpec *corev1.PodSpec, mask ContainerType, visitor ContainerVisitor) bool

VisitContainers invokes the visitor function with a pointer to every container spec in the given pod spec with type set in mask. If visitor returns false, visiting is short-circuited. VisitContainers returns true if visiting completes, false if visiting was short-circuited.

func VisitPodConfigmapNames added in v1.1.0

func VisitPodConfigmapNames(pod *corev1.Pod, visitor Visitor) bool

VisitPodConfigmapNames invokes the visitor function with the name of every configmap referenced by the pod spec. If visitor returns false, visiting is short-circuited. Transitive references (e.g. pod -> pvc -> pv -> secret) are not visited. Returns true if visiting completed, false if visiting was short-circuited.

func VisitPodSecretNames added in v1.1.0

func VisitPodSecretNames(pod *corev1.Pod, visitor Visitor) bool

VisitPodSecretNames invokes the visitor function with the name of every secret referenced by the pod spec. If visitor returns false, visiting is short-circuited. Transitive references (e.g. pod -> pvc -> pv -> secret) are not visited. Returns true if visiting completed, false if visiting was short-circuited.

Types

type ContainerType added in v1.1.0

type ContainerType int

ContainerType signifies container type

const (
	// Containers is for normal containers
	Containers ContainerType = 1 << iota
	// InitContainers is for init containers
	InitContainers
	// EphemeralContainers is for ephemeral containers
	EphemeralContainers
)

AllContainers specifies that all containers be visited

type ContainerVisitor added in v1.1.0

type ContainerVisitor func(container *corev1.Container, containerType ContainerType) (shouldContinue bool)

ContainerVisitor is called with each container spec, and returns true if visiting should continue.

type DefaultInterpreter

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

DefaultInterpreter contains all default operation interpreter factory for interpreting common resource.

func NewDefaultInterpreter

func NewDefaultInterpreter() *DefaultInterpreter

NewDefaultInterpreter return a new DefaultInterpreter.

func (*DefaultInterpreter) AggregateStatus added in v1.1.0

func (e *DefaultInterpreter) AggregateStatus(object *unstructured.Unstructured, aggregatedStatusItems []workv1alpha2.AggregatedStatusItem) (*unstructured.Unstructured, error)

AggregateStatus returns the objects that based on the 'object' but with status aggregated.

func (*DefaultInterpreter) GetDependencies added in v1.1.0

func (e *DefaultInterpreter) GetDependencies(object *unstructured.Unstructured) (dependencies []configv1alpha1.DependentObjectReference, err error)

GetDependencies returns the dependent resources of the given object.

func (*DefaultInterpreter) GetReplicas

GetReplicas returns the desired replicas of the object as well as the requirements of each replica.

func (*DefaultInterpreter) HookEnabled

HookEnabled tells if any hook exist for specific resource type and operation type.

func (*DefaultInterpreter) Retain

func (e *DefaultInterpreter) Retain(desired *unstructured.Unstructured, observed *unstructured.Unstructured) (retained *unstructured.Unstructured, err error)

Retain returns the objects that based on the "desired" object but with values retained from the "observed" object.

func (*DefaultInterpreter) ReviseReplica added in v1.0.0

func (e *DefaultInterpreter) ReviseReplica(object *unstructured.Unstructured, replica int64) (*unstructured.Unstructured, error)

ReviseReplica revises the replica of the given object.

type Visitor added in v1.1.0

type Visitor func(name string) (shouldContinue bool)

Visitor is called with each object name, and returns true if visiting should continue

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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