kubeslice / kubeslice/kubeslice-controller

Improvemen: `ReconcileWorkerSliceConfig` does not emit a Kubernetes Event when `UpdateResource` fails

Open Beginner friendly
#382 0 comments 0 reactions 0 assignees View on GitHub
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.