Skip to content

Commit

Permalink
feat: ready on expected modules ready
Browse files Browse the repository at this point in the history
  • Loading branch information
David Ragot committed Feb 23, 2024
1 parent 8dad6ea commit b2921d8
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion ee/agent/internal/informer_stacks.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,22 @@ import (
"k8s.io/client-go/tools/cache"
)

func getExpectedModules() []string {
return []string{
"stargate",
"gateway",
"auth",
"ledger",
"payments",
"reconcillation",
"wallets",
"search",
"reconciliation",
"orchestration",
"webhooks",
}
}

func StacksEventHandler(logger sharedlogging.Logger, membershipClient MembershipClient) cache.ResourceEventHandlerFuncs {
sendStatus := func(stack string, status generated.StackStatus) {
if err := membershipClient.Send(&generated.Message{
Expand All @@ -28,7 +44,11 @@ func StacksEventHandler(logger sharedlogging.Logger, membershipClient Membership
}

if stack.Status.Ready {
return generated.StackStatus_Ready
if len(stack.Status.Modules) == len(getExpectedModules()) {
return generated.StackStatus_Ready
} else {
return generated.StackStatus_Progressing
}
} else {
return generated.StackStatus_Progressing
}
Expand Down

0 comments on commit b2921d8

Please sign in to comment.