2020-03-31 16:59:10 +00:00
|
|
|
|
package api
|
|
|
|
|
|
|
|
|
|
// IngressGatewayConfigEntry manages the configuration for an ingress service
|
|
|
|
|
// with the given name.
|
|
|
|
|
type IngressGatewayConfigEntry struct {
|
|
|
|
|
// Kind of the config entry. This should be set to api.IngressGateway.
|
|
|
|
|
Kind string
|
|
|
|
|
|
|
|
|
|
// Name is used to match the config entry with its associated ingress gateway
|
|
|
|
|
// service. This should match the name provided in the service definition.
|
|
|
|
|
Name string
|
|
|
|
|
|
2021-09-13 21:53:52 +00:00
|
|
|
|
// Partition is the partition the IngressGateway is associated with.
|
|
|
|
|
// Partitioning is a Consul Enterprise feature.
|
|
|
|
|
Partition string `json:",omitempty"`
|
|
|
|
|
|
|
|
|
|
// Namespace is the namespace the IngressGateway is associated with.
|
2020-03-31 16:59:10 +00:00
|
|
|
|
// Namespacing is a Consul Enterprise feature.
|
|
|
|
|
Namespace string `json:",omitempty"`
|
|
|
|
|
|
2020-04-30 20:50:25 +00:00
|
|
|
|
// TLS holds the TLS configuration for this gateway.
|
|
|
|
|
TLS GatewayTLSConfig
|
|
|
|
|
|
2020-03-31 16:59:10 +00:00
|
|
|
|
// Listeners declares what ports the ingress gateway should listen on, and
|
|
|
|
|
// what services to associated to those ports.
|
|
|
|
|
Listeners []IngressListener
|
|
|
|
|
|
2020-09-02 19:10:25 +00:00
|
|
|
|
Meta map[string]string `json:",omitempty"`
|
|
|
|
|
|
2022-09-28 18:56:46 +00:00
|
|
|
|
// Defaults is default configuration for all upstream services
|
|
|
|
|
Defaults *IngressServiceConfig `json:",omitempty"`
|
|
|
|
|
|
2020-03-31 16:59:10 +00:00
|
|
|
|
// CreateIndex is the Raft index this entry was created at. This is a
|
|
|
|
|
// read-only field.
|
|
|
|
|
CreateIndex uint64
|
|
|
|
|
|
|
|
|
|
// ModifyIndex is used for the Check-And-Set operations and can also be fed
|
|
|
|
|
// back into the WaitIndex of the QueryOptions in order to perform blocking
|
|
|
|
|
// queries.
|
|
|
|
|
ModifyIndex uint64
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-28 18:56:46 +00:00
|
|
|
|
type IngressServiceConfig struct {
|
|
|
|
|
MaxConnections *uint32
|
|
|
|
|
MaxPendingRequests *uint32
|
|
|
|
|
MaxConcurrentRequests *uint32
|
2022-12-13 16:51:37 +00:00
|
|
|
|
|
|
|
|
|
// PassiveHealthCheck configuration determines how upstream proxy instances will
|
|
|
|
|
// be monitored for removal from the load balancing pool.
|
|
|
|
|
PassiveHealthCheck *PassiveHealthCheck `json:",omitempty" alias:"passive_health_check"`
|
2022-09-28 18:56:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-04-30 20:50:25 +00:00
|
|
|
|
type GatewayTLSConfig struct {
|
2021-09-13 21:53:52 +00:00
|
|
|
|
// Indicates that TLS should be enabled for this gateway service.
|
2020-04-30 20:50:25 +00:00
|
|
|
|
Enabled bool
|
2021-08-25 16:29:06 +00:00
|
|
|
|
|
|
|
|
|
// SDS allows configuring TLS certificate from an SDS service.
|
|
|
|
|
SDS *GatewayTLSSDSConfig `json:",omitempty"`
|
2022-01-11 16:46:42 +00:00
|
|
|
|
|
|
|
|
|
TLSMinVersion string `json:",omitempty" alias:"tls_min_version"`
|
|
|
|
|
TLSMaxVersion string `json:",omitempty" alias:"tls_max_version"`
|
|
|
|
|
|
|
|
|
|
// Define a subset of cipher suites to restrict
|
|
|
|
|
// Only applicable to connections negotiated via TLS 1.2 or earlier
|
|
|
|
|
CipherSuites []string `json:",omitempty" alias:"cipher_suites"`
|
2021-08-25 16:29:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type GatewayServiceTLSConfig struct {
|
|
|
|
|
// SDS allows configuring TLS certificate from an SDS service.
|
|
|
|
|
SDS *GatewayTLSSDSConfig `json:",omitempty"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type GatewayTLSSDSConfig struct {
|
|
|
|
|
ClusterName string `json:",omitempty" alias:"cluster_name"`
|
|
|
|
|
CertResource string `json:",omitempty" alias:"cert_resource"`
|
2020-04-30 20:50:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-31 16:59:10 +00:00
|
|
|
|
// IngressListener manages the configuration for a listener on a specific port.
|
|
|
|
|
type IngressListener struct {
|
|
|
|
|
// Port declares the port on which the ingress gateway should listen for traffic.
|
|
|
|
|
Port int
|
|
|
|
|
|
|
|
|
|
// Protocol declares what type of traffic this listener is expected to
|
|
|
|
|
// receive. Depending on the protocol, a listener might support multiplexing
|
|
|
|
|
// services over a single port, or additional discovery chain features. The
|
2020-08-27 21:34:08 +00:00
|
|
|
|
// current supported values are: (tcp | http | http2 | grpc).
|
2020-03-31 16:59:10 +00:00
|
|
|
|
Protocol string
|
|
|
|
|
|
|
|
|
|
// Services declares the set of services to which the listener forwards
|
|
|
|
|
// traffic.
|
|
|
|
|
//
|
|
|
|
|
// For "tcp" protocol listeners, only a single service is allowed.
|
|
|
|
|
// For "http" listeners, multiple services can be declared.
|
|
|
|
|
Services []IngressService
|
2021-08-25 16:29:06 +00:00
|
|
|
|
|
|
|
|
|
// TLS allows specifying some TLS configuration per listener.
|
2021-09-23 09:05:42 +00:00
|
|
|
|
TLS *GatewayTLSConfig `json:",omitempty"`
|
2020-03-31 16:59:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// IngressService manages configuration for services that are exposed to
|
|
|
|
|
// ingress traffic.
|
|
|
|
|
type IngressService struct {
|
|
|
|
|
// Name declares the service to which traffic should be forwarded.
|
|
|
|
|
//
|
2020-05-04 16:47:46 +00:00
|
|
|
|
// This can either be a specific service, or the wildcard specifier,
|
2020-03-31 16:59:10 +00:00
|
|
|
|
// "*". If the wildcard specifier is provided, the listener must be of "http"
|
|
|
|
|
// protocol and means that the listener will forward traffic to all services.
|
2020-05-04 16:47:46 +00:00
|
|
|
|
//
|
|
|
|
|
// A name can be specified on multiple listeners, and will be exposed on both
|
2021-09-13 21:53:52 +00:00
|
|
|
|
// of the listeners.
|
2020-03-31 16:59:10 +00:00
|
|
|
|
Name string
|
|
|
|
|
|
2020-04-23 15:06:19 +00:00
|
|
|
|
// Hosts is a list of hostnames which should be associated to this service on
|
|
|
|
|
// the defined listener. Only allowed on layer 7 protocols, this will be used
|
|
|
|
|
// to route traffic to the service by matching the Host header of the HTTP
|
|
|
|
|
// request.
|
|
|
|
|
//
|
2020-05-04 16:47:46 +00:00
|
|
|
|
// If a host is provided for a service that also has a wildcard specifier
|
|
|
|
|
// defined, the host will override the wildcard-specifier-provided
|
|
|
|
|
// "<service-name>.*" domain for that listener.
|
|
|
|
|
//
|
2020-04-23 15:06:19 +00:00
|
|
|
|
// This cannot be specified when using the wildcard specifier, "*", or when
|
|
|
|
|
// using a "tcp" listener.
|
|
|
|
|
Hosts []string
|
|
|
|
|
|
2020-03-31 16:59:10 +00:00
|
|
|
|
// Namespace is the namespace where the service is located.
|
|
|
|
|
// Namespacing is a Consul Enterprise feature.
|
|
|
|
|
Namespace string `json:",omitempty"`
|
|
|
|
|
|
2021-11-08 17:40:09 +00:00
|
|
|
|
// Partition is the partition where the service is located.
|
|
|
|
|
// Partitioning is a Consul Enterprise feature.
|
|
|
|
|
Partition string `json:",omitempty"`
|
|
|
|
|
|
2021-08-25 16:29:06 +00:00
|
|
|
|
// TLS allows specifying some TLS configuration per listener.
|
2021-09-23 09:05:42 +00:00
|
|
|
|
TLS *GatewayServiceTLSConfig `json:",omitempty"`
|
2021-08-25 16:29:06 +00:00
|
|
|
|
|
2021-09-13 21:53:52 +00:00
|
|
|
|
// Allow HTTP header manipulation to be configured.
|
|
|
|
|
RequestHeaders *HTTPHeaderModifiers `json:",omitempty" alias:"request_headers"`
|
|
|
|
|
ResponseHeaders *HTTPHeaderModifiers `json:",omitempty" alias:"response_headers"`
|
2022-09-28 18:56:46 +00:00
|
|
|
|
|
|
|
|
|
MaxConnections *uint32 `json:",omitempty" alias:"max_connections"`
|
|
|
|
|
MaxPendingRequests *uint32 `json:",omitempty" alias:"max_pending_requests"`
|
|
|
|
|
MaxConcurrentRequests *uint32 `json:",omitempty" alias:"max_concurrent_requests"`
|
2022-12-13 16:51:37 +00:00
|
|
|
|
|
|
|
|
|
// PassiveHealthCheck configuration determines how upstream proxy instances will
|
|
|
|
|
// be monitored for removal from the load balancing pool.
|
|
|
|
|
PassiveHealthCheck *PassiveHealthCheck `json:",omitempty" alias:"passive_health_check"`
|
2020-03-31 16:59:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-09-13 21:53:52 +00:00
|
|
|
|
func (i *IngressGatewayConfigEntry) GetKind() string { return i.Kind }
|
|
|
|
|
func (i *IngressGatewayConfigEntry) GetName() string { return i.Name }
|
|
|
|
|
func (i *IngressGatewayConfigEntry) GetPartition() string { return i.Partition }
|
|
|
|
|
func (i *IngressGatewayConfigEntry) GetNamespace() string { return i.Namespace }
|
|
|
|
|
func (i *IngressGatewayConfigEntry) GetMeta() map[string]string { return i.Meta }
|
|
|
|
|
func (i *IngressGatewayConfigEntry) GetCreateIndex() uint64 { return i.CreateIndex }
|
|
|
|
|
func (i *IngressGatewayConfigEntry) GetModifyIndex() uint64 { return i.ModifyIndex }
|
2020-03-31 19:27:32 +00:00
|
|
|
|
|
|
|
|
|
// TerminatingGatewayConfigEntry manages the configuration for a terminating gateway
|
|
|
|
|
// with the given name.
|
|
|
|
|
type TerminatingGatewayConfigEntry struct {
|
|
|
|
|
// Kind of the config entry. This should be set to api.TerminatingGateway.
|
|
|
|
|
Kind string
|
|
|
|
|
|
|
|
|
|
// Name is used to match the config entry with its associated terminating gateway
|
|
|
|
|
// service. This should match the name provided in the service definition.
|
|
|
|
|
Name string
|
|
|
|
|
|
|
|
|
|
// Services is a list of service names represented by the terminating gateway.
|
|
|
|
|
Services []LinkedService `json:",omitempty"`
|
|
|
|
|
|
2020-09-02 19:10:25 +00:00
|
|
|
|
Meta map[string]string `json:",omitempty"`
|
|
|
|
|
|
2020-03-31 19:27:32 +00:00
|
|
|
|
// CreateIndex is the Raft index this entry was created at. This is a
|
|
|
|
|
// read-only field.
|
|
|
|
|
CreateIndex uint64
|
|
|
|
|
|
|
|
|
|
// ModifyIndex is used for the Check-And-Set operations and can also be fed
|
|
|
|
|
// back into the WaitIndex of the QueryOptions in order to perform blocking
|
|
|
|
|
// queries.
|
|
|
|
|
ModifyIndex uint64
|
|
|
|
|
|
2021-09-13 21:53:52 +00:00
|
|
|
|
// Partition is the partition the config entry is associated with.
|
|
|
|
|
// Partitioning is a Consul Enterprise feature.
|
|
|
|
|
Partition string `json:",omitempty"`
|
|
|
|
|
|
|
|
|
|
// Namespace is the namespace the config entry is associated with.
|
2020-03-31 19:27:32 +00:00
|
|
|
|
// Namespacing is a Consul Enterprise feature.
|
|
|
|
|
Namespace string `json:",omitempty"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// A LinkedService is a service represented by a terminating gateway
|
|
|
|
|
type LinkedService struct {
|
2021-09-13 21:53:52 +00:00
|
|
|
|
// Referencing other partitions is not supported.
|
|
|
|
|
|
|
|
|
|
// Namespace is where the service is registered.
|
2020-03-31 19:27:32 +00:00
|
|
|
|
Namespace string `json:",omitempty"`
|
|
|
|
|
|
2021-09-13 21:53:52 +00:00
|
|
|
|
// Name is the name of the service, as defined in Consul's catalog.
|
2020-03-31 19:27:32 +00:00
|
|
|
|
Name string `json:",omitempty"`
|
|
|
|
|
|
|
|
|
|
// CAFile is the optional path to a CA certificate to use for TLS connections
|
2021-09-13 21:53:52 +00:00
|
|
|
|
// from the gateway to the linked service.
|
2020-05-27 18:28:28 +00:00
|
|
|
|
CAFile string `json:",omitempty" alias:"ca_file"`
|
2020-03-31 19:27:32 +00:00
|
|
|
|
|
|
|
|
|
// CertFile is the optional path to a client certificate to use for TLS connections
|
2021-09-13 21:53:52 +00:00
|
|
|
|
// from the gateway to the linked service.
|
2020-05-27 18:28:28 +00:00
|
|
|
|
CertFile string `json:",omitempty" alias:"cert_file"`
|
2020-03-31 19:27:32 +00:00
|
|
|
|
|
|
|
|
|
// KeyFile is the optional path to a private key to use for TLS connections
|
2021-09-13 21:53:52 +00:00
|
|
|
|
// from the gateway to the linked service.
|
2020-05-27 18:28:28 +00:00
|
|
|
|
KeyFile string `json:",omitempty" alias:"key_file"`
|
2020-04-27 22:25:37 +00:00
|
|
|
|
|
2021-09-13 21:53:52 +00:00
|
|
|
|
// SNI is the optional name to specify during the TLS handshake with a linked service.
|
2020-04-27 22:25:37 +00:00
|
|
|
|
SNI string `json:",omitempty"`
|
2020-03-31 19:27:32 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-09-13 21:53:52 +00:00
|
|
|
|
func (g *TerminatingGatewayConfigEntry) GetKind() string { return g.Kind }
|
|
|
|
|
func (g *TerminatingGatewayConfigEntry) GetName() string { return g.Name }
|
|
|
|
|
func (g *TerminatingGatewayConfigEntry) GetPartition() string { return g.Partition }
|
|
|
|
|
func (g *TerminatingGatewayConfigEntry) GetNamespace() string { return g.Namespace }
|
|
|
|
|
func (g *TerminatingGatewayConfigEntry) GetMeta() map[string]string { return g.Meta }
|
|
|
|
|
func (g *TerminatingGatewayConfigEntry) GetCreateIndex() uint64 { return g.CreateIndex }
|
|
|
|
|
func (g *TerminatingGatewayConfigEntry) GetModifyIndex() uint64 { return g.ModifyIndex }
|
2023-01-18 22:14:34 +00:00
|
|
|
|
|
|
|
|
|
// APIGatewayConfigEntry manages the configuration for an API gateway
|
|
|
|
|
// with the given name.
|
|
|
|
|
type APIGatewayConfigEntry struct {
|
|
|
|
|
// Kind of the config entry. This should be set to api.APIGateway.
|
|
|
|
|
Kind string
|
|
|
|
|
|
|
|
|
|
// Name is used to match the config entry with its associated api gateway
|
|
|
|
|
// service. This should match the name provided in the service definition.
|
|
|
|
|
Name string
|
|
|
|
|
|
|
|
|
|
Meta map[string]string `json:",omitempty"`
|
|
|
|
|
|
|
|
|
|
// Listeners is the set of listener configuration to which an API Gateway
|
|
|
|
|
// might bind.
|
|
|
|
|
Listeners []APIGatewayListener
|
|
|
|
|
// Status is the asynchronous status which an APIGateway propagates to the user.
|
|
|
|
|
Status ConfigEntryStatus
|
|
|
|
|
|
|
|
|
|
// CreateIndex is the Raft index this entry was created at. This is a
|
|
|
|
|
// read-only field.
|
|
|
|
|
CreateIndex uint64
|
|
|
|
|
|
|
|
|
|
// ModifyIndex is used for the Check-And-Set operations and can also be fed
|
|
|
|
|
// back into the WaitIndex of the QueryOptions in order to perform blocking
|
|
|
|
|
// queries.
|
|
|
|
|
ModifyIndex uint64
|
|
|
|
|
|
|
|
|
|
// Partition is the partition the config entry is associated with.
|
|
|
|
|
// Partitioning is a Consul Enterprise feature.
|
|
|
|
|
Partition string `json:",omitempty"`
|
|
|
|
|
|
|
|
|
|
// Namespace is the namespace the config entry is associated with.
|
|
|
|
|
// Namespacing is a Consul Enterprise feature.
|
|
|
|
|
Namespace string `json:",omitempty"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (g *APIGatewayConfigEntry) GetKind() string { return g.Kind }
|
|
|
|
|
func (g *APIGatewayConfigEntry) GetName() string { return g.Name }
|
|
|
|
|
func (g *APIGatewayConfigEntry) GetPartition() string { return g.Partition }
|
|
|
|
|
func (g *APIGatewayConfigEntry) GetNamespace() string { return g.Namespace }
|
|
|
|
|
func (g *APIGatewayConfigEntry) GetMeta() map[string]string { return g.Meta }
|
|
|
|
|
func (g *APIGatewayConfigEntry) GetCreateIndex() uint64 { return g.CreateIndex }
|
|
|
|
|
func (g *APIGatewayConfigEntry) GetModifyIndex() uint64 { return g.ModifyIndex }
|
|
|
|
|
|
|
|
|
|
// APIGatewayListener represents an individual listener for an APIGateway
|
|
|
|
|
type APIGatewayListener struct {
|
2023-02-21 19:12:19 +00:00
|
|
|
|
// Name is the name of the listener in a given gateway. This must be
|
|
|
|
|
// unique within a gateway.
|
2023-01-18 22:14:34 +00:00
|
|
|
|
Name string
|
|
|
|
|
// Hostname is the host name that a listener should be bound to, if
|
|
|
|
|
// unspecified, the listener accepts requests for all hostnames.
|
|
|
|
|
Hostname string
|
|
|
|
|
// Port is the port at which this listener should bind.
|
|
|
|
|
Port int
|
|
|
|
|
// Protocol is the protocol that a listener should use, it must
|
|
|
|
|
// either be "http" or "tcp"
|
|
|
|
|
Protocol string
|
|
|
|
|
// TLS is the TLS settings for the listener.
|
|
|
|
|
TLS APIGatewayTLSConfiguration
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// APIGatewayTLSConfiguration specifies the configuration of a listener’s
|
|
|
|
|
// TLS settings.
|
|
|
|
|
type APIGatewayTLSConfiguration struct {
|
|
|
|
|
// Certificates is a set of references to certificates
|
|
|
|
|
// that a gateway listener uses for TLS termination.
|
|
|
|
|
Certificates []ResourceReference
|
|
|
|
|
// MaxVersion is the maximum TLS version that the listener
|
|
|
|
|
// should support.
|
|
|
|
|
MaxVersion string `json:",omitempty" alias:"tls_max_version"`
|
|
|
|
|
// MinVersion is the minimum TLS version that the listener
|
|
|
|
|
// should support.
|
|
|
|
|
MinVersion string `json:",omitempty" alias:"tls_min_version"`
|
|
|
|
|
// Define a subset of cipher suites to restrict
|
|
|
|
|
// Only applicable to connections negotiated via TLS 1.2 or earlier
|
|
|
|
|
CipherSuites []string `json:",omitempty" alias:"cipher_suites"`
|
|
|
|
|
}
|