Skip to content

Commit cfec24c

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

File tree

1 file changed

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

1 file changed

+11
-1
lines changed

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

+11-1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,17 @@ 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+
// ConfigHAProxy is common method for HAProxy
73+
func ConfigHAProxy(loadBalancerNode *nodes.Node, allNodes []nodes.Node) error {
6374
// collect info about the existing controlplane nodes
6475
var backendServers = map[string]string{}
6576
controlPlaneNodes, err := nodes.SelectNodesByRole(
@@ -103,6 +114,5 @@ func (a *Action) Execute(ctx *actions.ActionContext) error {
103114
return errors.Wrap(err, "failed to start haproxy")
104115
}
105116

106-
ctx.Status.End(true)
107117
return nil
108118
}

0 commit comments

Comments
 (0)