Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved Health Check Status logic #797

Merged
merged 1 commit into from
Sep 1, 2021
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
15 changes: 12 additions & 3 deletions pkg/controller/cluster/monitoring.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ const (
HealthUnavailableMessage = "Service Unavailable"
// HealthHealingMessage means MinIO is healing one of more drives
HealthHealingMessage = "Healing"
// HealthReduceAvailabilityMessage some drives are offline
HealthReduceAvailabilityMessage = "Reduced Availability"
// HealthAboutToLoseQuorumMessage means we are close to losing write capabilities
HealthAboutToLoseQuorumMessage = "About to lose quorum"
)
Expand Down Expand Up @@ -163,7 +165,7 @@ func (c *Controller) updateHealthStatusForTenant(tenant *miniov2.Tenant) error {
allPodsRunning = false
}
}
if !allPodsRunning {
if !allPodsRunning && tenant.Status.HealthStatus != miniov2.HealthStatusRed {
tenant.Status.HealthStatus = miniov2.HealthStatusYellow
}

Expand Down Expand Up @@ -197,14 +199,21 @@ func (c *Controller) updateHealthStatusForTenant(tenant *miniov2.Tenant) error {

if tenant.Status.DrivesOffline > 0 || tenant.Status.DrivesHealing > 0 {
tenant.Status.HealthStatus = miniov2.HealthStatusYellow
if tenant.Status.DrivesHealing > 0 {
tenant.Status.HealthMessage = HealthHealingMessage
} else {
tenant.Status.HealthMessage = HealthReduceAvailabilityMessage
}
}
if tenant.Status.DrivesOnline < tenant.Status.WriteQuorum {
tenant.Status.HealthStatus = miniov2.HealthStatusRed
tenant.Status.HealthMessage = HealthUnavailableMessage
}

// only if no disks are offline, we are green
if tenant.Status.DrivesOffline == 0 {
// only if no disks are offline and we are not healing, we are green
if tenant.Status.DrivesOffline == 0 && tenant.Status.DrivesHealing == 0 {
tenant.Status.HealthStatus = miniov2.HealthStatusGreen
tenant.Status.HealthMessage = ""
}

if _, err = c.updatePoolStatus(context.Background(), tenant); err != nil {
Expand Down