Skip to content

Commit 21c1a49

Browse files
authored
Merge pull request #83 from flanksource/fix-ready
fix: handle readiness of objects that report initialization
2 parents b1af0fc + 49b2a7b commit 21c1a49

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

wait.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,10 +270,18 @@ func (c *Client) IsReady(item *unstructured.Unstructured) (bool, string) {
270270
}
271271
for _, raw := range conditions {
272272
condition := raw.(map[string]interface{})
273-
if condition["type"] != "Ready" && condition["status"] != "False" {
273+
trueIsGood := false
274+
275+
if condition["type"] == "Ready" {
276+
trueIsGood = true
277+
}
278+
if strings.HasSuffix("initialized", strings.ToLower(condition["type"].(string))) {
279+
trueIsGood = true
280+
}
281+
if !trueIsGood && condition["status"] != "False" {
274282
return false, fmt.Sprintf("⏳ waiting for %s/%s: %s", condition["type"], condition["status"], condition["message"])
275283
}
276-
if condition["type"] == "Ready" && condition["status"] != "True" {
284+
if trueIsGood && condition["status"] != "True" {
277285
return false, fmt.Sprintf("⏳ waiting for %s/%s: %s", condition["type"], condition["status"], condition["message"])
278286
}
279287
}

0 commit comments

Comments
 (0)