reconcilerutil

package
v2.11.26 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package reconcilerutil holds utility functions for Kf reconcilers similar to go's ioutil and httputil packages.

Index

Constants

This section is empty.

Variables

AddFinalizer adds a finalizer to the given object.

RemoveFinalizer removes a finalizer from the given object.

Functions

func HasFinalizer

func HasFinalizer(obj metav1.Object, finalizer string) bool

HasFinalizer checks if an object has a finalizer.

func HealthCheckerMain

func HealthCheckerMain(ctx context.Context, addr, component string, ctors ...injection.ControllerConstructor)

HealthCheckerMain wraps sharedmain.Main and therefore blocks until the controller is shutdown. The main difference is it starts a health endpoint on addr. Any constructor that implements HealthChecker will be used to determine if the endpoint returns a 204 or a 503.

func IsConflictOSBError

func IsConflictOSBError(err error) bool

Types

type HealthChecker

type HealthChecker interface {
	Healthy(ctx context.Context) error
}

HealthChecker has a Healthy method that gets invoked periodically to determine the health of the controller.

type StructuredStatsReporter added in v2.11.16

type StructuredStatsReporter struct {
	// Logger to write structured output to.
	// Must be set before Report functions are called.
	Logger *zap.SugaredLogger

	// Clock is an optional clock.
	Clock func() time.Time
	// contains filtered or unexported fields
}

StructuredStatsReporter logs events

func (*StructuredStatsReporter) MaybeReport added in v2.11.16

func (s *StructuredStatsReporter) MaybeReport() bool

MaybeReport writes a report to the logger if it hasn't been done recently. Returns true if the report was triggered and the internal state was updated.

func (*StructuredStatsReporter) ReportQueueDepth added in v2.11.16

func (s *StructuredStatsReporter) ReportQueueDepth(v int64) error

ReportQueueDepth reports the queue depth metric

func (*StructuredStatsReporter) ReportReconcile added in v2.11.16

func (s *StructuredStatsReporter) ReportReconcile(duration time.Duration, success string, key types.NamespacedName) error

ReportReconcile reports the count and latency metrics for a reconcile operation

Jump to

Keyboard shortcuts

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