reconcilers

package
v2.0.0-alpha.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 8, 2021 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
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"
	ResourceSigAnnotationKey    = "serviceoperator.azure.com/resource-sig"
)
View Source
const (
	CreateOrUpdateActionNoAction        = CreateOrUpdateAction("NoAction")
	CreateOrUpdateActionClaimResource   = CreateOrUpdateAction("ClaimResource")
	CreateOrUpdateActionBeginCreation   = CreateOrUpdateAction("BeginCreateOrUpdate")
	CreateOrUpdateActionMonitorCreation = CreateOrUpdateAction("MonitorCreateOrUpdate")
)
View Source
const (
	DeleteActionBeginDelete   = DeleteAction("BeginDelete")
	DeleteActionMonitorDelete = DeleteAction("MonitorDelete")
)
View Source
const (
	CloudErrorRetryable = CloudErrorClassification("retryable")
	CloudErrorFatal     = CloudErrorClassification("fatal")
)
View Source
const (
	UnknownErrorCode    = "UnknownError"
	UnknownErrorMessage = "There was an unknown deployment error"
)
View Source
const GenericControllerFinalizer = "serviceoperator.azure.com/finalizer"

TODO: Do we actually want this at the controller level or this level?

Variables

This section is empty.

Functions

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 NoAction

func NoAction(_ context.Context) (ctrl.Result, error)

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) *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 (r *AzureDeploymentReconciler) BeginCreateOrUpdateResource(ctx context.Context) (ctrl.Result, error)

func (*AzureDeploymentReconciler) ClaimResource

func (r *AzureDeploymentReconciler) ClaimResource(ctx context.Context) (ctrl.Result, error)

ClaimResource adds a finalizer and ensures that the owner reference is set

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 (r *AzureDeploymentReconciler) CreateOrUpdate(ctx context.Context) (ctrl.Result, error)

func (*AzureDeploymentReconciler) Delete

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) GetResourceSignature

func (r *AzureDeploymentReconciler) GetResourceSignature() (string, bool)

func (*AzureDeploymentReconciler) HasResourceSpecHashChanged

func (r *AzureDeploymentReconciler) HasResourceSpecHashChanged() (bool, error)

func (*AzureDeploymentReconciler) InTerminalState

func (r *AzureDeploymentReconciler) InTerminalState() bool

func (*AzureDeploymentReconciler) MonitorDelete

func (r *AzureDeploymentReconciler) MonitorDelete(ctx context.Context) (ctrl.Result, error)

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 (r *AzureDeploymentReconciler) MonitorResourceCreation(ctx context.Context) (ctrl.Result, error)

func (*AzureDeploymentReconciler) Reconcile

func (*AzureDeploymentReconciler) SetPollerResumeToken

func (r *AzureDeploymentReconciler) SetPollerResumeToken(id string, token string)

func (*AzureDeploymentReconciler) SetResourceSignature

func (r *AzureDeploymentReconciler) SetResourceSignature(sig string)

func (*AzureDeploymentReconciler) SpecSignature

func (r *AzureDeploymentReconciler) SpecSignature() (string, error)

SpecSignature calculates the hash of a spec. This can be used to compare specs and determine if there has been a change

func (*AzureDeploymentReconciler) StartDeleteOfResource

func (r *AzureDeploymentReconciler) StartDeleteOfResource(ctx context.Context) (ctrl.Result, error)

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
}

type CreateOrUpdateAction

type CreateOrUpdateAction string

type CreateOrUpdateActionFunc

type CreateOrUpdateActionFunc = func(ctx context.Context) (ctrl.Result, error)

type DeleteAction

type DeleteAction string

type DeleteActionFunc

type DeleteActionFunc = func(ctx context.Context) (ctrl.Result, error)

type FatalReconciliationError

type FatalReconciliationError struct {
	Message string
}

func AsFatalReconciliationError

func AsFatalReconciliationError(e error) (FatalReconciliationError, bool)

func (FatalReconciliationError) Error

func (e FatalReconciliationError) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL