mirror of https://github.com/hashicorp/consul
Add TLS field to ingress API structs
- Adds test in api and command/config/write packagespull/7759/head
parent
30792e933b
commit
0c22eacca8
|
@ -76,6 +76,7 @@ type IngressService struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type GatewayTLSConfig struct {
|
type GatewayTLSConfig struct {
|
||||||
|
// Indicates that TLS should be enabled for this gateway service
|
||||||
Enabled bool
|
Enabled bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,9 @@ type IngressGatewayConfigEntry struct {
|
||||||
// Namespacing is a Consul Enterprise feature.
|
// Namespacing is a Consul Enterprise feature.
|
||||||
Namespace string `json:",omitempty"`
|
Namespace string `json:",omitempty"`
|
||||||
|
|
||||||
|
// TLS holds the TLS configuration for this gateway.
|
||||||
|
TLS GatewayTLSConfig
|
||||||
|
|
||||||
// Listeners declares what ports the ingress gateway should listen on, and
|
// Listeners declares what ports the ingress gateway should listen on, and
|
||||||
// what services to associated to those ports.
|
// what services to associated to those ports.
|
||||||
Listeners []IngressListener
|
Listeners []IngressListener
|
||||||
|
@ -28,6 +31,11 @@ type IngressGatewayConfigEntry struct {
|
||||||
ModifyIndex uint64
|
ModifyIndex uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type GatewayTLSConfig struct {
|
||||||
|
// Indicates that TLS should be enabled for this gateway service
|
||||||
|
Enabled bool
|
||||||
|
}
|
||||||
|
|
||||||
// IngressListener manages the configuration for a listener on a specific port.
|
// IngressListener manages the configuration for a listener on a specific port.
|
||||||
type IngressListener struct {
|
type IngressListener struct {
|
||||||
// Port declares the port on which the ingress gateway should listen for traffic.
|
// Port declares the port on which the ingress gateway should listen for traffic.
|
||||||
|
|
|
@ -21,6 +21,9 @@ func TestAPI_ConfigEntries_IngressGateway(t *testing.T) {
|
||||||
ingress2 := &IngressGatewayConfigEntry{
|
ingress2 := &IngressGatewayConfigEntry{
|
||||||
Kind: IngressGateway,
|
Kind: IngressGateway,
|
||||||
Name: "bar",
|
Name: "bar",
|
||||||
|
TLS: GatewayTLSConfig{
|
||||||
|
Enabled: true,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// set it
|
// set it
|
||||||
|
|
|
@ -619,6 +619,9 @@ func TestDecodeConfigEntry(t *testing.T) {
|
||||||
{
|
{
|
||||||
"Kind": "ingress-gateway",
|
"Kind": "ingress-gateway",
|
||||||
"Name": "ingress-web",
|
"Name": "ingress-web",
|
||||||
|
"Tls": {
|
||||||
|
"Enabled": true
|
||||||
|
},
|
||||||
"Listeners": [
|
"Listeners": [
|
||||||
{
|
{
|
||||||
"Port": 8080,
|
"Port": 8080,
|
||||||
|
@ -648,6 +651,9 @@ func TestDecodeConfigEntry(t *testing.T) {
|
||||||
expect: &IngressGatewayConfigEntry{
|
expect: &IngressGatewayConfigEntry{
|
||||||
Kind: "ingress-gateway",
|
Kind: "ingress-gateway",
|
||||||
Name: "ingress-web",
|
Name: "ingress-web",
|
||||||
|
TLS: GatewayTLSConfig{
|
||||||
|
Enabled: true,
|
||||||
|
},
|
||||||
Listeners: []IngressListener{
|
Listeners: []IngressListener{
|
||||||
IngressListener{
|
IngressListener{
|
||||||
Port: 8080,
|
Port: 8080,
|
||||||
|
|
|
@ -1388,6 +1388,9 @@ func TestParseConfigEntry(t *testing.T) {
|
||||||
snake: `
|
snake: `
|
||||||
kind = "ingress-gateway"
|
kind = "ingress-gateway"
|
||||||
name = "ingress-web"
|
name = "ingress-web"
|
||||||
|
tls {
|
||||||
|
enabled = true
|
||||||
|
}
|
||||||
listeners = [
|
listeners = [
|
||||||
{
|
{
|
||||||
port = 8080
|
port = 8080
|
||||||
|
@ -1408,6 +1411,9 @@ func TestParseConfigEntry(t *testing.T) {
|
||||||
camel: `
|
camel: `
|
||||||
Kind = "ingress-gateway"
|
Kind = "ingress-gateway"
|
||||||
Name = "ingress-web"
|
Name = "ingress-web"
|
||||||
|
Tls {
|
||||||
|
Enabled = true
|
||||||
|
}
|
||||||
Listeners = [
|
Listeners = [
|
||||||
{
|
{
|
||||||
Port = 8080
|
Port = 8080
|
||||||
|
@ -1429,6 +1435,9 @@ func TestParseConfigEntry(t *testing.T) {
|
||||||
{
|
{
|
||||||
"kind": "ingress-gateway",
|
"kind": "ingress-gateway",
|
||||||
"name": "ingress-web",
|
"name": "ingress-web",
|
||||||
|
"tls": {
|
||||||
|
"enabled": true
|
||||||
|
},
|
||||||
"listeners": [
|
"listeners": [
|
||||||
{
|
{
|
||||||
"port": 8080,
|
"port": 8080,
|
||||||
|
@ -1451,6 +1460,9 @@ func TestParseConfigEntry(t *testing.T) {
|
||||||
{
|
{
|
||||||
"Kind": "ingress-gateway",
|
"Kind": "ingress-gateway",
|
||||||
"Name": "ingress-web",
|
"Name": "ingress-web",
|
||||||
|
"Tls": {
|
||||||
|
"Enabled": true
|
||||||
|
},
|
||||||
"Listeners": [
|
"Listeners": [
|
||||||
{
|
{
|
||||||
"Port": 8080,
|
"Port": 8080,
|
||||||
|
@ -1472,6 +1484,9 @@ func TestParseConfigEntry(t *testing.T) {
|
||||||
expect: &api.IngressGatewayConfigEntry{
|
expect: &api.IngressGatewayConfigEntry{
|
||||||
Kind: "ingress-gateway",
|
Kind: "ingress-gateway",
|
||||||
Name: "ingress-web",
|
Name: "ingress-web",
|
||||||
|
TLS: api.GatewayTLSConfig{
|
||||||
|
Enabled: true,
|
||||||
|
},
|
||||||
Listeners: []api.IngressListener{
|
Listeners: []api.IngressListener{
|
||||||
{
|
{
|
||||||
Port: 8080,
|
Port: 8080,
|
||||||
|
|
Loading…
Reference in New Issue