kubeslice / kubeslice/kubeslice-controller
Improvemen: `ReconcileWorkerSliceConfig` does not emit a Kubernetes Event when `UpdateResource` fails
- Dominant language
- Go
- Stars
- 73
- Forks
- 48
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 8
Description
**Problem**:
At lines 282–286 of `ReconcileWorkerSliceConfig`, an `UpdateResource` failure silently returns an error with no Kubernetes Event recorded. At lines 398–411 in the same file, `CreateMinimalWorkerSliceConfig` records `EventWorkerSliceConfigUpdateFailed` on the equivalent failure. The event recorder is initialized at lines 71–74 and is in scope throughout `ReconcileWorkerSliceConfig`. The inconsistency means operators monitoring Events will miss reconciliation failures on update.
**Proposed Solution**:
Before returning the error at line 284, add:
```go
util.RecordEvent(ctx, eventRecorder, workerSliceConfig, nil, events.EventWorkerSliceConfigUpdateFailed)
```
**Type of Issue**: improvement / observability
## ✅ Expected Behavior
A Kubernetes Event with reason `EventWorkerSliceConfigUpdateFailed` is recorded whenever `ReconcileWorkerSliceConfig` fails to update the worker slice config resource.
## 👎 Actual Behavior
No event is emitted. The failure is invisible in `kubectl get events`.
## ✅ Proposed Solution
Add `util.RecordEvent(ctx, eventRecorder, workerSliceConfig, nil, events.EventWorkerSliceConfigUpdateFailed)` before the `return ctrl.Result{}, err` at `worker_slice_config_service.go` line 284.
## 👀 Have you spent some time to check if this issue has been raised before?
- [x] I checked and didn't find any similar issue
## Code of Conduct
- [x] I agree to follow this project's Code of Conduct
Contributor guide
Research direction
Start in worker_slice_config_service.go at ReconcileWorkerSliceConfig lines 282–286, then compare the failure handling in CreateMinimalWorkerSliceConfig at lines 398–411. Done means a failed UpdateResource records a Kubernetes Event with reason EventWorkerSliceConfigUpdateFailed before returning the error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- observability
- Issue type
- Feature
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 82/100