servicemonitor

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 CreateOrUpdate

func CreateOrUpdate(ctx context.Context, c client.Client, sm *monitoringv1.ServiceMonitor, equal EqualityFunc, mutate MutateFunc) error

CreateOrUpdate attempts first to get the given servicemonitor. If the servicemonitor does not exist, the servicemonitor will be created. Otherwise, if the servicemonitor 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 Equal

func Equal(current, desired *monitoringv1.ServiceMonitor) bool

Equal return only true if the service monitors are equal

func Mutate

func Mutate(current, desired *monitoringv1.ServiceMonitor)

Mutate is a default mutation function for servicemonitors that copies only mutable fields from desired to current.

Types

type Builder

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

Builder represents the struct to build servicemonitors

func New

func New(smName, namespace string, labels map[string]string) *Builder

New returns a Builder for servicemonitors.

func (*Builder) Build

func (b *Builder) Build() *monitoringv1.ServiceMonitor

Build returns the final servicemonitor

func (*Builder) WithEndpoints

func (b *Builder) WithEndpoints(ep ...monitoringv1.Endpoint) *Builder

WithEndpoints appends endpoints to the servicemonitor

func (*Builder) WithJobLabel

func (b *Builder) WithJobLabel(l string) *Builder

WithJobLabel sets the servicemonitor job label

func (*Builder) WithNamespaceSelector

func (b *Builder) WithNamespaceSelector(nss monitoringv1.NamespaceSelector) *Builder

WithNamespaceSelector sets ths servicemonitor namespace selector

func (*Builder) WithSelector

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

WithSelector sets the servicemonitor selector

type EqualityFunc

type EqualityFunc func(current, desired *monitoringv1.ServiceMonitor) bool

EqualityFunc is the type for functions that compare two servicemonitors. Return true if two service are equal.

type MutateFunc

type MutateFunc func(current, desired *monitoringv1.ServiceMonitor)

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

Jump to

Keyboard shortcuts

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