mirror of
https://github.com/komodorio/helm-dashboard.git
synced 2026-03-24 11:48:04 +00:00
refactoring
This commit is contained in:
@@ -84,6 +84,23 @@ func EnhanceStatus(res *v12.Carp, err error) *v12.CarpStatus {
|
|||||||
c.Status = Healthy
|
c.Status = Healthy
|
||||||
c.Reason = "Exists" //since there is no condition to check here, we can set reason as exists.
|
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 {
|
} else if s.Phase == "" && len(s.Conditions) > 0 {
|
||||||
|
applyCustomConditions(&s, &c)
|
||||||
|
} else if s.Phase == "Pending" {
|
||||||
|
c.Status = Progressing
|
||||||
|
c.Reason = string(s.Phase)
|
||||||
|
} else if s.Phase == "" {
|
||||||
|
c.Status = Healthy
|
||||||
|
c.Reason = "Exists"
|
||||||
|
} else {
|
||||||
|
log.Warnf("Unhandled status: %v", s)
|
||||||
|
c.Reason = string(s.Phase)
|
||||||
|
}
|
||||||
|
|
||||||
|
s.Conditions = append(s.Conditions, c)
|
||||||
|
return &s
|
||||||
|
}
|
||||||
|
|
||||||
|
func applyCustomConditions(s *v12.CarpStatus, c *v12.CarpCondition) {
|
||||||
for _, cond := range s.Conditions {
|
for _, cond := range s.Conditions {
|
||||||
if cond.Type == "Progressing" { // https://kubernetes.io/docs/concepts/workloads/controllers/deployment/
|
if cond.Type == "Progressing" { // https://kubernetes.io/docs/concepts/workloads/controllers/deployment/
|
||||||
if cond.Status == "False" {
|
if cond.Status == "False" {
|
||||||
@@ -121,19 +138,6 @@ func EnhanceStatus(res *v12.Carp, err error) *v12.CarpStatus {
|
|||||||
c.Message = cond.Message
|
c.Message = cond.Message
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if s.Phase == "Pending" {
|
|
||||||
c.Status = Progressing
|
|
||||||
c.Reason = string(s.Phase)
|
|
||||||
} else if s.Phase == "" {
|
|
||||||
c.Status = Healthy
|
|
||||||
c.Reason = "Exists"
|
|
||||||
} else {
|
|
||||||
log.Warnf("Unhandled status: %v", s)
|
|
||||||
c.Reason = string(s.Phase)
|
|
||||||
}
|
|
||||||
|
|
||||||
s.Conditions = append(s.Conditions, c)
|
|
||||||
return &s
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *KubeHandler) Describe(c *gin.Context) {
|
func (h *KubeHandler) Describe(c *gin.Context) {
|
||||||
|
|||||||
Reference in New Issue
Block a user