Documentation ¶
Index ¶
- func CreateOrUpdate(ctx context.Context, c client.Client, sm *monitoringv1.ServiceMonitor, ...) error
- func Equal(current, desired *monitoringv1.ServiceMonitor) bool
- func Mutate(current, desired *monitoringv1.ServiceMonitor)
- type Builder
- func (b *Builder) Build() *monitoringv1.ServiceMonitor
- func (b *Builder) WithEndpoints(ep ...monitoringv1.Endpoint) *Builder
- func (b *Builder) WithJobLabel(l string) *Builder
- func (b *Builder) WithNamespaceSelector(nss monitoringv1.NamespaceSelector) *Builder
- func (b *Builder) WithSelector(s metav1.LabelSelector) *Builder
- type EqualityFunc
- type MutateFunc
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 (*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 ¶
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.