Save exposed ports in agent's store and expose them via API (#10173)

* Save exposed HTTP or GRPC ports to the agent's store
* Add those the health checks API so we can retrieve them from the API
* Change redirect-traffic command to also exclude those ports from inbound traffic redirection when expose.checks is set to true.
This commit is contained in:
Iryna Shustava 2021-05-12 13:51:39 -07:00 committed by GitHub
parent 71fc219189
commit d7d44f6ae7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 380 additions and 236 deletions

9
.changelog/10173.txt Normal file
View File

@ -0,0 +1,9 @@
```release-note:improvement
agent: Save exposed Envoy ports to the agent's state when `Expose.Checks` is true in proxy's configuration.
```
```release-note:improvement
api: Add `ExposedPort` to the health check API resource.
```
```release-note:improvement
command: Exclude exposed Envoy ports from traffic redirection when providing `-proxy-id` and `Expose.Checks` is set.
```

View File

@ -2555,6 +2555,7 @@ func (a *Agent) addCheck(check *structs.HealthCheck, chkType *structs.CheckType,
return err return err
} }
http.ProxyHTTP = httpInjectAddr(http.HTTP, proxy.Address, port) http.ProxyHTTP = httpInjectAddr(http.HTTP, proxy.Address, port)
check.ExposedPort = port
} }
http.Start() http.Start()
@ -2624,6 +2625,7 @@ func (a *Agent) addCheck(check *structs.HealthCheck, chkType *structs.CheckType,
return err return err
} }
grpc.ProxyGRPC = grpcInjectAddr(grpc.GRPC, proxy.Address, port) grpc.ProxyGRPC = grpcInjectAddr(grpc.GRPC, proxy.Address, port)
check.ExposedPort = port
} }
grpc.Start() grpc.Start()
@ -3809,6 +3811,8 @@ func (a *Agent) rerouteExposedChecks(serviceID structs.ServiceID, proxyAddr stri
return err return err
} }
c.ProxyHTTP = httpInjectAddr(c.HTTP, proxyAddr, port) c.ProxyHTTP = httpInjectAddr(c.HTTP, proxyAddr, port)
hc := a.State.Check(cid)
hc.ExposedPort = port
} }
for cid, c := range a.checkGRPCs { for cid, c := range a.checkGRPCs {
if c.ServiceID != serviceID { if c.ServiceID != serviceID {
@ -3819,6 +3823,8 @@ func (a *Agent) rerouteExposedChecks(serviceID structs.ServiceID, proxyAddr stri
return err return err
} }
c.ProxyGRPC = grpcInjectAddr(c.GRPC, proxyAddr, port) c.ProxyGRPC = grpcInjectAddr(c.GRPC, proxyAddr, port)
hc := a.State.Check(cid)
hc.ExposedPort = port
} }
return nil return nil
} }
@ -3831,12 +3837,16 @@ func (a *Agent) resetExposedChecks(serviceID structs.ServiceID) {
for cid, c := range a.checkHTTPs { for cid, c := range a.checkHTTPs {
if c.ServiceID == serviceID { if c.ServiceID == serviceID {
c.ProxyHTTP = "" c.ProxyHTTP = ""
hc := a.State.Check(cid)
hc.ExposedPort = 0
ids = append(ids, cid) ids = append(ids, cid)
} }
} }
for cid, c := range a.checkGRPCs { for cid, c := range a.checkGRPCs {
if c.ServiceID == serviceID { if c.ServiceID == serviceID {
c.ProxyGRPC = "" c.ProxyGRPC = ""
hc := a.State.Check(cid)
hc.ExposedPort = 0
ids = append(ids, cid) ids = append(ids, cid)
} }
} }

View File

@ -1389,6 +1389,7 @@ func TestAgent_IndexChurn(t *testing.T) {
// verifyIndexChurn registers some things and runs anti-entropy a bunch of times // verifyIndexChurn registers some things and runs anti-entropy a bunch of times
// in a row to make sure there are no index bumps. // in a row to make sure there are no index bumps.
func verifyIndexChurn(t *testing.T, tags []string) { func verifyIndexChurn(t *testing.T, tags []string) {
t.Helper()
a := NewTestAgent(t, "") a := NewTestAgent(t, "")
defer a.Shutdown() defer a.Shutdown()
@ -4299,8 +4300,8 @@ func TestAgent_RerouteExistingHTTPChecks(t *testing.T) {
t.Fatalf("failed to add svc: %v", err) t.Fatalf("failed to add svc: %v", err)
} }
// Register a proxy and expose HTTP checks // Register a proxy and expose HTTP checks.
// This should trigger setting ProxyHTTP and ProxyGRPC in the checks // This should trigger setting ProxyHTTP and ProxyGRPC in the checks.
proxy := &structs.NodeService{ proxy := &structs.NodeService{
Kind: "connect-proxy", Kind: "connect-proxy",
ID: "web-proxy", ID: "web-proxy",
@ -4324,36 +4325,30 @@ func TestAgent_RerouteExistingHTTPChecks(t *testing.T) {
retry.Run(t, func(r *retry.R) { retry.Run(t, func(r *retry.R) {
chks := a.ServiceHTTPBasedChecks(structs.NewServiceID("web", nil)) chks := a.ServiceHTTPBasedChecks(structs.NewServiceID("web", nil))
require.Equal(r, chks[0].ProxyHTTP, "http://localhost:21500/mypath?query")
})
got := chks[0].ProxyHTTP retry.Run(t, func(r *retry.R) {
if got == "" { hc := a.State.Check(structs.NewCheckID("http", nil))
r.Fatal("proxyHTTP addr not set in check") require.Equal(r, hc.ExposedPort, 21500)
}
want := "http://localhost:21500/mypath?query"
if got != want {
r.Fatalf("unexpected proxy addr in check, want: %s, got: %s", want, got)
}
}) })
retry.Run(t, func(r *retry.R) { retry.Run(t, func(r *retry.R) {
chks := a.ServiceHTTPBasedChecks(structs.NewServiceID("web", nil)) chks := a.ServiceHTTPBasedChecks(structs.NewServiceID("web", nil))
// Will be at a later index than HTTP check because of the fetching order in ServiceHTTPBasedChecks // GRPC check will be at a later index than HTTP check because of the fetching order in ServiceHTTPBasedChecks.
got := chks[1].ProxyGRPC // Note that this relies on listener ports auto-incrementing in a.listenerPortLocked.
if got == "" { require.Equal(r, chks[1].ProxyGRPC, "localhost:21501/myservice")
r.Fatal("ProxyGRPC addr not set in check")
}
// Node that this relies on listener ports auto-incrementing in a.listenerPortLocked
want := "localhost:21501/myservice"
if got != want {
r.Fatalf("unexpected proxy addr in check, want: %s, got: %s", want, got)
}
}) })
// Re-register a proxy and disable exposing HTTP checks retry.Run(t, func(r *retry.R) {
hc := a.State.Check(structs.NewCheckID("grpc", nil))
require.Equal(r, hc.ExposedPort, 21501)
})
// Re-register a proxy and disable exposing HTTP checks.
// This should trigger resetting ProxyHTTP and ProxyGRPC to empty strings // This should trigger resetting ProxyHTTP and ProxyGRPC to empty strings
// and reset saved exposed ports in the agent's state.
proxy = &structs.NodeService{ proxy = &structs.NodeService{
Kind: "connect-proxy", Kind: "connect-proxy",
ID: "web-proxy", ID: "web-proxy",
@ -4377,21 +4372,24 @@ func TestAgent_RerouteExistingHTTPChecks(t *testing.T) {
retry.Run(t, func(r *retry.R) { retry.Run(t, func(r *retry.R) {
chks := a.ServiceHTTPBasedChecks(structs.NewServiceID("web", nil)) chks := a.ServiceHTTPBasedChecks(structs.NewServiceID("web", nil))
require.Empty(r, chks[0].ProxyHTTP, "ProxyHTTP addr was not reset")
})
got := chks[0].ProxyHTTP retry.Run(t, func(r *retry.R) {
if got != "" { hc := a.State.Check(structs.NewCheckID("http", nil))
r.Fatal("ProxyHTTP addr was not reset") require.Equal(r, hc.ExposedPort, 0)
}
}) })
retry.Run(t, func(r *retry.R) { retry.Run(t, func(r *retry.R) {
chks := a.ServiceHTTPBasedChecks(structs.NewServiceID("web", nil)) chks := a.ServiceHTTPBasedChecks(structs.NewServiceID("web", nil))
// Will be at a later index than HTTP check because of the fetching order in ServiceHTTPBasedChecks // Will be at a later index than HTTP check because of the fetching order in ServiceHTTPBasedChecks.
got := chks[1].ProxyGRPC require.Empty(r, chks[1].ProxyGRPC, "ProxyGRPC addr was not reset")
if got != "" { })
r.Fatal("ProxyGRPC addr was not reset")
} retry.Run(t, func(r *retry.R) {
hc := a.State.Check(structs.NewCheckID("grpc", nil))
require.Equal(r, hc.ExposedPort, 0)
}) })
} }
@ -4480,31 +4478,24 @@ func TestAgent_RerouteNewHTTPChecks(t *testing.T) {
retry.Run(t, func(r *retry.R) { retry.Run(t, func(r *retry.R) {
chks := a.ServiceHTTPBasedChecks(structs.NewServiceID("web", nil)) chks := a.ServiceHTTPBasedChecks(structs.NewServiceID("web", nil))
require.Equal(r, chks[0].ProxyHTTP, "http://localhost:21500/mypath?query")
})
got := chks[0].ProxyHTTP retry.Run(t, func(r *retry.R) {
if got == "" { hc := a.State.Check(structs.NewCheckID("http", nil))
r.Fatal("ProxyHTTP addr not set in check") require.Equal(r, hc.ExposedPort, 21500)
}
want := "http://localhost:21500/mypath?query"
if got != want {
r.Fatalf("unexpected proxy addr in http check, want: %s, got: %s", want, got)
}
}) })
retry.Run(t, func(r *retry.R) { retry.Run(t, func(r *retry.R) {
chks := a.ServiceHTTPBasedChecks(structs.NewServiceID("web", nil)) chks := a.ServiceHTTPBasedChecks(structs.NewServiceID("web", nil))
// Will be at a later index than HTTP check because of the fetching order in ServiceHTTPBasedChecks // GRPC check will be at a later index than HTTP check because of the fetching order in ServiceHTTPBasedChecks.
got := chks[1].ProxyGRPC require.Equal(r, chks[1].ProxyGRPC, "localhost:21501/myservice")
if got == "" { })
r.Fatal("ProxyGRPC addr not set in check")
}
want := "localhost:21501/myservice" retry.Run(t, func(r *retry.R) {
if got != want { hc := a.State.Check(structs.NewCheckID("grpc", nil))
r.Fatalf("unexpected proxy addr in grpc check, want: %s, got: %s", want, got) require.Equal(r, hc.ExposedPort, 21501)
}
}) })
} }

View File

@ -1400,7 +1400,7 @@ type NodeServiceList struct {
Services []*NodeService Services []*NodeService
} }
// HealthCheck represents a single check on a given node // HealthCheck represents a single check on a given node.
type HealthCheck struct { type HealthCheck struct {
Node string Node string
CheckID types.CheckID // Unique per-node ID CheckID types.CheckID // Unique per-node ID
@ -1413,6 +1413,10 @@ type HealthCheck struct {
ServiceTags []string // optional service tags ServiceTags []string // optional service tags
Type string // Check type: http/ttl/tcp/etc Type string // Check type: http/ttl/tcp/etc
// ExposedPort is the port of the exposed Envoy listener representing the
// HTTP or GRPC health check of the service.
ExposedPort int
Definition HealthCheckDefinition `bexpr:"-"` Definition HealthCheckDefinition `bexpr:"-"`
EnterpriseMeta `hcl:",squash" mapstructure:",squash" bexpr:"-"` EnterpriseMeta `hcl:",squash" mapstructure:",squash" bexpr:"-"`

View File

@ -9,7 +9,7 @@ import (
"sync" "sync"
"testing" "testing"
bexpr "github.com/hashicorp/go-bexpr" "github.com/hashicorp/go-bexpr"
"github.com/mitchellh/pointerstructure" "github.com/mitchellh/pointerstructure"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
@ -545,6 +545,11 @@ var expectedFieldConfigHealthCheck bexpr.FieldConfigurations = bexpr.FieldConfig
SupportedOperations: []bexpr.MatchOperator{bexpr.MatchEqual, bexpr.MatchNotEqual, bexpr.MatchIn, bexpr.MatchNotIn, bexpr.MatchMatches, bexpr.MatchNotMatches}, SupportedOperations: []bexpr.MatchOperator{bexpr.MatchEqual, bexpr.MatchNotEqual, bexpr.MatchIn, bexpr.MatchNotIn, bexpr.MatchMatches, bexpr.MatchNotMatches},
StructFieldName: "Type", StructFieldName: "Type",
}, },
"ExposedPort": &bexpr.FieldConfiguration{
CoerceFn: bexpr.CoerceInt,
SupportedOperations: []bexpr.MatchOperator{bexpr.MatchEqual, bexpr.MatchNotEqual},
StructFieldName: "ExposedPort",
},
} }
var expectedFieldConfigCheckServiceNode bexpr.FieldConfigurations = bexpr.FieldConfigurations{ var expectedFieldConfigCheckServiceNode bexpr.FieldConfigurations = bexpr.FieldConfigurations{

View File

@ -63,6 +63,7 @@ type AgentCheck struct {
ServiceID string ServiceID string
ServiceName string ServiceName string
Type string Type string
ExposedPort int
Definition HealthCheckDefinition Definition HealthCheckDefinition
Namespace string `json:",omitempty"` Namespace string `json:",omitempty"`
} }

View File

@ -197,6 +197,21 @@ func (c *cmd) generateConfigFromFlags() (iptables.Config, error) {
cfg.ExcludeInboundPorts = append(cfg.ExcludeInboundPorts, strconv.Itoa(exposePath.ListenerPort)) cfg.ExcludeInboundPorts = append(cfg.ExcludeInboundPorts, strconv.Itoa(exposePath.ListenerPort))
} }
} }
// Exclude any exposed health check ports when Proxy.Expose.Checks is true.
if svc.Proxy.Expose.Checks {
// Get the health checks of the destination service.
checks, err := c.client.Agent().ChecksWithFilter(fmt.Sprintf("ServiceName == %q", svc.Proxy.DestinationServiceName))
if err != nil {
return iptables.Config{}, err
}
for _, check := range checks {
if check.ExposedPort != 0 {
cfg.ExcludeInboundPorts = append(cfg.ExcludeInboundPorts, strconv.Itoa(check.ExposedPort))
}
}
}
} }
for _, port := range c.excludeInboundPorts { for _, port := range c.excludeInboundPorts {

View File

@ -64,7 +64,7 @@ func TestGenerateConfigFromFlags(t *testing.T) {
cases := []struct { cases := []struct {
name string name string
command func() cmd command func() cmd
proxyService *api.AgentServiceRegistration consulServices []api.AgentServiceRegistration
expCfg iptables.Config expCfg iptables.Config
expError string expError string
}{ }{
@ -77,7 +77,8 @@ func TestGenerateConfigFromFlags(t *testing.T) {
c.proxyID = "test-proxy-id" c.proxyID = "test-proxy-id"
return c return c
}, },
&api.AgentServiceRegistration{ []api.AgentServiceRegistration{
{
Kind: api.ServiceKindConnectProxy, Kind: api.ServiceKindConnectProxy,
ID: "test-proxy-id", ID: "test-proxy-id",
Name: "test-proxy", Name: "test-proxy",
@ -87,6 +88,7 @@ func TestGenerateConfigFromFlags(t *testing.T) {
DestinationServiceName: "foo", DestinationServiceName: "foo",
}, },
}, },
},
iptables.Config{ iptables.Config{
ProxyUserID: "1234", ProxyUserID: "1234",
ProxyInboundPort: 20000, ProxyInboundPort: 20000,
@ -103,7 +105,8 @@ func TestGenerateConfigFromFlags(t *testing.T) {
c.proxyID = "test-proxy-id" c.proxyID = "test-proxy-id"
return c return c
}, },
&api.AgentServiceRegistration{ []api.AgentServiceRegistration{
{
Kind: api.ServiceKindConnectProxy, Kind: api.ServiceKindConnectProxy,
ID: "test-proxy-id", ID: "test-proxy-id",
Name: "test-proxy", Name: "test-proxy",
@ -116,6 +119,7 @@ func TestGenerateConfigFromFlags(t *testing.T) {
}, },
}, },
}, },
},
iptables.Config{ iptables.Config{
ProxyUserID: "1234", ProxyUserID: "1234",
ProxyInboundPort: 21000, ProxyInboundPort: 21000,
@ -132,7 +136,8 @@ func TestGenerateConfigFromFlags(t *testing.T) {
c.proxyID = "test-proxy-id" c.proxyID = "test-proxy-id"
return c return c
}, },
&api.AgentServiceRegistration{ []api.AgentServiceRegistration{
{
Kind: api.ServiceKindConnectProxy, Kind: api.ServiceKindConnectProxy,
ID: "test-proxy-id", ID: "test-proxy-id",
Name: "test-proxy", Name: "test-proxy",
@ -145,6 +150,7 @@ func TestGenerateConfigFromFlags(t *testing.T) {
}, },
}, },
}, },
},
iptables.Config{ iptables.Config{
ProxyUserID: "1234", ProxyUserID: "1234",
ProxyInboundPort: 21000, ProxyInboundPort: 21000,
@ -161,7 +167,8 @@ func TestGenerateConfigFromFlags(t *testing.T) {
c.proxyID = "test-proxy-id" c.proxyID = "test-proxy-id"
return c return c
}, },
&api.AgentServiceRegistration{ []api.AgentServiceRegistration{
{
Kind: api.ServiceKindConnectProxy, Kind: api.ServiceKindConnectProxy,
ID: "test-proxy-id", ID: "test-proxy-id",
Name: "test-proxy", Name: "test-proxy",
@ -174,6 +181,7 @@ func TestGenerateConfigFromFlags(t *testing.T) {
}, },
}, },
}, },
},
iptables.Config{}, iptables.Config{},
"failed parsing Proxy.Config: 1 error(s) decoding:\n\n* cannot parse 'bind_port' as int:", "failed parsing Proxy.Config: 1 error(s) decoding:\n\n* cannot parse 'bind_port' as int:",
}, },
@ -186,7 +194,8 @@ func TestGenerateConfigFromFlags(t *testing.T) {
c.proxyID = "test-proxy-id" c.proxyID = "test-proxy-id"
return c return c
}, },
&api.AgentServiceRegistration{ []api.AgentServiceRegistration{
{
Kind: api.ServiceKindConnectProxy, Kind: api.ServiceKindConnectProxy,
ID: "test-proxy-id", ID: "test-proxy-id",
Name: "test-proxy", Name: "test-proxy",
@ -199,6 +208,7 @@ func TestGenerateConfigFromFlags(t *testing.T) {
}, },
}, },
}, },
},
iptables.Config{ iptables.Config{
ProxyUserID: "1234", ProxyUserID: "1234",
ProxyInboundPort: 20000, ProxyInboundPort: 20000,
@ -228,12 +238,14 @@ func TestGenerateConfigFromFlags(t *testing.T) {
c.proxyID = "test-proxy-id" c.proxyID = "test-proxy-id"
return c return c
}, },
&api.AgentServiceRegistration{ []api.AgentServiceRegistration{
{
ID: "test-proxy-id", ID: "test-proxy-id",
Name: "test-proxy", Name: "test-proxy",
Port: 20000, Port: 20000,
Address: "1.1.1.1", Address: "1.1.1.1",
}, },
},
iptables.Config{}, iptables.Config{},
"service test-proxy-id is not a proxy service", "service test-proxy-id is not a proxy service",
}, },
@ -357,7 +369,8 @@ func TestGenerateConfigFromFlags(t *testing.T) {
c.proxyID = "test-proxy-id" c.proxyID = "test-proxy-id"
return c return c
}, },
&api.AgentServiceRegistration{ []api.AgentServiceRegistration{
{
Kind: api.ServiceKindConnectProxy, Kind: api.ServiceKindConnectProxy,
ID: "test-proxy-id", ID: "test-proxy-id",
Name: "test-proxy", Name: "test-proxy",
@ -370,6 +383,7 @@ func TestGenerateConfigFromFlags(t *testing.T) {
}, },
}, },
}, },
},
iptables.Config{ iptables.Config{
ProxyUserID: "1234", ProxyUserID: "1234",
ProxyInboundPort: 20000, ProxyInboundPort: 20000,
@ -387,7 +401,8 @@ func TestGenerateConfigFromFlags(t *testing.T) {
c.proxyID = "test-proxy-id" c.proxyID = "test-proxy-id"
return c return c
}, },
&api.AgentServiceRegistration{ []api.AgentServiceRegistration{
{
Kind: api.ServiceKindConnectProxy, Kind: api.ServiceKindConnectProxy,
ID: "test-proxy-id", ID: "test-proxy-id",
Name: "test-proxy", Name: "test-proxy",
@ -400,6 +415,7 @@ func TestGenerateConfigFromFlags(t *testing.T) {
}, },
}, },
}, },
},
iptables.Config{}, iptables.Config{},
"failed parsing host and port from envoy_prometheus_bind_addr: address 9000: missing port in address", "failed parsing host and port from envoy_prometheus_bind_addr: address 9000: missing port in address",
}, },
@ -412,7 +428,8 @@ func TestGenerateConfigFromFlags(t *testing.T) {
c.proxyID = "test-proxy-id" c.proxyID = "test-proxy-id"
return c return c
}, },
&api.AgentServiceRegistration{ []api.AgentServiceRegistration{
{
Kind: api.ServiceKindConnectProxy, Kind: api.ServiceKindConnectProxy,
ID: "test-proxy-id", ID: "test-proxy-id",
Name: "test-proxy", Name: "test-proxy",
@ -425,6 +442,7 @@ func TestGenerateConfigFromFlags(t *testing.T) {
}, },
}, },
}, },
},
iptables.Config{ iptables.Config{
ProxyUserID: "1234", ProxyUserID: "1234",
ProxyInboundPort: 20000, ProxyInboundPort: 20000,
@ -442,7 +460,8 @@ func TestGenerateConfigFromFlags(t *testing.T) {
c.proxyID = "test-proxy-id" c.proxyID = "test-proxy-id"
return c return c
}, },
&api.AgentServiceRegistration{ []api.AgentServiceRegistration{
{
Kind: api.ServiceKindConnectProxy, Kind: api.ServiceKindConnectProxy,
ID: "test-proxy-id", ID: "test-proxy-id",
Name: "test-proxy", Name: "test-proxy",
@ -455,6 +474,7 @@ func TestGenerateConfigFromFlags(t *testing.T) {
}, },
}, },
}, },
},
iptables.Config{}, iptables.Config{},
"failed parsing host and port from envoy_stats_bind_addr: address 8000: missing port in address", "failed parsing host and port from envoy_stats_bind_addr: address 8000: missing port in address",
}, },
@ -467,7 +487,8 @@ func TestGenerateConfigFromFlags(t *testing.T) {
c.proxyID = "test-proxy-id" c.proxyID = "test-proxy-id"
return c return c
}, },
&api.AgentServiceRegistration{ []api.AgentServiceRegistration{
{
Kind: api.ServiceKindConnectProxy, Kind: api.ServiceKindConnectProxy,
ID: "test-proxy-id", ID: "test-proxy-id",
Name: "test-proxy", Name: "test-proxy",
@ -486,6 +507,7 @@ func TestGenerateConfigFromFlags(t *testing.T) {
}, },
}, },
}, },
},
iptables.Config{ iptables.Config{
ProxyUserID: "1234", ProxyUserID: "1234",
ProxyInboundPort: 20000, ProxyInboundPort: 20000,
@ -494,12 +516,63 @@ func TestGenerateConfigFromFlags(t *testing.T) {
}, },
"", "",
}, },
{
"proxy config has expose paths with checks set to true",
func() cmd {
var c cmd
c.init()
c.proxyUID = "1234"
c.proxyID = "test-proxy-id"
return c
},
[]api.AgentServiceRegistration{
{
ID: "foo-id",
Name: "foo",
Port: 8080,
Address: "1.1.1.1",
Checks: []*api.AgentServiceCheck{
{
Name: "http",
HTTP: "1.1.1.1:8080/health",
Interval: "10s",
},
{
Name: "grpc",
GRPC: "1.1.1.1:8081",
Interval: "10s",
},
},
},
{
Kind: api.ServiceKindConnectProxy,
ID: "test-proxy-id",
Name: "test-proxy",
Port: 20000,
Address: "1.1.1.1",
Proxy: &api.AgentServiceConnectProxyConfig{
DestinationServiceName: "foo",
DestinationServiceID: "foo-id",
Expose: api.ExposeConfig{
Checks: true,
},
},
},
},
iptables.Config{
ProxyUserID: "1234",
ProxyInboundPort: 20000,
ProxyOutboundPort: iptables.DefaultTProxyOutboundPort,
ExcludeInboundPorts: []string{"21500", "21501"},
},
"",
},
} }
for _, c := range cases { for _, c := range cases {
t.Run(c.name, func(t *testing.T) { t.Run(c.name, func(t *testing.T) {
cmd := c.command() cmd := c.command()
if c.proxyService != nil { if c.consulServices != nil {
testServer, err := testutil.NewTestServerConfigT(t, nil) testServer, err := testutil.NewTestServerConfigT(t, nil)
require.NoError(t, err) require.NoError(t, err)
testServer.WaitForLeader(t) testServer.WaitForLeader(t)
@ -507,11 +580,12 @@ func TestGenerateConfigFromFlags(t *testing.T) {
client, err := api.NewClient(&api.Config{Address: testServer.HTTPAddr}) client, err := api.NewClient(&api.Config{Address: testServer.HTTPAddr})
require.NoError(t, err) require.NoError(t, err)
err = client.Agent().ServiceRegister(c.proxyService)
require.NoError(t, err)
cmd.client = client cmd.client = client
for _, service := range c.consulServices {
err = client.Agent().ServiceRegister(&service)
require.NoError(t, err)
}
} else { } else {
client, err := api.NewClient(&api.Config{Address: "not-reachable"}) client, err := api.NewClient(&api.Config{Address: "not-reachable"})
require.NoError(t, err) require.NoError(t, err)
@ -522,7 +596,7 @@ func TestGenerateConfigFromFlags(t *testing.T) {
if c.expError == "" { if c.expError == "" {
require.NoError(t, err) require.NoError(t, err)
require.Equal(t, c.expCfg, cfg) require.EqualValues(t, c.expCfg, cfg)
} else { } else {
require.Error(t, err) require.Error(t, err)
require.Contains(t, err.Error(), c.expError) require.Contains(t, err.Error(), c.expError)

View File

@ -80,6 +80,7 @@ func HealthCheckToStructs(s HealthCheck) structs.HealthCheck {
t.ServiceName = s.ServiceName t.ServiceName = s.ServiceName
t.ServiceTags = s.ServiceTags t.ServiceTags = s.ServiceTags
t.Type = s.Type t.Type = s.Type
t.ExposedPort = int(s.ExposedPort)
t.Definition = HealthCheckDefinitionToStructs(s.Definition) t.Definition = HealthCheckDefinitionToStructs(s.Definition)
t.EnterpriseMeta = EnterpriseMetaToStructs(s.EnterpriseMeta) t.EnterpriseMeta = EnterpriseMetaToStructs(s.EnterpriseMeta)
t.RaftIndex = RaftIndexToStructs(s.RaftIndex) t.RaftIndex = RaftIndexToStructs(s.RaftIndex)
@ -97,6 +98,7 @@ func NewHealthCheckFromStructs(t structs.HealthCheck) HealthCheck {
s.ServiceName = t.ServiceName s.ServiceName = t.ServiceName
s.ServiceTags = t.ServiceTags s.ServiceTags = t.ServiceTags
s.Type = t.Type s.Type = t.Type
s.ExposedPort = int32(t.ExposedPort)
s.Definition = NewHealthCheckDefinitionFromStructs(t.Definition) s.Definition = NewHealthCheckDefinitionFromStructs(t.Definition)
s.EnterpriseMeta = NewEnterpriseMetaFromStructs(t.EnterpriseMeta) s.EnterpriseMeta = NewEnterpriseMetaFromStructs(t.EnterpriseMeta)
s.RaftIndex = NewRaftIndexFromStructs(t.RaftIndex) s.RaftIndex = NewRaftIndexFromStructs(t.RaftIndex)

View File

@ -52,6 +52,8 @@ type HealthCheck struct {
pbcommon.RaftIndex `protobuf:"bytes,11,opt,name=RaftIndex,proto3,embedded=RaftIndex" json:"RaftIndex"` pbcommon.RaftIndex `protobuf:"bytes,11,opt,name=RaftIndex,proto3,embedded=RaftIndex" json:"RaftIndex"`
// mog: func-to=EnterpriseMetaToStructs func-from=NewEnterpriseMetaFromStructs // mog: func-to=EnterpriseMetaToStructs func-from=NewEnterpriseMetaFromStructs
EnterpriseMeta pbcommon.EnterpriseMeta `protobuf:"bytes,13,opt,name=EnterpriseMeta,proto3" json:"EnterpriseMeta"` EnterpriseMeta pbcommon.EnterpriseMeta `protobuf:"bytes,13,opt,name=EnterpriseMeta,proto3" json:"EnterpriseMeta"`
// mog: func-to=int func-from=int32
ExposedPort int32 `protobuf:"varint,14,opt,name=ExposedPort,proto3" json:"ExposedPort,omitempty"`
} }
func (m *HealthCheck) Reset() { *m = HealthCheck{} } func (m *HealthCheck) Reset() { *m = HealthCheck{} }
@ -285,72 +287,73 @@ func init() {
func init() { proto.RegisterFile("proto/pbservice/healthcheck.proto", fileDescriptor_8a6f7448747c9fbe) } func init() { proto.RegisterFile("proto/pbservice/healthcheck.proto", fileDescriptor_8a6f7448747c9fbe) }
var fileDescriptor_8a6f7448747c9fbe = []byte{ var fileDescriptor_8a6f7448747c9fbe = []byte{
// 1031 bytes of a gzipped FileDescriptorProto // 1051 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0x4d, 0x73, 0xdb, 0x44, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xcd, 0x52, 0xe3, 0x46,
0x18, 0xb6, 0xe2, 0x7c, 0x69, 0x9d, 0xa4, 0xc9, 0x36, 0x0d, 0xdb, 0xb4, 0xa3, 0x98, 0xc0, 0xc1, 0x17, 0xb5, 0x30, 0x3f, 0x56, 0x1b, 0x18, 0xe8, 0x61, 0xf8, 0x7a, 0x98, 0x29, 0xe1, 0x8f, 0x64,
0x0c, 0x41, 0x9e, 0x31, 0x03, 0x03, 0xcc, 0x00, 0x13, 0xdb, 0x6d, 0x62, 0x26, 0x09, 0x46, 0x16, 0x41, 0x2a, 0x44, 0xae, 0x22, 0x95, 0x54, 0x92, 0xaa, 0x24, 0x85, 0x31, 0x03, 0x4e, 0x01, 0x71,
0x3d, 0x70, 0x53, 0xe4, 0xb5, 0xad, 0xb1, 0xac, 0xf5, 0xac, 0x56, 0x99, 0x98, 0x2b, 0x7f, 0xa0, 0x64, 0x65, 0x16, 0xd9, 0x09, 0xb9, 0x6d, 0xab, 0x2c, 0xab, 0x55, 0xad, 0x16, 0x85, 0xf3, 0x14,
0xc7, 0xfe, 0x07, 0xfe, 0x48, 0x8e, 0x39, 0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 0xee, 0x8c, 0xdc, 0xf5, 0x9d, 0x91, 0xfb, 0xe3, 0xce, 0xc8, 0xfd, 0xf2, 0xe9, 0x7f, 0x89, 0x3b, 0xbb, 0xfe, 0xd3, 0x28, 0x5c, 0xdf, 0x19, 0xda, 0xcd, 0x9d, 0xa1, 0xfd, 0x71, 0x67, 0x68,
0xd5, 0x6b, 0xff, 0x2a, 0x9f, 0x2f, 0x43, 0xe0, 0xf3, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x5b, 0xaf, 0xee, 0x8d, 0xc2, 0xeb, 0x7b, 0xa3, 0x70, 0x73, 0x6f, 0x14, 0x7e, 0xbb, 0x37, 0x0a, 0x3f,
0x4c, 0x80, 0x35, 0x44, 0x0b, 0x00, 0x00, 0x7d, 0xfc, 0x4f, 0x66, 0xf5, 0xc6, 0x3f, 0xd3, 0x17, 0x8b, 0x00, 0x7c, 0xfa, 0x77, 0x00, 0x00,
0x00, 0xff, 0xff, 0x9d, 0xa1, 0x76, 0xfc, 0x66, 0x0b, 0x00, 0x00,
} }
func (m *HealthCheck) Marshal() (dAtA []byte, err error) { func (m *HealthCheck) Marshal() (dAtA []byte, err error) {
@ -373,6 +376,11 @@ func (m *HealthCheck) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i _ = i
var l int var l int
_ = l _ = l
if m.ExposedPort != 0 {
i = encodeVarintHealthcheck(dAtA, i, uint64(m.ExposedPort))
i--
dAtA[i] = 0x70
}
{ {
size, err := m.EnterpriseMeta.MarshalToSizedBuffer(dAtA[:i]) size, err := m.EnterpriseMeta.MarshalToSizedBuffer(dAtA[:i])
if err != nil { if err != nil {
@ -1043,6 +1051,9 @@ func (m *HealthCheck) Size() (n int) {
} }
l = m.EnterpriseMeta.Size() l = m.EnterpriseMeta.Size()
n += 1 + l + sovHealthcheck(uint64(l)) n += 1 + l + sovHealthcheck(uint64(l))
if m.ExposedPort != 0 {
n += 1 + sovHealthcheck(uint64(m.ExposedPort))
}
return n return n
} }
@ -1715,6 +1726,25 @@ func (m *HealthCheck) Unmarshal(dAtA []byte) error {
return err return err
} }
iNdEx = postIndex iNdEx = postIndex
case 14:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ExposedPort", wireType)
}
m.ExposedPort = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowHealthcheck
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ExposedPort |= int32(b&0x7F) << shift
if b < 0x80 {
break
}
}
default: default:
iNdEx = preIndex iNdEx = preIndex
skippy, err := skipHealthcheck(dAtA[iNdEx:]) skippy, err := skipHealthcheck(dAtA[iNdEx:])

View File

@ -41,6 +41,9 @@ message HealthCheck {
// mog: func-to=EnterpriseMetaToStructs func-from=NewEnterpriseMetaFromStructs // mog: func-to=EnterpriseMetaToStructs func-from=NewEnterpriseMetaFromStructs
common.EnterpriseMeta EnterpriseMeta = 13 [(gogoproto.nullable) = false]; common.EnterpriseMeta EnterpriseMeta = 13 [(gogoproto.nullable) = false];
// mog: func-to=int func-from=int32
int32 ExposedPort = 14;
} }
message HeaderValue { message HeaderValue {