Skip to content

Commit d6e1948

Browse files
committed
fix: images status
1 parent a300d04 commit d6e1948

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

.changelog/103.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:bug
2+
`image` - Now the status of the image is displayed correctly in the `image` list if the image/repository is not found in the registry.
3+
```

cmd/kimup/scheduler.go

+5-4
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,10 @@ func initScheduler(ctx context.Context, k kubeclient.Interface) {
110110
})
111111
timerRegistry.ObserveDuration()
112112
if err != nil {
113-
// Prometheus metrics - Increment the counter for the registry with error
114113
metrics.Registry().RequestErrorTotal.WithLabelValues(i.GetRegistry()).Inc()
115114
image.SetStatusResult(v1alpha1.ImageStatusLastSyncErrorRegistry)
115+
k.Image().Event(&image, corev1.EventTypeWarning, "Fetch image", fmt.Sprintf("Error fetching image: %v", err))
116+
log.WithError(err).Error("Error fetching image")
116117
return err
117118
}
118119

@@ -123,8 +124,8 @@ func initScheduler(ctx context.Context, k kubeclient.Interface) {
123124
tagsAvailable, err := re.Tags()
124125
timerTags.ObserveDuration()
125126
if err != nil {
126-
// Prometheus metrics - Increment the counter for the tags with error
127127
metrics.Tags().RequestErrorTotal.Inc()
128+
image.SetStatusResult(v1alpha1.ImageStatusLastSyncErrorTags)
128129
k.Image().Event(&image, corev1.EventTypeWarning, "Fetch image tags", fmt.Sprintf("Error fetching tags: %v", err))
129130
log.WithError(err).Error("Error fetching tags")
130131
return err
@@ -161,8 +162,8 @@ func initScheduler(ctx context.Context, k kubeclient.Interface) {
161162

162163
if err != nil {
163164
// Prometheus metrics - Increment the counter for the evaluated rule with error
165+
image.SetStatusResult(v1alpha1.ImageStatusLastSyncError)
164166
metrics.Rules().EvaluatedErrorTotal.Inc()
165-
166167
log.Errorf("Error evaluating rule: %v", err)
167168
k.Image().Event(&image, corev1.EventTypeWarning, "Evaluate rule", fmt.Sprintf("Error evaluating rule %s: %v", rule.Type, err))
168169
continue
@@ -197,7 +198,7 @@ func initScheduler(ctx context.Context, k kubeclient.Interface) {
197198
if err != nil {
198199
// Prometheus metrics - Increment the counter for the executed action with error
199200
metrics.Actions().ExecutedErrorTotal.Inc()
200-
201+
image.SetStatusResult(v1alpha1.ImageStatusLastSyncError)
201202
log.Errorf("Error executing action(%s): %v", action.Type, err)
202203
k.Image().Event(&image, corev1.EventTypeWarning, "Execute action", fmt.Sprintf("Error executing action %s: %v", action.Type, err))
203204
continue

0 commit comments

Comments
 (0)