Documentation ¶
Index ¶
- Constants
- func ARMReconcilerAnnotationChangedPredicate(log logr.Logger) predicate.Predicate
- func ConvertToARMResourceImpl(ctx context.Context, metaObject genruntime.MetaObject, scheme *runtime.Scheme, ...) (genruntime.ARMResource, error)
- func HasReconcilePolicyAnnotationChanged(old *string, new *string) bool
- func NoAction(_ context.Context) (ctrl.Result, error)
- type AzureDeploymentReconciler
- func (r *AzureDeploymentReconciler) AddInitialResourceState(resourceID string) error
- func (r *AzureDeploymentReconciler) BeginCreateOrUpdateResource(ctx context.Context) (ctrl.Result, error)
- func (r *AzureDeploymentReconciler) ClaimResource(ctx context.Context) (ctrl.Result, error)
- func (r *AzureDeploymentReconciler) ClearPollerResumeToken()
- func (r *AzureDeploymentReconciler) CommitUpdate(ctx context.Context) error
- func (r *AzureDeploymentReconciler) ConvertResourceToARMResource(ctx context.Context) (genruntime.ARMResource, error)
- func (r *AzureDeploymentReconciler) CreateOrUpdate(ctx context.Context) (ctrl.Result, error)
- func (r *AzureDeploymentReconciler) Delete(ctx context.Context) (ctrl.Result, error)
- func (r *AzureDeploymentReconciler) DetermineCreateOrUpdateAction() (CreateOrUpdateAction, CreateOrUpdateActionFunc, error)
- func (r *AzureDeploymentReconciler) DetermineDeleteAction() (DeleteAction, DeleteActionFunc, error)
- func (r *AzureDeploymentReconciler) GetPollerResumeToken() (string, string, bool)
- func (r *AzureDeploymentReconciler) GetReadyCondition() *conditions.Condition
- func (r *AzureDeploymentReconciler) GetReconcilePolicy() ReconcilePolicy
- func (r *AzureDeploymentReconciler) InTerminalState() bool
- func (r *AzureDeploymentReconciler) MonitorDelete(ctx context.Context) (ctrl.Result, error)
- func (r *AzureDeploymentReconciler) MonitorResourceCreation(ctx context.Context) (ctrl.Result, error)
- func (r *AzureDeploymentReconciler) Reconcile(ctx context.Context) (ctrl.Result, error)
- func (r *AzureDeploymentReconciler) SetPollerResumeToken(id string, token string)
- func (r *AzureDeploymentReconciler) StartDeleteOfResource(ctx context.Context) (ctrl.Result, error)
- type CloudErrorClassification
- type CloudErrorDetails
- type CreateOrUpdateAction
- type CreateOrUpdateActionFunc
- type DeleteAction
- type DeleteActionFunc
- type FatalReconciliationError
- type ReconcilePolicy
Constants ¶
const ( // TODO: Delete these later in favor of something in status? PollerResumeTokenAnnotation = "serviceoperator.azure.com/poller-resume-token" PollerResumeIDAnnotation = "serviceoperator.azure.com/poller-resume-id" )
const ( CreateOrUpdateActionNoAction = CreateOrUpdateAction("NoAction") CreateOrUpdateActionClaimResource = CreateOrUpdateAction("ClaimResource") CreateOrUpdateActionBeginCreation = CreateOrUpdateAction("BeginCreateOrUpdate") CreateOrUpdateActionMonitorCreation = CreateOrUpdateAction("MonitorCreateOrUpdate") )
const ( DeleteActionBeginDelete = DeleteAction("BeginDelete") DeleteActionMonitorDelete = DeleteAction("MonitorDelete") )
const ( CloudErrorRetryable = CloudErrorClassification("retryable") CloudErrorFatal = CloudErrorClassification("fatal") )
const ( UnknownErrorCode = "UnknownError" UnknownErrorMessage = "There was an unknown deployment error" )
const ( // ReconcilePolicyManage instructs the operator to manage the resource in question. // This includes issuing PUTs to update it and DELETE's to delete it from Azure if deleted in Kuberentes. // This is the default policy when no policy is specified. ReconcilePolicyManage = ReconcilePolicy("manage") // ReconcilePolicySkip instructs the operator to skip all reconciliation actions. This includes creating // the resource. ReconcilePolicySkip = ReconcilePolicy("skip") // ReconcilePolicyDetachOnDelete instructs the operator to skip deletion of resources in Azure. This allows // deletion of the resource in Kubernetes to go through but does not delete the underlying Azure resource. ReconcilePolicyDetachOnDelete = ReconcilePolicy("detach-on-delete") )
const GenericControllerFinalizer = "serviceoperator.azure.com/finalizer"
TODO: Do we actually want this at the controller level or this level?
const ReconcilePolicyAnnotation = "serviceoperator.azure.com/reconcile-policy"
ReconcilePolicyAnnotation describes the reconcile policy for the resource in question. A reconcile policy describes what action (if any) the operator is allowed to take when reconciling the resource. If no reconcile policy is specified, the default is "run"
Variables ¶
This section is empty.
Functions ¶
func ARMReconcilerAnnotationChangedPredicate ¶
ARMReconcilerAnnotationChangedPredicate creates a predicate that emits events when annotations interesting to the generic ARM reconciler are changed
func ConvertToARMResourceImpl ¶
func ConvertToARMResourceImpl( ctx context.Context, metaObject genruntime.MetaObject, scheme *runtime.Scheme, resolver *genruntime.Resolver, subscriptionID string) (genruntime.ARMResource, error)
ConvertToARMResourceImpl factored out of AzureDeploymentReconciler.ConvertResourceToARMResource to allow for testing
func HasReconcilePolicyAnnotationChanged ¶
HasReconcilePolicyAnnotationChanged returns true if the reconcile-policy annotation has changed in a way that needs to trigger a reconcile.
Types ¶
type AzureDeploymentReconciler ¶
type AzureDeploymentReconciler struct { ARMClient *genericarmclient.GenericClient KubeClient *kubeclient.Client ResourceResolver *genruntime.Resolver PositiveConditions *conditions.PositiveConditionBuilder // contains filtered or unexported fields }
func NewAzureDeploymentReconciler ¶
func NewAzureDeploymentReconciler( metaObj genruntime.MetaObject, log logr.Logger, armClient *genericarmclient.GenericClient, eventRecorder record.EventRecorder, kubeClient *kubeclient.Client, resourceResolver *genruntime.Resolver, positiveConditions *conditions.PositiveConditionBuilder, cfg config.Values, rand *rand.Rand, extension genruntime.ResourceExtension) *AzureDeploymentReconciler
TODO: It's a bit weird that this is a "reconciler" that operates only on a specific genruntime.MetaObject. TODO: We probably want to refactor this to make metaObj a parameter?
func (*AzureDeploymentReconciler) AddInitialResourceState ¶
func (r *AzureDeploymentReconciler) AddInitialResourceState(resourceID string) error
func (*AzureDeploymentReconciler) BeginCreateOrUpdateResource ¶
func (*AzureDeploymentReconciler) ClaimResource ¶
ClaimResource adds a finalizer and ensures that the owner reference is set
func (*AzureDeploymentReconciler) ClearPollerResumeToken ¶
func (r *AzureDeploymentReconciler) ClearPollerResumeToken()
ClearPollerResumeToken clears the poller resume token and ID annotations
func (*AzureDeploymentReconciler) CommitUpdate ¶
func (r *AzureDeploymentReconciler) CommitUpdate(ctx context.Context) error
CommitUpdate persists the contents of r.obj to etcd by using the Kubernetes client. Note that after this method has been called, r.obj contains the result of the update from APIServer (including an updated resourceVersion).
func (*AzureDeploymentReconciler) ConvertResourceToARMResource ¶
func (r *AzureDeploymentReconciler) ConvertResourceToARMResource(ctx context.Context) (genruntime.ARMResource, error)
ConvertResourceToARMResource converts a genruntime.MetaObject (a Kubernetes representation of a resource) into a genruntime.ARMResourceSpec - a specification which can be submitted to Azure for deployment
func (*AzureDeploymentReconciler) CreateOrUpdate ¶
func (*AzureDeploymentReconciler) DetermineCreateOrUpdateAction ¶
func (r *AzureDeploymentReconciler) DetermineCreateOrUpdateAction() (CreateOrUpdateAction, CreateOrUpdateActionFunc, error)
func (*AzureDeploymentReconciler) DetermineDeleteAction ¶
func (r *AzureDeploymentReconciler) DetermineDeleteAction() (DeleteAction, DeleteActionFunc, error)
func (*AzureDeploymentReconciler) GetPollerResumeToken ¶
func (r *AzureDeploymentReconciler) GetPollerResumeToken() (string, string, bool)
GetPollerResumeToken returns a poller ID and the poller token
func (*AzureDeploymentReconciler) GetReadyCondition ¶
func (r *AzureDeploymentReconciler) GetReadyCondition() *conditions.Condition
func (*AzureDeploymentReconciler) GetReconcilePolicy ¶
func (r *AzureDeploymentReconciler) GetReconcilePolicy() ReconcilePolicy
GetReconcilePolicy gets the reconcile policy from the ReconcilePolicyAnnotation
func (*AzureDeploymentReconciler) InTerminalState ¶
func (r *AzureDeploymentReconciler) InTerminalState() bool
func (*AzureDeploymentReconciler) MonitorDelete ¶
MonitorDelete will call Azure to check if the resource still exists. If so, it will requeue, else, the finalizer will be removed.
func (*AzureDeploymentReconciler) MonitorResourceCreation ¶
func (*AzureDeploymentReconciler) SetPollerResumeToken ¶
func (r *AzureDeploymentReconciler) SetPollerResumeToken(id string, token string)
func (*AzureDeploymentReconciler) StartDeleteOfResource ¶
StartDeleteOfResource will begin the delete of a resource by telling Azure to start deleting it. The resource will be marked with the provisioning state of "Deleting".
type CloudErrorClassification ¶
type CloudErrorClassification string
type CloudErrorDetails ¶
type CloudErrorDetails struct { Classification CloudErrorClassification Code string Message string }
func ClassifyCloudError ¶
func ClassifyCloudError(err *genericarmclient.CloudError) CloudErrorDetails
type CreateOrUpdateAction ¶
type CreateOrUpdateAction string
type DeleteAction ¶
type DeleteAction string
type FatalReconciliationError ¶
type FatalReconciliationError struct {
Message string
}
func AsFatalReconciliationError ¶
func AsFatalReconciliationError(e error) (FatalReconciliationError, bool)
func (FatalReconciliationError) Error ¶
func (e FatalReconciliationError) Error() string
type ReconcilePolicy ¶
type ReconcilePolicy string
func ParseReconcilePolicy ¶
func ParseReconcilePolicy(policy string) (ReconcilePolicy, error)
ParseReconcilePolicy parses the provided reconcile policy.
func (ReconcilePolicy) AllowsDelete ¶
func (r ReconcilePolicy) AllowsDelete() bool
AllowsDelete determines if the policy allows deletion of the backing Azure resource
func (ReconcilePolicy) AllowsModify ¶
func (r ReconcilePolicy) AllowsModify() bool
AllowsModify determines if the policy allows modification of the backing Azure resource