Documentation ¶
Index ¶
- Constants
- Variables
- func AcquireInstanceMaintenanceLock(ctx context.Context, k8sClient client.Client, inst *v1alpha1.Instance, ...) error
- func AgentSVC(inst v1alpha1.Instance) *corev1.Service
- func CheckSinglePvc(ctx context.Context, r client.Reader, key client.ObjectKey) error
- func CloneMap(source map[string]string) map[string]string
- func DbDaemonSVC(inst v1alpha1.Instance) *corev1.Service
- func FilterDiskWithSizeChanged(old, new []corev1.PersistentVolumeClaim, log logr.Logger) []*corev1.PersistentVolumeClaim
- func InstanceLB(inst v1alpha1.Instance) *corev1.Service
- func IsDeleting(instance *v1alpha1.Instance) bool
- func IsPatchingStateMachineEntryCondition(enabledServices map[commonv1alpha1.Service]bool, ...) bool
- func IsReadyWithObj(sts *appsv1.StatefulSet) (ready bool, msg string)
- func IsStopped(instance *v1alpha1.Instance) bool
- func Patch(ctx context.Context, cli client.Client, newCliObj client.Object, ...) error
- func PvcsCanBeExpanded(ctx context.Context, r client.Reader, sts *appsv1.StatefulSet, ...) error
- func ReleaseInstanceMaintenanceLock(ctx context.Context, k8sClient client.Client, inst *v1alpha1.Instance, ...) error
- type InstanceReconciler
Constants ¶
const ( InstanceReadyTimeout = 120 * time.Minute DatabaseInstanceReadyTimeoutSeeded = 30 * time.Minute DatabaseInstanceReadyTimeoutUnseeded = 60 * time.Minute // 60 minutes because it can take 50+ minutes to create an unseeded CDB DefaultStsPatchingTimeout = 25 * time.Minute )
const ( // StandbyReconcileInterval is the reconcile interval for a standby instance. StandbyReconcileInterval = time.Second * 60 )
Variables ¶
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 CheckSinglePvc ¶
check pvc spec
func FilterDiskWithSizeChanged ¶
func FilterDiskWithSizeChanged(old, new []corev1.PersistentVolumeClaim, log logr.Logger) []*corev1.PersistentVolumeClaim
FilterDiskWithSizeChanged compare an old STS to a new STS and identify volumes that changed from old to new.
func IsDeleting ¶
func IsReadyWithObj ¶
func IsReadyWithObj(sts *appsv1.StatefulSet) (ready bool, msg string)
IsReadyWithObj returns true if the statefulset has a non-zero number of desired replicas and has the same number of actual pods running and ready.
func Patch ¶
func Patch(ctx context.Context, cli client.Client, newCliObj client.Object, oldCliObj client.Object) error
Patch attempts to patch the given object.
func PvcsCanBeExpanded ¶
func PvcsCanBeExpanded(ctx context.Context, r client.Reader, sts *appsv1.StatefulSet, pvcs []*corev1.PersistentVolumeClaim, ) error
pvcsCanBeExpanded checks all the pvcs has a storage class that can be expanded, and return an error if any one PVC cannot be expanded.
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 SchemeVal *runtime.Scheme Images map[string]string Recorder record.EventRecorder InstanceLocks *sync.Map DatabaseClientFactory controllers.DatabaseClientFactory }
InstanceReconciler reconciles an Instance object.
func (*InstanceReconciler) Scheme ¶
func (r *InstanceReconciler) Scheme() *runtime.Scheme
func (*InstanceReconciler) SetupWithManager ¶
func (r *InstanceReconciler) SetupWithManager(mgr ctrl.Manager) error