(ctx context.Context, in *proto.DataplaneInfo)
| 230 | } |
| 231 | |
| 232 | func (c *CpApiServer) RegisterDataplane(ctx context.Context, in *proto.DataplaneInfo) (*proto.ActionStatus, error) { |
| 233 | if !c.LeaderElectionServer.IsLeader() { |
| 234 | leader := c.LeaderElectionServer.GetLeader() |
| 235 | |
| 236 | if leader != nil { |
| 237 | logrus.Warn("Received RegisterDataplane call although not the leader. Forwarding the call...") |
| 238 | return leader.RegisterDataplane(ctx, in) |
| 239 | } else { |
| 240 | return &proto.ActionStatus{Success: false}, nil |
| 241 | } |
| 242 | } |
| 243 | |
| 244 | status, err, isHeartbeat := c.ControlPlane.RegisterDataplane(ctx, in) |
| 245 | if status.Success && err == nil && !isHeartbeat { |
| 246 | c.HAProxyAPI.AddDataplane(in.IP, int(in.ProxyPort), true) |
| 247 | c.DisseminateHAProxyConfig() |
| 248 | } |
| 249 | |
| 250 | return status, err |
| 251 | } |
| 252 | |
| 253 | func (c *CpApiServer) DeregisterDataplane(ctx context.Context, in *proto.DataplaneInfo) (*proto.ActionStatus, error) { |
| 254 | if !c.LeaderElectionServer.IsLeader() { |
nothing calls this directly
no test coverage detected