Commit a22fcc0
authored
* feat: Phase 1 - StatefulSet diff detection and validation (#43)
Implement intelligent StatefulSet update detection and immutable field
validation to improve reconciliation efficiency and safety.
Changes:
- Add statefulset_needs_update() method for semantic diff detection
- Add validate_statefulset_update() method for immutable field checks
- Refactor reconciliation loop to check/validate before updating
- Add new error types: InternalError, ImmutableFieldModified, SerdeJson
- Extend error policy with 60s requeue for immutable field errors
- Add 9 comprehensive unit tests (35 tests total, all passing)
- Update CHANGELOG.md with detailed changes
Benefits:
- Reduces unnecessary API calls and reconciliation overhead
- Prevents invalid updates that would cause API rejections
- Provides clear error messages for users
- Foundation for rollout monitoring in Phase 2
Related: #43
* feat: Phase 2 - Status types and StatefulSet helpers (#43)
Extend status structures and add StatefulSet status helper methods
for rollout monitoring support.
Changes:
- Add Condition struct for Kubernetes standard conditions (Ready, Progressing, Degraded)
- Extend Status struct with observed_generation and conditions fields
- Extend Pool status with replica tracking and revision fields
- Add new PoolState variants: Updating, RolloutComplete, RolloutFailed, Degraded
- Add context methods:
- get_statefulset_status() - Fetch StatefulSet status
- is_rollout_complete() - Check if rollout is complete
- get_statefulset_revisions() - Get current and update revisions
Benefits:
- Foundation for comprehensive rollout monitoring
- Kubernetes-standard status conditions
- Per-pool rollout status tracking
- All existing tests continue to pass
Related: #43
* fix: Enable RUST_LOG environment variable support (#43)
The tracing subscriber was not respecting the RUST_LOG environment
variable, making it impossible to see debug logs from the operator.
Changes:
- Enable 'env-filter' feature for tracing-subscriber in Cargo.toml
- Add .with_env_filter() to tracing subscriber initialization
- Allows operators to see debug logs with: RUST_LOG=operator=debug
This fixes the "no logs" issue reported when running the operator.
Testing:
- Verified operator runs successfully with RUST_LOG=info
- Verified debug logs appear with RUST_LOG=operator=debug
- Confirmed diff detection and validation logs are visible
Related: #43
* fix: Block pool name changes to prevent orphaned StatefulSets (#43)
Changing a pool name creates a new StatefulSet but leaves the old one
orphaned. This is invalid because pool names are part of the StatefulSet
selector (immutable field).
Changes:
- Add validation before StatefulSet reconciliation loop
- List all StatefulSets owned by the Tenant
- Check for StatefulSets whose pool names don't match current spec
- Return ImmutableFieldModified error with clear guidance
Error message guides users to delete and recreate Tenant if rename needed.
Testing:
- All 35 tests passing
- Operator detects orphaned StatefulSets and returns error
- 60-second requeue for user to fix
Related: #43
* feat: Phase 3 - Status updates and rollout monitoring (#43)
Implement comprehensive status updates and rollout monitoring to track
StatefulSet reconciliation progress in real-time.
Changes:
- Add build_pool_status() helper method to Tenant to extract status from StatefulSets
- Collect pool statuses during StatefulSet reconciliation loop
- Aggregate pool statuses into overall Tenant conditions (Ready, Progressing, Degraded)
- Update Tenant status with replica counts, pool states, and conditions
- Requeue faster (10s) when pools are updating for responsive monitoring
- Refactor Context.update_status() to accept full Status struct
- Add chrono dependency for timestamp generation
Status Updates:
- Pool status includes: replicas, ready_replicas, current_replicas, updated_replicas,
current_revision, update_revision, last_update_time, and state
- Pool states: NotCreated, Initialized, Updating, RolloutComplete, RolloutFailed, Degraded
- Tenant conditions: Ready (True/False), Progressing (True during rollout), Degraded (True when degraded)
- Tenant overall state: Ready, NotReady, Updating, Degraded
Rollout Monitoring:
- Tracks individual pool rollout status based on StatefulSet replicas and revisions
- Sets Progressing condition during rollouts
- Sets Ready condition when all replicas are ready and updated
- Sets Degraded condition when pools are unhealthy
- Requeues every 10 seconds during active rollouts for responsive updates
This completes Phase 3 of issue #43. Status information is now properly populated
and visible in kubectl/k9s.
* fix: Correct status update to send complete Tenant object (#43)
The replace_status API requires a complete Kubernetes object with
apiVersion, kind, metadata, spec, and status - not just the status field.
Changes:
- Clone the Tenant resource and set its status field
- Serialize the complete Tenant object
- Fixes 'Object Kind is missing' error during status updates
This fixes the status update errors seen in the operator logs.
* fix: Remove redundant Health column from kubectl output
The Health column was referencing a non-existent .status.healthStatus field.
Removed it since STATE column already shows the current state.
* fix: Use patch_status with JSON merge patch for status updates (#43)
Changed from replace_status with raw bytes to patch_status with JSON
merge patch, which is the proper kube-rs API for updating status
subresources.
This fixes the 'Object Kind is missing' error.
* fix: Resolve clippy lint warnings
- Use chained if-let conditions to collapse nested if statements
- Use as_deref() instead of as_ref().map(|s| s.as_str())
- Allow unwrap/expect in test modules (acceptable in tests)
All clippy checks now pass with -D warnings.
* fix: Resolve clippy lint warnings
Replace unwrap() and expect() calls with explicit pattern matching
in RBAC test code to satisfy clippy lints without using allow
annotations. All test behavior is preserved with explicit panic
messages on None values.
1 parent d4a6d18 commit a22fcc0
13 files changed
Lines changed: 1293 additions & 74 deletions
File tree
- deploy/rustfs-operator/crds
- src
- types
- v1alpha1
- status
- tenant
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
10 | 52 | | |
11 | 53 | | |
12 | 54 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
16 | | - | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | 20 | | |
24 | 21 | | |
25 | 22 | | |
| |||
1157 | 1154 | | |
1158 | 1155 | | |
1159 | 1156 | | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
1160 | 1190 | | |
1161 | 1191 | | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
1162 | 1197 | | |
1163 | 1198 | | |
1164 | 1199 | | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
1165 | 1223 | | |
| 1224 | + | |
1166 | 1225 | | |
1167 | 1226 | | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
1168 | 1232 | | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
| 1237 | + | |
1169 | 1238 | | |
1170 | 1239 | | |
1171 | 1240 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
109 | | - | |
| 109 | + | |
110 | 110 | | |
111 | 111 | | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
118 | 116 | | |
119 | | - | |
| 117 | + | |
120 | 118 | | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
126 | 123 | | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
133 | 134 | | |
134 | 135 | | |
135 | 136 | | |
136 | 137 | | |
137 | 138 | | |
138 | 139 | | |
139 | | - | |
140 | | - | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
141 | 144 | | |
142 | 145 | | |
143 | 146 | | |
| |||
287 | 290 | | |
288 | 291 | | |
289 | 292 | | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
290 | 374 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| |||
0 commit comments