statefulset

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: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(ctx context.Context, c client.Client, sts *appsv1.StatefulSet) error

Create will create the given statefulset on the api server or return an error on failure

func Delete

func Delete(ctx context.Context, c client.Client, key client.ObjectKey) error

Delete attempts to delete a k8s statefulset if existing or returns an error.

func Get

Get returns the k8s statefulset for the given object key or an error.

func List

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

List returns a list of statefulsets that match the given selector.

func Update

func Update(ctx context.Context, c client.Client, sts *appsv1.StatefulSet, equal EqualityFunc, mutate MutateFunc) error

Update will update an existing statefulset if compare func returns true or else leave it unchanged. Updates are retried with backoff (See retry.DefaultRetry). Returns on failure an non-nil error.

Types

type Builder

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

Builder represents the struct to build k8s statefulsets

func New

func New(statefulSetName, namespace string, labels map[string]string, replicas int32) *Builder

New returns a new Builder instance with a default initialized statefulset.

func (*Builder) Build

func (b *Builder) Build() *appsv1.StatefulSet

Build returns the final statefulset.

func (*Builder) WithSelector

func (b *Builder) WithSelector(s metav1.LabelSelector) *Builder

WithSelector sets the statefulset pod selector.

func (*Builder) WithTemplate

func (b *Builder) WithTemplate(t corev1.PodTemplateSpec) *Builder

WithTemplate sets the statefulset spec pod template spec

func (*Builder) WithUpdateStrategy

func (b *Builder) WithUpdateStrategy(s appsv1.StatefulSetUpdateStrategy) *Builder

WithStrategy sets the statefulset spec update strategy

type EqualityFunc

type EqualityFunc func(current, desired *appsv1.StatefulSet) bool

EqualityFunc is the type for functions that compare two statefulsets. Return true if two statefulset are not not equal.

type MutateFunc

type MutateFunc func(current, desired *appsv1.StatefulSet)

MutateFunc is the type for functions that mutate the current statefulset by applying the values from the desired statefulset.

Jump to

Keyboard shortcuts

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