Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions internal/provider/kubernetes/status_updater.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@
obj = update.Resource
objKind = KindOf(obj)
)

log := u.log.WithValues("name", update.NamespacedName.Name,
"namespace", update.NamespacedName.Namespace, "kind", objKind)
defer func() {
updateDuration := time.Since(startTime)
statusUpdateDurationSeconds.With(kindLabel.Value(objKind)).Record(updateDuration.Seconds())
Expand All @@ -104,9 +105,7 @@
newObj := update.Mutator.Mutate(obj)

if isStatusEqual(obj, newObj) {
u.log.WithName(update.NamespacedName.Name).
WithName(update.NamespacedName.Namespace).
Info("status unchanged, bypassing update")
log.Info("status unchanged, bypassing update")

statusUpdateTotal.WithStatus(statusNoAction, kindLabel.Value(objKind)).Increment()
return nil
Expand All @@ -116,8 +115,7 @@

return u.client.Status().Update(context.Background(), newObj)
}); err != nil {
u.log.Error(err, "unable to update status", "name", update.NamespacedName.Name,
"namespace", update.NamespacedName.Namespace)
log.Error(err, "unable to update status")

Check warning on line 118 in internal/provider/kubernetes/status_updater.go

View check run for this annotation

Codecov / codecov/patch

internal/provider/kubernetes/status_updater.go#L118

Added line #L118 was not covered by tests

statusUpdateTotal.WithFailure(metrics.ReasonError, kindLabel.Value(objKind)).Increment()
} else {
Expand All @@ -143,7 +141,7 @@
return nil
case update := <-u.updateChannel:
u.log.Info("received a status update", "namespace", update.NamespacedName.Namespace,
"name", update.NamespacedName.Name)
"name", update.NamespacedName.Name, "kind", KindOf(update.Resource))

u.apply(update)
}
Expand Down