kube

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OperatorEnabled   = "pvc-autoscaler-operator.kubernetes.io/enabled"
	OperatorName      = "pvc-autoscaler-operator.kubernetes.io/operator-name"
	OperatorNamespace = "pvc-autoscaler-operator.kubernetes.io/operator-namespace"
	OperatorImage     = "pvc-autoscaler-operator.kubernetes.io/sidecar-image"
)
View Source
const (
	EventWarning = "Warning"
	EventNormal  = "Normal"
)

The two accepted event types for recording events.

View Source
const (
	ControllerField = ".spec.podDiskInspector"
)

Fields.

Variables

This section is empty.

Functions

func GetNamespace added in v0.0.3

func GetNamespace() string

func IgnoreAlreadyExists

func IgnoreAlreadyExists(err error) error

IgnoreAlreadyExists returns nil if err reason is "already exists".

func IgnoreNotFound

func IgnoreNotFound(err error) error

IgnoreNotFound returns nil if err reason is "not found".

func IsAlreadyExists

func IsAlreadyExists(err error) bool

IsAlreadyExists determines if the error indicates that a specified resource already exists. It supports wrapped errors and returns false when the error is nil.

func IsNotFound

func IsNotFound(err error) bool

IsNotFound returns true if the err reason is "not found".

func ToName

func ToName(val string) string

ToName normalizes val per kubernetes name constraints to a max of 253 characters. See: https://unofficial-kubernetes.readthedocs.io/en/latest/concepts/overview/working-with-objects/names/

Types

type EventReporter

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

EventReporter both logs and records events.

func NewEventReporter

func NewEventReporter(logger logr.Logger, recorder record.EventRecorder, resource runtime.Object) EventReporter

func (EventReporter) Debug

func (r EventReporter) Debug(msg string, keysAndValues ...interface{})

Debug logs as a debug log entry.

func (EventReporter) Error

func (r EventReporter) Error(err error, msg string, keysAndValues ...interface{})

Error logs as an error log entry.

func (EventReporter) Info

func (r EventReporter) Info(msg string, keysAndValues ...interface{})

Info logs as an info log entry.

func (EventReporter) RecordError

func (r EventReporter) RecordError(reason string, err error)

RecordError records a warning event.

func (EventReporter) RecordInfo

func (r EventReporter) RecordInfo(reason, msg string)

RecordInfo records a normal event.

func (EventReporter) UpdateResource

func (r EventReporter) UpdateResource(resource runtime.Object) EventReporter

type Logger

type Logger interface {
	Info(msg string, keysAndValues ...interface{})
	Debug(msg string, keysAndValues ...interface{})
	Error(err error, msg string, keysAndValues ...interface{})
}

Logger is a structured logger

func ToLogger

func ToLogger(log logr.Logger) Logger

ToLogger converts a logr.Logger to a Logger.

type ReconcileError

type ReconcileError interface {
	error
	// IsTransient returns true if the error is temporary.
	IsTransient() bool
}

ReconcileError is a controller-specific error.

func TransientError

func TransientError(err error) ReconcileError

TransientError can be recovered or retried.

func UnrecoverableError

func UnrecoverableError(err error) ReconcileError

UnrecoverableError cannot be recovered and should not be retried.

type ReconcileErrors

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

ReconcileErrors is a collection of ReconcileError

func (*ReconcileErrors) Any

func (errs *ReconcileErrors) Any() bool

Any returns true if any errors were collected.

func (*ReconcileErrors) Append

func (errs *ReconcileErrors) Append(err ReconcileError)

Append adds the ReconcileError.

func (*ReconcileErrors) Error

func (errs *ReconcileErrors) Error() string

func (*ReconcileErrors) IsTransient

func (errs *ReconcileErrors) IsTransient() bool

IsTransient returns true if all errors are transient. False if at least one is not transient.

type Reporter

type Reporter interface {
	Logger
	RecordInfo(reason, msg string)
	RecordError(reason string, err error)
}

Reporter logs and reports various events.

Jump to

Keyboard shortcuts

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