mirror of
https://github.com/komodorio/helm-dashboard.git
synced 2026-03-26 06:18:04 +00:00
feat(health): add health status for ExternalSecret, Job, HPA, and Namespace (#662)
Add condition-based health status calculation for additional resource kinds: - ExternalSecret: checks "Ready" condition - Job: checks "Complete" and "Failed" conditions - HorizontalPodAutoscaler: checks "AbleToScale" and "ScalingActive" conditions - Namespace: handles "Terminating" phase as Progressing Closes #418 Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -86,7 +86,7 @@ func EnhanceStatus(res *v12.Carp, err error) *v12.CarpStatus {
|
||||
c.Reason = "Exists" //since there is no condition to check here, we can set reason as exists.
|
||||
} else if s.Phase == "" && len(s.Conditions) > 0 {
|
||||
applyCustomConditions(&s, &c)
|
||||
} else if s.Phase == "Pending" {
|
||||
} else if s.Phase == "Pending" || s.Phase == "Terminating" {
|
||||
c.Status = Progressing
|
||||
c.Reason = string(s.Phase)
|
||||
} else if s.Phase == "" {
|
||||
@@ -137,6 +137,34 @@ func applyCustomConditions(s *v12.CarpStatus, c *v12.CarpCondition) {
|
||||
}
|
||||
c.Reason = cond.Reason
|
||||
c.Message = cond.Message
|
||||
} else if cond.Type == "Ready" && c.Status == Unknown { // condition for ExternalSecret
|
||||
if cond.Status == "False" {
|
||||
c.Status = Unhealthy
|
||||
} else {
|
||||
c.Status = Healthy
|
||||
}
|
||||
c.Reason = cond.Reason
|
||||
c.Message = cond.Message
|
||||
} else if cond.Type == "Complete" && c.Status == Unknown { // condition for Job
|
||||
if cond.Status == "True" {
|
||||
c.Status = Healthy
|
||||
c.Reason = cond.Reason
|
||||
c.Message = cond.Message
|
||||
}
|
||||
} else if cond.Type == "Failed" && c.Status == Unknown { // condition for Job
|
||||
if cond.Status == "True" {
|
||||
c.Status = Unhealthy
|
||||
c.Reason = cond.Reason
|
||||
c.Message = cond.Message
|
||||
}
|
||||
} else if (cond.Type == "AbleToScale" || cond.Type == "ScalingActive") && c.Status == Unknown { // condition for HorizontalPodAutoscaler
|
||||
if cond.Status == "False" {
|
||||
c.Status = Unhealthy
|
||||
} else {
|
||||
c.Status = Healthy
|
||||
}
|
||||
c.Reason = cond.Reason
|
||||
c.Message = cond.Message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user