Skip to content

Commit

Permalink
fix(cli): remove failing check from 'connect envoy' registration for …
Browse files Browse the repository at this point in the history
…api gateway
  • Loading branch information
DanStough committed Jul 5, 2023
1 parent 0094dbf commit 954bd6a
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions command/connect/envoy/envoy.go
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,18 @@ func (c *cmd) run(args []string) int {
meta = map[string]string{structs.MetaWANFederationKey: "1"}
}

// API gateways do not have a default listener or ready endpoint,
// so adding any check to the registration will fail
var check *api.AgentServiceCheck
if c.gatewayKind == api.ServiceKindAPIGateway {
check = &api.AgentServiceCheck{
Name: fmt.Sprintf("%s listening", c.gatewayKind),
TCP: ipaddr.FormatAddressPort(tcpCheckAddr, lanAddr.Port),
Interval: "10s",
DeregisterCriticalServiceAfter: c.deregAfterCritical,
}
}

svc := api.AgentServiceRegistration{
Kind: c.gatewayKind,
Name: c.gatewaySvcName,
Expand All @@ -449,12 +461,7 @@ func (c *cmd) run(args []string) int {
Meta: meta,
TaggedAddresses: taggedAddrs,
Proxy: proxyConf,
Check: &api.AgentServiceCheck{
Name: fmt.Sprintf("%s listening", c.gatewayKind),
TCP: ipaddr.FormatAddressPort(tcpCheckAddr, lanAddr.Port),
Interval: "10s",
DeregisterCriticalServiceAfter: c.deregAfterCritical,
},
Check: check,
}

if err := c.client.Agent().ServiceRegister(&svc); err != nil {
Expand Down

0 comments on commit 954bd6a

Please sign in to comment.