Documentation ¶
Index ¶
- Constants
- Variables
- func ContainsString(slice []string, s string) bool
- func FormatStruct(obj interface{}) string
- func IsNumericType(kind reflect.Kind) bool
- func NewChangeAfterInSync(msg string) error
- func NewHTTPSClientRequired(msg string) error
- func NewMissingKubernetesResource(msg string) error
- func NewResourceConfigurationDependency(msg string) error
- func NewResourceStatusDependency(msg string) error
- func NewSystemDependency(msg string) error
- func NewUserDataError(msg string) error
- func NewValidationError(msg string) error
- func RemoveString(slice []string, s string) (result []string)
- type BaseError
- type ChangeAfterInSync
- type ErrMissingKubernetesResource
- type ErrResourceStatusDependency
- type ErrSystemDependency
- type ErrUserDataError
- type ErrorHandler
- type EventLogger
- func (in *EventLogger) Event(object runtime.Object, eventtype string, reason string, messageFmt string, ...)
- func (in *EventLogger) NormalEvent(object runtime.Object, reason string, messageFmt string, args ...interface{})
- func (in *EventLogger) WarningEvent(object runtime.Object, reason string, messageFmt string, args ...interface{})
- type HTTPSClientRequired
- type MergeTransformer
- type ReconcilerErrorHandler
- type ReconcilerEventLogger
- type ValidationError
Constants ¶
const ( ResourceCreated = "Created" ResourceUpdated = "Updated" ResourceDeleted = "Deleted" ResourceWait = "Wait" ResourceDependency = "Dependency" )
Common event record reasons
Variables ¶
var ( // RetryImmediate should be used whenever a known transient error is // detected and there is a very likely that retrying immediately will // succeed. For example, RetryImmediate = reconcile.Result{Requeue: true, RequeueAfter: time.Second} // RetrySystemNotReady should be used whenever a controller needs to wait // for the system controller to finish its reconcile task. The system // controller kicks the other controllers when it has finish so there // is no need to automatically requeue these events. RetrySystemNotReady = reconcile.Result{Requeue: false} // RetryMissingClient should be used for any object reconciliation that // fails because of the platform client is missing or was reset. The system // controller is responsible for re-creating the client and it will kick // the other controllers once it has re-established a connection to the // target system. RetryMissingClient = reconcile.Result{Requeue: false} // RetryTransientError should be used for any object reconciliation that // fails because of a transient error and needs to be re-attempted at a // future time. RetryTransientError = reconcile.Result{Requeue: true, RequeueAfter: 20 * time.Second} // RetryUserError should be used for any errors caught after an API request // that is likely due to data validation errors. These could theoretically // not retry and just sit and wait for the user to correct the error, but // to mitigate against dependency errors or transient errors we will retry. RetryUserError = reconcile.Result{Requeue: true, RequeueAfter: time.Minute} // RetryValidationError should be used for any errors resulting from an // upfront validation error. There is no point in trying again since the // data is invalid. Just wait for the user to correct the issue. RetryValidationError = reconcile.Result{Requeue: false} // RetryServerError should be used for any errors caught after an API // request that is likely due to internal server errors. These could // theoretically not retry and just sit and wait for the user to correct the // error, but to mitigate against dependency errors or transient errors we // will retry. RetryServerError = reconcile.Result{Requeue: true, RequeueAfter: time.Minute} // RetryNetworkError should be used for any DNS resolution errors. There // is a good chance that these errors will persist for a while until the // user intervenes so slow down retry attempts. RetryResolutionError = reconcile.Result{Requeue: true, RequeueAfter: 5 * time.Minute} // RetryNetworkError should be used for any errors caught after a API // request that is likely due to network errors. This could happen // because of a misconfiguration of the endpoint URL or whenever the system // becomes temporarily unreachable. We need to retry until the system // becomes reachable. Since the most likely explanation is that the // active controller was rebooted then it makes sense to keep retrying // frequently because it will come back relatively quickly. // TODO(alegacy): consider backing off using a rate limiter queue. RetryNetworkError = reconcile.Result{Requeue: true, RequeueAfter: 15 * time.Second} )
Functions ¶
func ContainsString ¶
func FormatStruct ¶
func FormatStruct(obj interface{}) string
func IsNumericType ¶
IsNumericType determines whether the type specified is one of the built-in numeric type values. from github.com/imdario/mergo
func NewChangeAfterInSync ¶
NewChangeAfterInSync defines a constructor for the ChangeAfterInSync error type.
func NewHTTPSClientRequired ¶
NewHTTPSClientRequired defines a constructor for the HTTPClientRequired error type.
func NewMissingKubernetesResource ¶
NewMissingKubernetesResource defines a constructor for the ErrMissingKubernetesResource error type.
func NewResourceConfigurationDependency ¶
NewResourceConfigurationDependency defines a constructor for the ErrResourceStatusDependency error type.
func NewResourceStatusDependency ¶
NewResourceStatusDependency defines a constructor for the ErrResourceStatusDependency error type.
func NewSystemDependency ¶
NewSystemDependency defines a constructor for the ErrSystemDependency error type.
func NewUserDataError ¶
NewUserDataError defines a constructor for the ErrUserDataError error type.
func NewValidationError ¶
NewValidationError defines a constructor for the ValidationError error type.
func RemoveString ¶
Types ¶
type BaseError ¶
type BaseError struct {
// contains filtered or unexported fields
}
BaseError defines the common error reporting struct for all other errors defined in this package
type ChangeAfterInSync ¶
type ChangeAfterInSync struct {
BaseError
}
ChangeAfterInSync defines a new error type used to signal that a a configuration changes was received after the resource has already been synchronized with the system state.
func (ChangeAfterInSync) Error ¶
func (in ChangeAfterInSync) Error() string
Error defines the struct to string conversion function specific to the controller error struct.
type ErrMissingKubernetesResource ¶
type ErrMissingKubernetesResource struct {
BaseError
}
ErrMissingKubernetesResource defines an error to be used when reporting that an operation is unable to find a required resource from the kubernetes API. This error is not intended for system resources that are missing. For those use ErrMissingSystemResource
func (ErrMissingKubernetesResource) Error ¶
func (in ErrMissingKubernetesResource) Error() string
Error returns the message associated with an error of this type.
type ErrResourceStatusDependency ¶
type ErrResourceStatusDependency struct {
BaseError
}
ErrResourceStatusDependency defines an error to be used when reporting that an operation is unable to continue because a resource is not in the correct state.
func (ErrResourceStatusDependency) Error ¶
func (in ErrResourceStatusDependency) Error() string
Error returns the message associated with an error of this type.
type ErrSystemDependency ¶
type ErrSystemDependency struct {
BaseError
}
ErrSystemDependency defines an error to be used when reporting that the system itself or a set of multiple resources are not in the correct state to proceed with an operation.
func (ErrSystemDependency) Error ¶
func (in ErrSystemDependency) Error() string
Error returns the message associated with an error of this type.
type ErrUserDataError ¶
type ErrUserDataError struct {
BaseError
}
ErrUserDataError defines an error to be used when reporting that an operation is unable to continue because the requested configuration is incorrect or incomplete.
func (ErrUserDataError) Error ¶
func (in ErrUserDataError) Error() string
Error returns the message associated with an error of this type.
type ErrorHandler ¶
type ErrorHandler struct { logr.Logger manager.TitaniumManager }
ErrorHandler is the common implementation of the ReconcilerErrorHandler interface.
func (*ErrorHandler) HandleReconcilerError ¶
func (h *ErrorHandler) HandleReconcilerError(request reconcile.Request, in error) (result reconcile.Result, err error)
HandleReconcilerError is the common error handler implementation for all controllers. It is responsible for looking at the type of error that was caught and determine what the best resolution might be.
type EventLogger ¶
type EventLogger struct { record.EventRecorder logr.Logger }
EventLogger is an implementation of a ReconcilerEventLogger. Its purpose is to simultaneously generate a log with every event and to prefix each event message with the object name.
func (*EventLogger) Event ¶
func (in *EventLogger) Event(object runtime.Object, eventtype string, reason string, messageFmt string, args ...interface{})
Event is a method used to generate a log and an event for a given set of message, event type, and reason.
func (*EventLogger) NormalEvent ¶
func (in *EventLogger) NormalEvent(object runtime.Object, reason string, messageFmt string, args ...interface{})
NormalEvent generates a log and event for a "normal" event.
func (*EventLogger) WarningEvent ¶
func (in *EventLogger) WarningEvent(object runtime.Object, reason string, messageFmt string, args ...interface{})
WarningEvent generates a log and event for a "warning" event.
type HTTPSClientRequired ¶
type HTTPSClientRequired struct {
BaseError
}
HTTPSClientRequired defines a new error type used to signal that a a configuration changes requires an HTTPS URL before continuing.
func (HTTPSClientRequired) Error ¶
func (in HTTPSClientRequired) Error() string
Error defines the struct to string conversion function specific to the controller error struct.
type MergeTransformer ¶
type MergeTransformer struct {
OverwriteSlices bool
}
func (MergeTransformer) Transformer ¶
Transformer implements a struct merge strategy for arrays and slices. The default mergo approach to merging slices is to leave them intact unless the AppendSlices modifier is used. That would cause both the parent and subclass arrays to be concatenated together. This transformer provides a way to replace individual array elements if they are found to match an element in the destination array. This is only possible if the array element structs implement the IsKeyEqual method. TODO(alegacy): can these lambda functions be refactored out to standalone
functions.
type ReconcilerErrorHandler ¶
type ReconcilerErrorHandler interface {
HandleReconcilerError(request reconcile.Request, in error) (reconcile.Result, error)
}
ReconcilerErrorHandler defines the interface type associated to any reconciler error handler.
type ReconcilerEventLogger ¶
type ReconcilerEventLogger interface { Event(object runtime.Object, eventtype string, reason string, messageFmt string, args ...interface{}) NormalEvent(object runtime.Object, reason string, messageFmt string, args ...interface{}) WarningEvent(object runtime.Object, reason string, messageFmt string, args ...interface{}) }
ReconcilerEventLogger is an interface that is intended to allow specialized behavior when generating an event.
type ValidationError ¶
type ValidationError struct {
BaseError
}
ValidationError defines a new error type used to differentiate data validation errors from other types of errors.
func (ValidationError) Error ¶
func (in ValidationError) Error() string
Error defines the struct to string conversion function specific to the controller error struct.