statefulset

package
v0.12.3 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StatefulSetComplete

func StatefulSetComplete(sts *appsv1.StatefulSet) bool

StatefulSetComplete return true if StatefulSet is considered ready

Two strategies: OnDelete, RollingUpdate

OnDelete can be tracked in two situations: - resource is created - replicas attribute is changed A more sophisticated solution that will check Revision of Pods is not needed because of required manual intervention

RollingUpdate is automatic, so we can rely on the CurrentReplicas and UpdatedReplicas counters.

func StatefulSetRolloutStatus

func StatefulSetRolloutStatus(sts *appsv1.StatefulSet) (string, bool, error)

StatefulSetRolloutStatus returns a message describing statefulset status, and a bool value indicating if the status is considered done. A code from kubectl sources. Doesn't work well for OnDelete, downscale and partition: 0 case. https://github.com/kubernetes/kubernetes/issues/72212 Now used only for debug purposes

Types

type Feed

type Feed interface {
	controller.ControllerFeed

	OnStatus(func(StatefulSetStatus) error)

	GetStatus() StatefulSetStatus
	Track(name, namespace string, kube kubernetes.Interface, opts tracker.Options) error
}

func NewFeed

func NewFeed() Feed

type PodAddedReport

type PodAddedReport struct {
	ReplicaSetPod     replicaset.ReplicaSetPod
	StatefulSetStatus StatefulSetStatus
}

type PodErrorReport

type PodErrorReport struct {
	ReplicaSetPodError replicaset.ReplicaSetPodError
	StatefulSetStatus  StatefulSetStatus
}

type StatefulSetStatus

type StatefulSetStatus struct {
	appsv1.StatefulSetStatus

	StatusGeneration uint64

	ReplicasIndicator *indicators.Int64GreaterOrEqualConditionIndicator
	ReadyIndicator    *indicators.Int64GreaterOrEqualConditionIndicator
	UpToDateIndicator *indicators.Int64GreaterOrEqualConditionIndicator

	WaitingForMessages []string
	WarningMessages    []string

	IsReady      bool
	IsFailed     bool
	FailedReason string

	Pods         map[string]pod.PodStatus
	NewPodsNames []string
}

func NewStatefulSetStatus

func NewStatefulSetStatus(object *appsv1.StatefulSet, statusGeneration uint64, isFailed bool, failedReason string, warningMessages []string, podsStatuses map[string]pod.PodStatus, newPodsNames []string) StatefulSetStatus

type Tracker

type Tracker struct {
	tracker.Tracker

	State      tracker.TrackerState
	Conditions []string

	TrackedPodsNames []string

	Added  chan StatefulSetStatus
	Ready  chan StatefulSetStatus
	Failed chan StatefulSetStatus
	Status chan StatefulSetStatus

	EventMsg    chan string
	AddedPod    chan PodAddedReport
	PodLogChunk chan *replicaset.ReplicaSetPodLogChunk
	PodError    chan PodErrorReport
	// contains filtered or unexported fields
}

func NewTracker

func NewTracker(name, namespace string, kube kubernetes.Interface, opts tracker.Options) *Tracker

func (*Tracker) Track

func (d *Tracker) Track(ctx context.Context) (err error)

Track starts tracking of StatefulSet rollout process. watch only for one StatefulSet resource with name d.ResourceName within the namespace with name d.Namespace Watcher can wait for namespace creation and then for StatefulSet creation watcher receives added event if StatefulSet is started watch is infinite by default there is option StopOnAvailable — if true, watcher stops after StatefulSet has available status you can define custom stop triggers using custom implementation of ControllerFeed.

Jump to

Keyboard shortcuts

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