instancecontroller

package
v0.2.0-alpha Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2022 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InstanceReadyTimeout                 = 20 * time.Minute
	DatabaseInstanceReadyTimeoutSeeded   = 20 * time.Minute
	DatabaseInstanceReadyTimeoutUnseeded = 60 * time.Minute // 60 minutes because it can take 50+ minutes to create an unseeded CDB

)
View Source
const (

	// StandbyReconcileInterval is the reconcile interval for a standby instance.
	StandbyReconcileInterval = time.Second * 60
)

Variables

View Source
var CheckStatusInstanceFunc = controllers.CheckStatusInstanceFunc

Functions

func AcquireInstanceMaintenanceLock

func AcquireInstanceMaintenanceLock(ctx context.Context, k8sClient client.Client, inst *v1alpha1.Instance, owner string) error

AcquireInstanceMaintenanceLock gives caller an exclusive maintenance access to the specified instance object. 'inst' points to an existing instance object (will be updated after the call) 'owner' identifies the owning controller e.g. 'instancecontroller' Convention: If the call succeeds the caller can safely assume that it has exclusive access now. If the call fails the caller needs to retry acquiring the lock.

Function is idempotent, caller can acquire the lock multiple times.

Note: The call will commit the instance object to k8s (with all changes), updating the supplied 'inst' object and making all other references stale.

func CloneMap

func CloneMap(source map[string]string) map[string]string

func IsPatchingStateMachineEntryCondition

func IsPatchingStateMachineEntryCondition(enabledServices map[commonv1alpha1.Service]bool, activeImages map[string]string, spImages map[string]string, lastFailedImages map[string]string, instanceReadyCond *v1.Condition, dbInstanceCond *v1.Condition) bool

func ReleaseInstanceMaintenanceLock

func ReleaseInstanceMaintenanceLock(ctx context.Context, k8sClient client.Client, inst *v1alpha1.Instance, owner string) error

ReleaseInstanceMaintenanceLock releases exclusive maintenance access to the specified instance object. 'inst' points to an existing instance object (will be updated after the call) 'owner' identifies the owning controller e.g. 'instancecontroller' Convention: If the call succeeds the caller can safely assume that lock was released. If the call fails the caller needs to retry releasing the lock.

Call is idempotent, caller can release it multiple times. If caller's not owning the lock the call will return success without affecting the ownership.

Note: The call will commit the instance object to k8s (with all changes), updating the supplied 'inst' object and making all other references stale.

Types

type InstanceReconciler

type InstanceReconciler struct {
	client.Client
	Log           logr.Logger
	Scheme        *runtime.Scheme
	Images        map[string]string
	Recorder      record.EventRecorder
	InstanceLocks *sync.Map

	DatabaseClientFactory controllers.DatabaseClientFactory
}

InstanceReconciler reconciles an Instance object.

func (*InstanceReconciler) Reconcile

func (r *InstanceReconciler) Reconcile(_ context.Context, req ctrl.Request) (_ ctrl.Result, respErr error)

func (*InstanceReconciler) SetupWithManager

func (r *InstanceReconciler) SetupWithManager(mgr ctrl.Manager) error

Jump to

Keyboard shortcuts

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