Feature: Add Health Checks (Liveness, Readiness, Startup Probes) #59
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📋 Summary
This PR introduces comprehensive health check mechanisms for RustFS StatefulSet pods. By implementing Liveness, Readiness, and Startup probes, we significantly enhance the reliability, availability, and self-healing capabilities of the RustFS cluster managed by the operator.
🚀 Key Changes
1. CRD Schema Update (
src/types/v1alpha1/tenant.rs)livenessProbe,readinessProbe, andstartupProbeto theTenantSpecstruct.corev1::Probetype, allowing full customization (httpGet, exec, tcpSocket, thresholds, etc.).2. Intelligent StatefulSet Generation (
src/types/v1alpha1/tenant/workloads.rs)new_statefulsetmethod now injects these probes into the RustFS container definition./rustfs/health/liveon port 9000.initialDelaySeconds: 120s (Gives ample time for initialization)periodSeconds: 15s/rustfs/health/readyon port 9000.initialDelaySeconds: 30speriodSeconds: 10s/rustfs/health/startupon port 9000.failureThreshold: 30 (Allows up to 5 minutes for slow startups before killing the pod)3. Enhanced Reconciliation & Update Logic
statefulset_needs_updateto include deep comparison of probe configurations.🧪 Testing Verification
All tests passed successfully (
cargo test).test_default_probes_applied: Confirms that smart defaults are applied when CRD fields are missing.test_custom_probes_override: Confirms that user-provided configurations take precedence over defaults.test_probe_update_detection: Confirms that modifying probe parameters triggers a reconciliation update.📦 Impact
✅ Checklist
cargo fmthas been run.cargo clippypasses without errors.