Documentation
¶
Index ¶
- type ARMResourceModifier
- type ARMResourceModifierFunc
- type ClaimFunc
- type Claimer
- type DeleteFunc
- type Deleter
- type ErrorClassifier
- type ErrorClassifierFunc
- type KubernetesExportFunc
- 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,
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, 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 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 PreReconcileCheckFunc ¶
type PreReconcileCheckFunc func( ctx context.Context, obj genruntime.MetaObject, owner genruntime.MetaObject, kubeClient kubeclient.Client, 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,
kubeClient kubeclient.Client,
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