Documentation ¶
Index ¶
- func Create(ctx context.Context, c client.Client, dpl *appsv1.Deployment) error
- func CreateOrUpdate(ctx context.Context, c client.Client, dpl *appsv1.Deployment, ...) error
- func Delete(ctx context.Context, c client.Client, key client.ObjectKey) error
- func Get(ctx context.Context, c client.Client, key client.ObjectKey) (*appsv1.Deployment, error)
- func List(ctx context.Context, c client.Client, namespace string, ...) ([]appsv1.Deployment, error)
- func ListPods(ctx context.Context, c client.Client, name, namespace string, ...) ([]corev1.Pod, error)
- func ListReplicaSets(ctx context.Context, c client.Client, name, namespace string, ...) ([]appsv1.ReplicaSet, error)
- func Update(ctx context.Context, c client.Client, dpl *appsv1.Deployment, ...) error
- type Builder
- func (b *Builder) Build() *appsv1.Deployment
- func (b *Builder) WithPaused(p bool) *Builder
- func (b *Builder) WithProgressDeadlineSeconds(pds int32) *Builder
- func (b *Builder) WithSelector(s metav1.LabelSelector) *Builder
- func (b *Builder) WithStrategy(s appsv1.DeploymentStrategyType) *Builder
- func (b *Builder) WithTemplate(t corev1.PodTemplateSpec) *Builder
- type EqualityFunc
- type MutateFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Create ¶
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 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 (*Builder) Build ¶
func (b *Builder) Build() *appsv1.Deployment
Build returns the final deployment.
func (*Builder) WithPaused ¶
WithPaused sets the deployment spec paused flag
func (*Builder) WithProgressDeadlineSeconds ¶
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.