Documentation
¶
Overview ¶
Package status provides shared helpers for managing the lifecycle state of Multigres Custom Resources.
It contains utilities for:
- Computing resource Phase (Initializing / Progressing / Healthy) from replica counts via ComputePhase.
- Managing metav1.Condition slices (SetCondition, IsConditionTrue) used by data-handler controllers to track topology registration, backup health, and similar observable state.
These helpers are intentionally kept in a shared package so that both the Cell and Shard data-handler controllers (and any future controllers) use a single implementation rather than duplicating condition logic.
Index ¶
- func AnyCrashLooping(pods []corev1.Pod) bool
- func ComputePhase(ready, total int32) multigresv1alpha1.Phase
- func IsConditionTrue(conditions []metav1.Condition, condType string) bool
- func IsCrashLooping(pod *corev1.Pod) bool
- func SetCondition(conditions *[]metav1.Condition, condition metav1.Condition)
- type WorkloadPhaseInput
- type WorkloadPhaseResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AnyCrashLooping ¶
AnyCrashLooping returns true if any non-terminating pod in the slice is crash-looping.
func ComputePhase ¶
func ComputePhase(ready, total int32) multigresv1alpha1.Phase
ComputePhase determines the phase of a resource based on its readiness. This is a shared helper used by resources with simple replica counts.
func IsConditionTrue ¶
IsConditionTrue returns true if the named condition exists and has status True.
func IsCrashLooping ¶
IsCrashLooping returns true if any container in the pod is unhealthy:
- in CrashLoopBackOff, OOMKilled, or ImagePullBackOff waiting state, OR
- terminated with repeated restarts (catches the gap between backoff restarts when the container is in Completed/Error state).
Both regular containers and init containers (native sidecars) are checked.
Types ¶
type WorkloadPhaseInput ¶
type WorkloadPhaseInput struct {
Ready, Total int32
GenerationCurrent int64
GenerationObserved int64
Pods []corev1.Pod
ComponentName string
}
WorkloadPhaseInput describes the observed state of a workload for phase computation.
type WorkloadPhaseResult ¶
type WorkloadPhaseResult struct {
Phase multigresv1alpha1.Phase
Message string
}
WorkloadPhaseResult holds the computed phase and a human-readable message.
func ComputeWorkloadPhase ¶
func ComputeWorkloadPhase(in WorkloadPhaseInput) WorkloadPhaseResult
ComputeWorkloadPhase determines phase from replica counts, pod health, and generation freshness. Degraded (crash-looping) takes priority over all other non-Healthy states.