mirror of https://github.com/status-im/consul.git
Accept partition for ingress services
This commit is contained in:
parent
81759c7a41
commit
e5b7c4713f
|
@ -266,10 +266,7 @@ func (e *IngressGatewayConfigEntry) Validate() error {
|
||||||
|
|
||||||
declaredHosts := make(map[string]bool)
|
declaredHosts := make(map[string]bool)
|
||||||
serviceNames := make(map[ServiceID]struct{})
|
serviceNames := make(map[ServiceID]struct{})
|
||||||
for i, s := range listener.Services {
|
for _, s := range listener.Services {
|
||||||
if err := validateInnerEnterpriseMeta(&s.EnterpriseMeta, &e.EnterpriseMeta); err != nil {
|
|
||||||
return fmt.Errorf("services[%d]: %w", i, err)
|
|
||||||
}
|
|
||||||
sn := NewServiceName(s.Name, &s.EnterpriseMeta)
|
sn := NewServiceName(s.Name, &s.EnterpriseMeta)
|
||||||
if err := s.RequestHeaders.Validate(listener.Protocol); err != nil {
|
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)
|
return fmt.Errorf("request headers %s (service %q on listener on port %d)", err, sn.String(), listener.Port)
|
||||||
|
|
|
@ -103,12 +103,14 @@ type IngressService struct {
|
||||||
// using a "tcp" listener.
|
// using a "tcp" listener.
|
||||||
Hosts []string
|
Hosts []string
|
||||||
|
|
||||||
// Referencing other partitions is not supported.
|
|
||||||
|
|
||||||
// Namespace is the namespace where the service is located.
|
// Namespace is the namespace where the service is located.
|
||||||
// Namespacing is a Consul Enterprise feature.
|
// Namespacing is a Consul Enterprise feature.
|
||||||
Namespace string `json:",omitempty"`
|
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 allows specifying some TLS configuration per listener.
|
||||||
TLS *GatewayServiceTLSConfig `json:",omitempty"`
|
TLS *GatewayServiceTLSConfig `json:",omitempty"`
|
||||||
|
|
||||||
|
|
|
@ -964,7 +964,8 @@ func TestDecodeConfigEntry(t *testing.T) {
|
||||||
"Services": [
|
"Services": [
|
||||||
{
|
{
|
||||||
"Name": "web",
|
"Name": "web",
|
||||||
"Namespace": "foo"
|
"Namespace": "foo",
|
||||||
|
"Partition": "bar"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Name": "db"
|
"Name": "db"
|
||||||
|
@ -1001,6 +1002,7 @@ func TestDecodeConfigEntry(t *testing.T) {
|
||||||
{
|
{
|
||||||
Name: "web",
|
Name: "web",
|
||||||
Namespace: "foo",
|
Namespace: "foo",
|
||||||
|
Partition: "bar",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "db",
|
Name: "db",
|
||||||
|
|
Loading…
Reference in New Issue