Skip to content

Commit de495f8

Browse files
refactor haproxy action
Signed-off-by: Jintao Zhang <zhangjintao9020@gmail.com>
1 parent 423799c commit de495f8

File tree

1 file changed

+10
-1
lines changed
  • pkg/cluster/internal/create/actions/loadbalancer

1 file changed

+10
-1
lines changed

pkg/cluster/internal/create/actions/loadbalancer/haproxy.go

+10-1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,16 @@ func (a *Action) Execute(ctx *actions.ActionContext) error {
6060
ctx.Status.Start("Starting the external load balancer ⚖️")
6161
defer ctx.Status.End(false)
6262

63+
err = ConfigHAProxy(loadBalancerNode, allNodes)
64+
if err != nil {
65+
return err
66+
}
67+
68+
ctx.Status.End(true)
69+
return nil
70+
}
71+
72+
func ConfigHAProxy(loadBalancerNode *nodes.Node, allNodes []nodes.Node) error {
6373
// collect info about the existing controlplane nodes
6474
var backendServers = map[string]string{}
6575
controlPlaneNodes, err := nodes.SelectNodesByRole(
@@ -103,6 +113,5 @@ func (a *Action) Execute(ctx *actions.ActionContext) error {
103113
return errors.Wrap(err, "failed to start haproxy")
104114
}
105115

106-
ctx.Status.End(true)
107116
return nil
108117
}

0 commit comments

Comments
 (0)