Skip to content

Commit

Permalink
Ready clusters have condition[type==Ready && status=True]
Browse files Browse the repository at this point in the history
  • Loading branch information
ericpromislow committed Jan 13, 2025
1 parent 0247d1f commit 45a9ba9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/resources/virtual/clusters/clusters.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func TransformManagedCluster(obj *unstructured.Unstructured) (*unstructured.Unst
logrus.Errorf("Failed to process condition %v (%d) as a map", condition, i)
return obj, fmt.Errorf("failed to parse a condition as a map")
}
if conditionMap["type"] == "Ready" {
if conditionMap["type"] == "Ready" && conditionMap["status"] == "True" {
connectedStatus = true
break
}
Expand Down
14 changes: 14 additions & 0 deletions pkg/resources/virtual/clusters/clusters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ func TestTransformManagedCluster(t *testing.T) {
"transitioning": false,
"type": "SystemProjectCreated",
},
map[string]interface{}{
"error": false,
"lastUpdateTime": "2025-01-10T22:52:17Z",
"status": "False",
"transitioning": false,
"type": "Ready",
},
},
},
},
Expand Down Expand Up @@ -88,6 +95,13 @@ func TestTransformManagedCluster(t *testing.T) {
"transitioning": false,
"type": "SystemProjectCreated",
},
map[string]interface{}{
"error": false,
"lastUpdateTime": "2025-01-10T22:52:17Z",
"status": "False",
"transitioning": false,
"type": "Ready",
},
},
"connected": false,
},
Expand Down

0 comments on commit 45a9ba9

Please sign in to comment.