statefulset

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Poll is a poll interval for StatefulSet tests
	Poll = 2 * time.Second
	// Timeout is a timeout interval for StatefulSet operations
	Timeout = 1800 * time.Second
	// K8sMissScaleError command's been lost by the k8s, need to retry
	K8sMissScaleError = "the object has been modified; please apply your changes to the latest version and try again"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// KubeClient *core.KubeClient
	Interface tappsv1.StatefulSetInterface
	ClientSet kubernetes.Interface
	Namespace string
	Timeout   int
}

Client contains go-client interface for making namespaced StatefulSet Kubernetes API calls

func (*Client) Create

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

Create uses client interface to make API call for creating provided StatefulSet

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, sts *appsv1.StatefulSet) *StatefulSet

Delete method deletes StatefulSet from namespace and returns StatefulSet object with Deleted field set to true

func (*Client) DeleteAll

func (c *Client) DeleteAll(ctx context.Context) error

DeleteAll deletes all statefulsets

func (*Client) DeleteWithOptions

func (c *Client) DeleteWithOptions(ctx context.Context, sts *appsv1.StatefulSet, opts metav1.DeleteOptions) *StatefulSet

DeleteWithOptions method deletes StatefulSet from namespace and returns StatefulSet object with Deleted field set to true

func (*Client) MakeStatefulSet

func (c *Client) MakeStatefulSet(config *Config) *appsv1.StatefulSet

MakeStatefulSet returns new go-client StatefulSet object from provided config

func (*Client) MakeStatefulSetFromYaml

func (c *Client) MakeStatefulSetFromYaml(filePath string) *appsv1.StatefulSet

MakeStatefulSetFromYaml creates and returns new go-client StatefulSet object by parsing provided .yaml file

func (*Client) Scale

func (c *Client) Scale(ctx context.Context, sts *appsv1.StatefulSet, count int32) *StatefulSet

Scale makes API call to update existing resource replicas to new value of `count`

func (*Client) Update

func (c *Client) Update(_ *appsv1.StatefulSet) *StatefulSet

Update makes API call to update existing resource with new Spec provided in `sts`

type Config

type Config struct {
	VolumeNumber        int
	Replicas            int32
	VolumeName          string
	MountPath           string
	StorageClassName    string
	PodManagementPolicy string
	ClaimSize           string
	ContainerName       string
	ContainerImage      string
	NamePrefix          string
	Command             []string
	Args                []string
	Annotations         map[string]string
	Labels              map[string]string
}

Config can be used as config for creation of new StatefulSets

type StatefulSet

type StatefulSet struct {
	Client  *Client
	Set     *appsv1.StatefulSet
	Deleted bool
	// contains filtered or unexported fields
}

StatefulSet bounds go-client StatefulSet object and client

func (*StatefulSet) GetError

func (sts *StatefulSet) GetError() error

GetError returns statefulset error

func (*StatefulSet) GetPodList

func (sts *StatefulSet) GetPodList(ctx context.Context) (*v1.PodList, error)

GetPodList returns all pods that belong to StatefulSet

func (*StatefulSet) HasError

func (sts *StatefulSet) HasError() bool

HasError checks if statefulset contains error

func (*StatefulSet) Sync

func (sts *StatefulSet) Sync(ctx context.Context) *StatefulSet

Sync makes sure that previous StatefulSet operation is completed

func (*StatefulSet) WaitForRunningAndReady

func (sts *StatefulSet) WaitForRunningAndReady(ctx context.Context, numPodsRunning, _ int32) error

WaitForRunningAndReady stalls provided number of pods is running and ready

func (*StatefulSet) WaitUntilGone

func (sts *StatefulSet) WaitUntilGone(ctx context.Context) error

WaitUntilGone stalls until said StatefulSet no longer can be found in Kubernetes

Jump to

Keyboard shortcuts

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