Documentation ¶
Index ¶
- Constants
- func GetNamespace() string
- func IgnoreAlreadyExists(err error) error
- func IgnoreNotFound(err error) error
- func IsAlreadyExists(err error) bool
- func IsNotFound(err error) bool
- func ToName(val string) string
- type EventReporter
- func (r EventReporter) Debug(msg string, keysAndValues ...interface{})
- func (r EventReporter) Error(err error, msg string, keysAndValues ...interface{})
- func (r EventReporter) Info(msg string, keysAndValues ...interface{})
- func (r EventReporter) RecordError(reason string, err error)
- func (r EventReporter) RecordInfo(reason, msg string)
- func (r EventReporter) UpdateResource(resource runtime.Object) EventReporter
- type Logger
- type ReconcileError
- type ReconcileErrors
- type Reporter
Constants ¶
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" )
const ( EventWarning = "Warning" EventNormal = "Normal" )
The two accepted event types for recording events.
const (
ControllerField = ".spec.podDiskInspector"
)
Fields.
Variables ¶
This section is empty.
Functions ¶
func GetNamespace ¶ added in v0.0.3
func GetNamespace() string
func IgnoreAlreadyExists ¶
IgnoreAlreadyExists returns nil if err reason is "already exists".
func IgnoreNotFound ¶
IgnoreNotFound returns nil if err reason is "not found".
func IsAlreadyExists ¶
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 ¶
IsNotFound returns true if the err reason is "not found".
func ToName ¶
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
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.