inplaceupdate

package
v1.7.3 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: Apache-2.0 Imports: 28 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Clock clock.Clock = clock.RealClock{}
)

Functions

func DefaultCheckInPlaceUpdateCompleted added in v0.10.0

func DefaultCheckInPlaceUpdateCompleted(pod *v1.Pod) error

DefaultCheckInPlaceUpdateCompleted checks whether imageID in pod status has been changed since in-place update. If the imageID in containerStatuses has not been changed, we assume that kubelet has not updated containers in Pod.

func GetCondition

func GetCondition(pod *v1.Pod) *v1.PodCondition

GetCondition returns the InPlaceUpdateReady condition in Pod.

func GetTemplateFromRevision added in v0.5.0

func GetTemplateFromRevision(revision *apps.ControllerRevision) (*v1.PodTemplateSpec, error)

GetTemplateFromRevision returns the pod template parsed from ControllerRevision.

func InjectReadinessGate

func InjectReadinessGate(pod *v1.Pod)

InjectReadinessGate injects InPlaceUpdateReady into pod.spec.readinessGates

Types

type Interface

type Interface interface {
	CanUpdateInPlace(oldRevision, newRevision *apps.ControllerRevision, opts *UpdateOptions) bool
	Update(pod *v1.Pod, oldRevision, newRevision *apps.ControllerRevision, opts *UpdateOptions) UpdateResult
	Refresh(pod *v1.Pod, opts *UpdateOptions) RefreshResult
}

Interface for managing pods in-place update.

func New

func New(c client.Client, revisionAdapter revisionadapter.Interface) Interface

func NewForInformer

func NewForInformer(informer coreinformers.PodInformer, revisionAdapter revisionadapter.Interface) Interface

func NewForTypedClient

func NewForTypedClient(c clientset.Interface, revisionAdapter revisionadapter.Interface) Interface

type RefreshResult added in v0.4.1

type RefreshResult struct {
	RefreshErr    error
	DelayDuration time.Duration
}

type UpdateOptions added in v0.4.1

type UpdateOptions struct {
	IgnoreVolumeClaimTemplatesHashDiff bool

	GracePeriodSeconds int32
	AdditionalFuncs    []func(*v1.Pod)

	CalculateSpec                  func(oldRevision, newRevision *apps.ControllerRevision, opts *UpdateOptions) *UpdateSpec
	PatchSpecToPod                 func(pod *v1.Pod, spec *UpdateSpec, state *appspub.InPlaceUpdateState) (*v1.Pod, error)
	CheckPodUpdateCompleted        func(pod *v1.Pod) error
	CheckContainersUpdateCompleted func(pod *v1.Pod, state *appspub.InPlaceUpdateState) error
	GetRevision                    func(rev *apps.ControllerRevision) string
}

func SetOptionsDefaults added in v0.8.0

func SetOptionsDefaults(opts *UpdateOptions) *UpdateOptions

type UpdateResult added in v0.4.1

type UpdateResult struct {
	InPlaceUpdate      bool
	UpdateErr          error
	DelayDuration      time.Duration
	NewResourceVersion string
}

type UpdateSpec added in v0.5.0

type UpdateSpec struct {
	Revision string `json:"revision"`

	ContainerImages       map[string]string            `json:"containerImages,omitempty"`
	ContainerRefMetadata  map[string]metav1.ObjectMeta `json:"containerRefMetadata,omitempty"`
	MetaDataPatch         []byte                       `json:"metaDataPatch,omitempty"`
	UpdateEnvFromMetadata bool                         `json:"updateEnvFromMetadata,omitempty"`
	GraceSeconds          int32                        `json:"graceSeconds,omitempty"`

	OldTemplate *v1.PodTemplateSpec `json:"oldTemplate,omitempty"`
	NewTemplate *v1.PodTemplateSpec `json:"newTemplate,omitempty"`
}

UpdateSpec records the images of containers which need to in-place update.

Jump to

Keyboard shortcuts

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