Skip to content

Commit

Permalink
Properly check for the globalnet Allocated status condition
Browse files Browse the repository at this point in the history
Globalnet now correctly maintains only the last status.

Signed-off-by: Tom Pantelis <[email protected]>
  • Loading branch information
tpantelis committed Aug 11, 2023
1 parent da9acab commit 7f89555
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions pkg/agent/controller/globalingressip.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,18 @@ func parseIngressIP(obj *unstructured.Unstructured) *IngressIP {

gip.allocatedIP, _, _ = unstructured.NestedString(obj.Object, "status", "allocatedIP")
if gip.allocatedIP == "" {
gip.unallocatedMsg = defaultMsgIPUnavailable
gip.unallocatedReason = defaultReasonIPUnavailable

conditions, _, _ := unstructured.NestedSlice(obj.Object, "status", "conditions")
if len(conditions) > 0 {
latestCondition := conditions[len(conditions)-1].(map[string]interface{})
gip.unallocatedMsg = latestCondition["message"].(string)
gip.unallocatedReason = latestCondition["reason"].(string)
} else {
gip.unallocatedMsg = defaultMsgIPUnavailable
gip.unallocatedReason = defaultReasonIPUnavailable
for i := range conditions {
c := conditions[i].(map[string]interface{})
if c["type"].(string) == "Allocated" {
gip.unallocatedMsg = c["message"].(string)
gip.unallocatedReason = c["reason"].(string)

break
}
}
}

Expand Down

0 comments on commit 7f89555

Please sign in to comment.