Documentation ¶
Index ¶
- type ARMResourceModifier
- type ARMResourceModifierFunc
- type ClaimFunc
- type Claimer
- type DeleteFunc
- type Deleter
- type ErrorClassifier
- type ErrorClassifierFunc
- type ImportResult
- type Importer
- type ImporterFunc
- type KubernetesExportFunc
- type PostReconcileCheckFunc
- type PostReconcileCheckResult
- type PostReconciliationChecker
- type PreReconcileCheckFunc
- type PreReconcileCheckResult
- type PreReconciliationChecker
- type SuccessFunc
- type SuccessfulCreationHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ARMResourceModifier ¶
type ARMResourceModifier interface { // ModifyARMResource takes a genruntime.ARMResource and returns an updated genruntime.ARMResource. The updated resource // is then serialized and sent to ARM in the body of a PUT request. ModifyARMResource( ctx context.Context, armClient *genericarmclient.GenericClient, armObj genruntime.ARMResource, obj genruntime.ARMMetaObject, kubeClient kubeclient.Client, resolver *resolver.Resolver, log logr.Logger, ) (genruntime.ARMResource, error) }
ARMResourceModifier provides a hook allowing resources to modify the payload that will be sent to ARM just before it is sent.
type ARMResourceModifierFunc ¶
type ARMResourceModifierFunc = func(ctx context.Context, obj genruntime.ARMMetaObject, armObj genruntime.ARMResource) (genruntime.ARMResource, error)
func CreateARMResourceModifier ¶
func CreateARMResourceModifier( host genruntime.ResourceExtension, armClient *genericarmclient.GenericClient, kubeClient kubeclient.Client, resolver *resolver.Resolver, log logr.Logger) ARMResourceModifierFunc
CreateARMResourceModifier returns a function that performs per-resource modifications. If the ARMResourceModifier extension has not been implemented for the resource in question, the default behavior is to return the provided genruntime.ARMResource unmodified.
type ClaimFunc ¶
type ClaimFunc = func(ctx context.Context, log logr.Logger, obj genruntime.ARMOwnedMetaObject) error
ClaimFunc is the signature of a function that can be used to create a default Claimer
func CreateClaimer ¶
func CreateClaimer( host genruntime.ResourceExtension, next ClaimFunc) ClaimFunc
CreateClaimer creates a ClaimFunc. If the resource in question has not implemented the Claimer interface the provided default ClaimFunc is run by default.
type Claimer ¶
type Claimer interface { // Claim claims the resource Claim(ctx context.Context, log logr.Logger, obj genruntime.ARMOwnedMetaObject, next ClaimFunc) error }
Claimer can be implemented to customize how the reconciler claims a resource
type DeleteFunc ¶
type DeleteFunc = func( ctx context.Context, log logr.Logger, resolver *resolver.Resolver, armClient *genericarmclient.GenericClient, obj genruntime.ARMMetaObject) (ctrl.Result, error)
DeleteFunc is the signature of a function that can be used to create a default Deleter
func CreateDeleter ¶
func CreateDeleter( host genruntime.ResourceExtension, next DeleteFunc) DeleteFunc
CreateDeleter creates a DeleteFunc. If the resource in question has not implemented the Deleter interface the provided default DeleteFunc is run by default.
type Deleter ¶
type Deleter interface { // Delete deletes the resource Delete( ctx context.Context, log logr.Logger, resolver *resolver.Resolver, armClient *genericarmclient.GenericClient, obj genruntime.ARMMetaObject, next DeleteFunc) (ctrl.Result, error) }
Deleter can be implemented to customize how the reconciler deletes resources
type ErrorClassifier ¶
type ErrorClassifier interface { // ClassifyError evaluates the provided error, returning including whether it is fatal or can be retried. // cloudError is the error returned from ARM. // apiVersion is the ARM API version used for the request. // log is a logger than can be used for telemetry. // next is the next implementation to call. ClassifyError( cloudError *genericarmclient.CloudError, apiVersion string, log logr.Logger, next ErrorClassifierFunc) (core.CloudErrorDetails, error) }
ErrorClassifier can be implemented to customize how the reconciler reacts to specific errors
type ErrorClassifierFunc ¶
type ErrorClassifierFunc func(cloudError *genericarmclient.CloudError) (core.CloudErrorDetails, error)
ErrorClassifierFunc is the signature of a function that can be used to create a DefaultErrorClassifier
func CreateErrorClassifier ¶
func CreateErrorClassifier( host genruntime.ResourceExtension, classifier ErrorClassifierFunc, apiVersion string, log logr.Logger, ) ErrorClassifierFunc
type ImportResult ¶
type ImportResult struct {
// contains filtered or unexported fields
}
ImportResult is the result of doing an import.
func ImportSkipped ¶
func ImportSkipped(because string) ImportResult
ImportSkipped creates a new ImportResult for a resource that was not imported.
func ImportSucceeded ¶
func ImportSucceeded() ImportResult
ImportSucceeded creates a new ImportResult with a resource that was imported successfully.
func (ImportResult) Skipped ¶
func (r ImportResult) Skipped() (string, bool)
Skipped returns a reason and true if the import was skipped, empty string and false otherwise.
type Importer ¶
type Importer interface { // Import allows interception of the import process. // ctx is the current asynchronous context // resource is the resource being imported. // owner is an optional owner for the resource. // next is a function to call to do the actual import. Import( ctx context.Context, rsrc genruntime.ImportableResource, owner *genruntime.ResourceReference, next ImporterFunc, ) (ImportResult, error) }
Importer is an optional interface that can be implemented by resource extensions to customize the import process.
type ImporterFunc ¶
type ImporterFunc func( ctx context.Context, resource genruntime.ImportableResource, owner *genruntime.ResourceReference, ) (ImportResult, error)
ImporterFunc is the signature of the function that does the actual import.
type KubernetesExportFunc ¶
type KubernetesExportFunc = func(obj genruntime.MetaObject) ([]client.Object, error)
func CreateKubernetesExporter ¶
func CreateKubernetesExporter( ctx context.Context, host genruntime.ResourceExtension, armClient *genericarmclient.GenericClient, log logr.Logger) KubernetesExportFunc
CreateKubernetesExporter creates a function to create Kubernetes resources. If the resource in question has not been configured with the genruntime.KubernetesExporter interface, the returned function is a no-op.
type PostReconcileCheckFunc ¶
type PostReconcileCheckFunc func( ctx context.Context, obj genruntime.MetaObject, owner genruntime.MetaObject, resourceResolver *resolver.Resolver, armClient *genericarmclient.GenericClient, log logr.Logger, ) (PostReconcileCheckResult, error)
func CreatePostReconciliationChecker ¶
func CreatePostReconciliationChecker( host genruntime.ResourceExtension, ) (PostReconcileCheckFunc, bool)
CreatePostReconciliationChecker creates a checker that can be used to check if we want to customise the condition on the resource after reconciliation. If the resource in question has not implemented the PostReconciliationChecker interface, the provided default checker is returned directly. We also return a bool indicating whether the resource extension implements the PostReconciliationChecker interface. host is a resource extension that may implement the PostReconciliationChecker interface.
type PostReconcileCheckResult ¶
type PostReconcileCheckResult struct {
// contains filtered or unexported fields
}
func PostReconcileCheckResultFailure ¶
func PostReconcileCheckResultFailure(reason string) PostReconcileCheckResult
PostReconcileCheckResultFailure indicates post reconciliation check of a resource is currently failed by returning a PostReconcileCheckResult with action `Failure`. reason is an explanatory reason to show to the user via a warning condition on the resource.
func PostReconcileCheckResultSuccess ¶
func PostReconcileCheckResultSuccess() PostReconcileCheckResult
PostReconcileCheckResultSuccess indicates that a resource is ready after reconciliation by returning a PostReconcileCheckResult with action `Success`.
func (PostReconcileCheckResult) CreateConditionError ¶
func (r PostReconcileCheckResult) CreateConditionError() error
CreateConditionError returns an error that can be used to set a condition on the resource.
func (PostReconcileCheckResult) Message ¶
func (r PostReconcileCheckResult) Message() string
func (PostReconcileCheckResult) ReconciliationFailed ¶
func (r PostReconcileCheckResult) ReconciliationFailed() bool
func (PostReconcileCheckResult) ReconciliationSucceeded ¶
func (r PostReconcileCheckResult) ReconciliationSucceeded() bool
type PostReconciliationChecker ¶
type PostReconciliationChecker interface { // PostReconcileCheck does a post-reconcile check to see if the resource is in a state to set 'Ready' condition. // ARM resources should implement this if they need to defer the Ready condition until later. // Returns PostReconcileCheckResultSuccess if the reconciliation is successful. // Returns PostReconcileCheckResultFailure and a human-readable reason if the reconciliation should put a condition on resource. // ctx is the current operation context. // obj is the resource about to be reconciled. The resource's State will be freshly updated. // owner is the parent resource of obj. This can be nil in some cases like `ResourceGroups` and `Alias`. // kubeClient allows access to the cluster for any required queries. // armClient allows access to ARM for any required queries. // log is the logger for the current operation. PostReconcileCheck( ctx context.Context, obj genruntime.MetaObject, owner genruntime.MetaObject, resourceResolver *resolver.Resolver, armClient *genericarmclient.GenericClient, log logr.Logger, next PostReconcileCheckFunc, ) (PostReconcileCheckResult, error) }
PostReconciliationChecker is implemented by resources that want to do extra status checks after a full ARM reconcile.
type PreReconcileCheckFunc ¶
type PreReconcileCheckFunc func( ctx context.Context, obj genruntime.MetaObject, owner genruntime.MetaObject, resourceResolver *resolver.Resolver, armClient *genericarmclient.GenericClient, log logr.Logger, ) (PreReconcileCheckResult, error)
func CreatePreReconciliationChecker ¶
func CreatePreReconciliationChecker( host genruntime.ResourceExtension, ) (PreReconcileCheckFunc, bool)
CreatePreReconciliationChecker creates a checker that can be used to check if a resource is ready for reconciliation. If the resource in question has not implemented the PreReconciliationChecker interface, the provided default checker is returned directly. We also return a bool indicating whether the resource extension implements the PreReconciliationChecker interface. host is a resource extension that may implement the PreReconciliationChecker interface.
type PreReconcileCheckResult ¶
type PreReconcileCheckResult struct {
// contains filtered or unexported fields
}
func BlockReconcile ¶
func BlockReconcile(reason string) PreReconcileCheckResult
BlockReconcile indicates reconciliation of a resource is currently blocked by returning a PreReconcileCheckResult with action `Block`. reason is an explanatory reason to show to the user via a warning condition on the resource.
func PostponeReconcile ¶
func PostponeReconcile() PreReconcileCheckResult
PostponeReconcile indicates reconciliation of a resource is not currently required by returning a PreReconcileCheckResult with action `Postpone`.
func ProceedWithReconcile ¶
func ProceedWithReconcile() PreReconcileCheckResult
ProceedWithReconcile indicates that a resource is ready for reconciliation by returning a PreReconcileCheckResult with action `Proceed`.
func (PreReconcileCheckResult) BlockReconciliation ¶
func (r PreReconcileCheckResult) BlockReconciliation() bool
func (PreReconcileCheckResult) CreateConditionError ¶
func (r PreReconcileCheckResult) CreateConditionError() error
CreateConditionError returns an error that can be used to set a condition on the resource.
func (PreReconcileCheckResult) Message ¶
func (r PreReconcileCheckResult) Message() string
func (PreReconcileCheckResult) PostponeReconciliation ¶
func (r PreReconcileCheckResult) PostponeReconciliation() bool
type PreReconciliationChecker ¶
type PreReconciliationChecker interface { // PreReconcileCheck does a pre-reconcile check to see if the resource is in a state that can be reconciled. // ARM resources should implement this to avoid reconciliation attempts that cannot possibly succeed. // Returns ProceedWithReconcile if the reconciliation should go ahead. // Returns BlockReconcile and a human-readable reason if the reconciliation should be skipped. // ctx is the current operation context. // obj is the resource about to be reconciled. The resource's State will be freshly updated. // kubeClient allows access to the cluster for any required queries. // armClient allows access to ARM for any required queries. // log is the logger for the current operation. // next is the next (nested) implementation to call. PreReconcileCheck( ctx context.Context, obj genruntime.MetaObject, owner genruntime.MetaObject, resourceResolver *resolver.Resolver, armClient *genericarmclient.GenericClient, log logr.Logger, next PreReconcileCheckFunc, ) (PreReconcileCheckResult, error) }
PreReconciliationChecker is implemented by resources that want to do extra checks before proceeding with a full ARM reconcile.
type SuccessFunc ¶
type SuccessFunc = func(obj genruntime.ARMMetaObject) error
SuccessFunc is the signature of a function that can be used to create a default SuccessfulCreationHandler
func CreateSuccessfulCreationHandler ¶
func CreateSuccessfulCreationHandler( host genruntime.ResourceExtension, log logr.Logger) SuccessFunc
CreateSuccessfulCreationHandler creates a SuccessFunc if the resource implements SuccessfulCreationHandler. If the resource did not implement SuccessfulCreationHandler a default handler that does nothing is returned.
type SuccessfulCreationHandler ¶
type SuccessfulCreationHandler interface { // Success modifies the resource based on a successful creation Success(obj genruntime.ARMMetaObject) error }
SuccessfulCreationHandler can be implemented to customize the resource upon successful creation