Skip to content

Commit

Permalink
feat: add additional logging of conditions message to checkCondition (#…
Browse files Browse the repository at this point in the history
…41)

Adds additional logging of the conditions message to checkCondition()
  • Loading branch information
maximilianbraun authored Jan 4, 2024
2 parents 7d6cac0 + c1f59db commit 0fedc4c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/xpconditions/xpconditions.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,24 @@ func checkCondition(unstruc *unstructured.Unstructured, desiredType string, desi
}

status := ""
message := ""
for _, condition := range conditions {
c := condition.(map[string]interface{})
curType := c["type"]
if curType == desiredType {
status = c["status"].(string)
msg, convertible := c["message"].(string)
if convertible {
message = msg
}
}
}
matchedConditionStatus := false
if status == string(desiredStatus) {
matchedConditionStatus = true
}

klog.V(4).Infof("Object (%s) %s, condition: %s: %s, matched: %b", unstruc.GroupVersionKind().String(), unstruc.GetName(), desiredType, status, matchedConditionStatus)
klog.V(4).Infof("Object (%s) %s, condition: %s: %s, matched: %b, message: %s", unstruc.GroupVersionKind().String(), unstruc.GetName(), desiredType, status, matchedConditionStatus, message)

return matchedConditionStatus
}
Expand Down

0 comments on commit 0fedc4c

Please sign in to comment.