Documentation
¶
Index ¶
- Constants
- Variables
- func CompareStructs(a, b interface{}) bool
- func FormatStruct(obj interface{}) string
- func GetDeltaString(spec interface{}, current interface{}, parameters map[string]interface{}) (string, error)
- func GetDeploymentScope(instance StarlingxInstance) (string, error)
- func NewChangeAfterInSync(msg string) error
- func NewHTTPSClientRequired(msg string) error
- func NewHostNotifyError(msg string) error
- func NewMissingKubernetesResource(msg string) error
- func NewPlatformNetworkReconciliationError(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 UpdateDefaultsRequired(manager manager.CloudManager, namespace string, name string, factory bool) (bool, error)
- func UpdateDeploymentScope(client client.Client, instance StarlingxInstance) (bool, error)
- type BaseError
- type ChangeAfterReconciled
- type ErrMissingKubernetesResource
- type ErrResourceConfigurationDependency
- type ErrResourceStatusDependency
- type ErrSystemDependency
- type ErrUserDataError
- type ErrorHandler
- type EventLogger
- type HTTPSClientRequired
- type HostNotifyError
- type MergeTransformer
- type PlatformNetworkReconciliationError
- type ReconcilerErrorHandler
- type ReconcilerEventLogger
- type StarlingxInstance
- type ValidationError
Constants ¶
const ( ResourceCreated = "Created" ResourceUpdated = "Updated" ResourceDeleted = "Deleted" ResourceWait = "Wait" ResourceDependency = "Dependency" ResourceNotified = "Notified" )
Common event record reasons
const ( NoChangesAfterReconciled = "configuration changes ignored after initial synchronization has completed" ChangedAllowedAfterReconciled = "manual override; allowing configuration changes after initial synchronization" NoProvisioningAfterReconciled = "resource provisioning ignored after initial synchronization has completed" ProvisioningAllowedAfterReconciled = "manual override; allowing resource provisioning after initial synchronization" )
Defines common log strings from commonly performed validation checks across all different reconcilers.
const ParentFound = "parent_found"
Constant for processLines and searchParameters when gathering the Delta config
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} // RetryCephPrimaryGroupNotReady should be used whenever a storage node needs to wait // for the ceph primary storage group to finish its reconcile task. RetryCephPrimaryGroupNotReady = reconcile.Result{Requeue: true} // 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} // RetryNever is used when the reconciler will be triggered by a separate // mechanism and no retry is necessary. RetryNever = reconcile.Result{Requeue: false} // Properties contained on System resource SystemProperties = map[string]interface{}{ "certificates": nil, "contact": nil, "description": nil, "dnsServers": nil, "latitude": nil, "license": nil, "location": nil, "longitude": nil, "ntpServers": nil, "ptp": []string{"mode", "transport", "mechanism"}, "serviceParameters": nil, "storage": []string{"filesystems", "drbd", "backends"}, "vswitchType": nil, } // Properties contained on Host resource HostProperties = map[string]interface{}{ "addresses": []string{"address", "interface", "prefix"}, "administrativeState": nil, "appArmor": nil, "base": nil, "boardManagement": []string{"address", "credentials"}, "bootDevice": nil, "bootMAC": nil, "clockSynchronization": nil, "console": nil, "hwSettle": nil, "installOutput": nil, "interfaces": []string{"bond", "ethernet", "vf", "vlan"}, "labels": nil, "location": nil, "maxCPUMHzConfigured": nil, "memory": nil, "personality": nil, "powerOn": nil, "processors": nil, "provisioningMode": nil, "ptpInstances": nil, "rootDevice": nil, "routes": []string{"gateway", "interface", "metric", "prefix", "subnet"}, "storage": []string{"filesystems", "monitor", "osds", "volumeGroups"}, "subfunctions": nil, } )
var DefaultMergeTransformer = MergeTransformer{OverwriteSlices: true}
DefaultMergeTransformer defines the default behaviour used throughout this package.
Functions ¶
func CompareStructs ¶
func CompareStructs(a, b interface{}) bool
func FormatStruct ¶
func FormatStruct(obj interface{}) string
func GetDeltaString ¶
func GetDeploymentScope ¶
func GetDeploymentScope(instance StarlingxInstance) (string, error)
GetDeploymentScope is to get the deploymentScope from the last applied configuration and set expected value based on the data.
func NewChangeAfterInSync ¶
NewChangeAfterInSync defines a constructor for the ChangeAfterReconciled error type.
func NewHTTPSClientRequired ¶
NewHTTPSClientRequired defines a constructor for the HTTPClientRequired error type.
func NewHostNotifyError ¶
NewHostNotifyError defines a constructor for the HostNotifyError error type.
func NewMissingKubernetesResource ¶
NewMissingKubernetesResource defines a constructor for the ErrMissingKubernetesResource error type.
func NewPlatformNetworkReconciliationError ¶
NewPlatformNetworkReconciliationError defines a constructor for the PlatformNetworkReconciliationError 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 UpdateDefaultsRequired ¶
func UpdateDefaultsRequired( manager manager.CloudManager, namespace string, name string, factory bool, ) (bool, error)
UpdateDefaultRequired checks if the host default need to be updated.
func UpdateDeploymentScope ¶
func UpdateDeploymentScope(client client.Client, instance StarlingxInstance) (bool, error)
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 ChangeAfterReconciled ¶
type ChangeAfterReconciled struct {
BaseError
}
ChangeAfterReconciled 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.
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
type ErrResourceConfigurationDependency ¶
type ErrResourceConfigurationDependency struct {
BaseError
}
ErrResourceConfigurationDependency defines an error to be used when reporting that an operation is unable to continue because a resource is not configured correctly.
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.
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.
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.
type ErrorHandler ¶
type ErrorHandler struct { logr.Logger manager.CloudManager }
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) 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. The intent is that this should only be used when declaring a reconciler error... all other events should use "NormalEvent".
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.
type HostNotifyError ¶
type HostNotifyError struct {
BaseError
}
HostNotifyError defines an error to be used when active host controller is already being notified while the address pool / platform network reconciler attempts to notify. Reconciliation request can be requeued immediately for such instances.
type MergeTransformer ¶
type MergeTransformer struct {
OverwriteSlices bool
}
MergeTransformer defines a struct used to pass behaviour attributes to the merge function so that our transformer can be controller from outside of the mergo API.
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.
type PlatformNetworkReconciliationError ¶
type PlatformNetworkReconciliationError struct {
BaseError
}
PlatformNetworkReconciliationError defines an error to be used when reconciliation of platform network / address pool resources fail and the reconciliation request needs to be requeued.
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 { 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 StarlingxInstance ¶
type ValidationError ¶
type ValidationError struct {
BaseError
}
ValidationError defines a new error type used to differentiate data validation errors from other types of errors.