From e5b7c4713fd56360160193fb7d09f0ff185d697d Mon Sep 17 00:00:00 2001 From: freddygv Date: Mon, 8 Nov 2021 10:40:09 -0700 Subject: [PATCH] Accept partition for ingress services --- agent/structs/config_entry_gateways.go | 5 +---- api/config_entry_gateways.go | 6 ++++-- api/config_entry_test.go | 4 +++- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/agent/structs/config_entry_gateways.go b/agent/structs/config_entry_gateways.go index aebb0a0f3d..bad63294a7 100644 --- a/agent/structs/config_entry_gateways.go +++ b/agent/structs/config_entry_gateways.go @@ -266,10 +266,7 @@ func (e *IngressGatewayConfigEntry) Validate() error { declaredHosts := make(map[string]bool) serviceNames := make(map[ServiceID]struct{}) - for i, s := range listener.Services { - if err := validateInnerEnterpriseMeta(&s.EnterpriseMeta, &e.EnterpriseMeta); err != nil { - return fmt.Errorf("services[%d]: %w", i, err) - } + for _, s := range listener.Services { sn := NewServiceName(s.Name, &s.EnterpriseMeta) if err := s.RequestHeaders.Validate(listener.Protocol); err != nil { return fmt.Errorf("request headers %s (service %q on listener on port %d)", err, sn.String(), listener.Port) diff --git a/api/config_entry_gateways.go b/api/config_entry_gateways.go index c3eb07f12e..0792ad824e 100644 --- a/api/config_entry_gateways.go +++ b/api/config_entry_gateways.go @@ -103,12 +103,14 @@ type IngressService struct { // using a "tcp" listener. Hosts []string - // Referencing other partitions is not supported. - // Namespace is the namespace where the service is located. // Namespacing is a Consul Enterprise feature. Namespace string `json:",omitempty"` + // Partition is the partition where the service is located. + // Partitioning is a Consul Enterprise feature. + Partition string `json:",omitempty"` + // TLS allows specifying some TLS configuration per listener. TLS *GatewayServiceTLSConfig `json:",omitempty"` diff --git a/api/config_entry_test.go b/api/config_entry_test.go index 699d4ddc72..04419ea376 100644 --- a/api/config_entry_test.go +++ b/api/config_entry_test.go @@ -964,7 +964,8 @@ func TestDecodeConfigEntry(t *testing.T) { "Services": [ { "Name": "web", - "Namespace": "foo" + "Namespace": "foo", + "Partition": "bar" }, { "Name": "db" @@ -1001,6 +1002,7 @@ func TestDecodeConfigEntry(t *testing.T) { { Name: "web", Namespace: "foo", + Partition: "bar", }, { Name: "db",