Skip to content

Commit

Permalink
Code review suggestions
Browse files Browse the repository at this point in the history
Signed-off-by: Manuel Kieweg <mail@manuelkieweg.de>
  • Loading branch information
mkieweg committed Jul 2, 2024
1 parent 642faf2 commit cac486a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion controller/appcontroller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1709,7 +1709,7 @@ apps/Deployment:

for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
deployment.SetLabels(map[string]string{"status": tc.initialStatus})
deployment.SetLabels(map[string]string{"status": tc.initialStatus})
ctrl.processAppRefreshQueueItem()
apps, err := ctrl.appLister.List(labels.Everything())
require.NoError(t, err)
Expand Down
12 changes: 5 additions & 7 deletions controller/health.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,15 @@ func setApplicationHealth(resources []managedResource, statuses []appv1.Resource

if health.IsWorse(appHealth.Status, healthStatus.Status) {
appHealth.Status = healthStatus.Status
if persistResourceHealth {
appHealth.LastTransitionTime = statuses[i].Health.LastTransitionTime
} else {
appHealth.LastTransitionTime = now
}
} else if healthStatus.Status == health.HealthStatusHealthy {
appHealth.LastTransitionTime = lastTransitionTime
}
}
if persistResourceHealth {
app.Status.ResourceHealthSource = appv1.ResourceHealthLocationInline
if app.Status.Health.Status == appHealth.Status {
appHealth.LastTransitionTime = lastTransitionTime
} else {
appHealth.LastTransitionTime = metav1.Now()
}
} else {
app.Status.ResourceHealthSource = appv1.ResourceHealthLocationAppTree
}
Expand Down

0 comments on commit cac486a

Please sign in to comment.