deployment

package
v0.0.0-...-81cd6e7 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: Apache-2.0 Imports: 8 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, dpl *appsv1.Deployment) error

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

func CreateOrUpdate

func CreateOrUpdate(ctx context.Context, c client.Client, dpl *appsv1.Deployment, equal EqualityFunc, mutate MutateFunc) error

CreateOrUpdate attempts first to get the given deployment. If the deployment does not exist, the deployment will be created. Otherwise, if the deployment exists and the provided comparison func detects any changes an update is attempted. Updates are retried with backoff (See retry.DefaultRetry). Returns on failure an non-nil error.

func Delete

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

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

func Get

Get returns the k8s deployment 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.Deployment, error)

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

func ListPods

func ListPods(ctx context.Context, c client.Client, name, namespace string, selector map[string]string) ([]corev1.Pod, error)

ListPods returns the replica sets for a deployment and given selector.

func ListReplicaSets

func ListReplicaSets(ctx context.Context, c client.Client, name, namespace string, selector map[string]string) ([]appsv1.ReplicaSet, error)

ListReplicaSets returns the replica sets for a deployment and given selector.

func Update

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

Update will update an existing deployment if compare func returns true or else leave it unchanged

Types

type Builder

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

Builder represents the struct to build k8s deployments

func New

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

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

func (*Builder) Build

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

Build returns the final deployment.

func (*Builder) WithPaused

func (b *Builder) WithPaused(p bool) *Builder

WithPaused sets the deployment spec paused flag

func (*Builder) WithProgressDeadlineSeconds

func (b *Builder) WithProgressDeadlineSeconds(pds int32) *Builder

WithProgressDeadlineSeconds sets the deployment ProgressDeadlineSeconds

func (*Builder) WithSelector

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

WithSelector sets the deployment pod selector.

func (*Builder) WithStrategy

func (b *Builder) WithStrategy(s appsv1.DeploymentStrategyType) *Builder

WithStrategy sets the deployment strategy

func (*Builder) WithTemplate

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

WithTemplate sets the deployment pod template spec

type EqualityFunc

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

EqualityFunc is the type for functions that compare two deployments. Return true if two deployment are equal.

type MutateFunc

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

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

Jump to

Keyboard shortcuts

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