mirror of https://github.com/status-im/consul.git
Add TLS field to ingress API structs
- Adds test in api and command/config/write packages
This commit is contained in:
parent
30792e933b
commit
0c22eacca8
|
@ -76,6 +76,7 @@ type IngressService struct {
|
|||
}
|
||||
|
||||
type GatewayTLSConfig struct {
|
||||
// Indicates that TLS should be enabled for this gateway service
|
||||
Enabled bool
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,9 @@ type IngressGatewayConfigEntry struct {
|
|||
// Namespacing is a Consul Enterprise feature.
|
||||
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
|
||||
// what services to associated to those ports.
|
||||
Listeners []IngressListener
|
||||
|
@ -28,6 +31,11 @@ type IngressGatewayConfigEntry struct {
|
|||
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.
|
||||
type IngressListener struct {
|
||||
// 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{
|
||||
Kind: IngressGateway,
|
||||
Name: "bar",
|
||||
TLS: GatewayTLSConfig{
|
||||
Enabled: true,
|
||||
},
|
||||
}
|
||||
|
||||
// set it
|
||||
|
|
|
@ -619,6 +619,9 @@ func TestDecodeConfigEntry(t *testing.T) {
|
|||
{
|
||||
"Kind": "ingress-gateway",
|
||||
"Name": "ingress-web",
|
||||
"Tls": {
|
||||
"Enabled": true
|
||||
},
|
||||
"Listeners": [
|
||||
{
|
||||
"Port": 8080,
|
||||
|
@ -648,6 +651,9 @@ func TestDecodeConfigEntry(t *testing.T) {
|
|||
expect: &IngressGatewayConfigEntry{
|
||||
Kind: "ingress-gateway",
|
||||
Name: "ingress-web",
|
||||
TLS: GatewayTLSConfig{
|
||||
Enabled: true,
|
||||
},
|
||||
Listeners: []IngressListener{
|
||||
IngressListener{
|
||||
Port: 8080,
|
||||
|
|
|
@ -1388,6 +1388,9 @@ func TestParseConfigEntry(t *testing.T) {
|
|||
snake: `
|
||||
kind = "ingress-gateway"
|
||||
name = "ingress-web"
|
||||
tls {
|
||||
enabled = true
|
||||
}
|
||||
listeners = [
|
||||
{
|
||||
port = 8080
|
||||
|
@ -1408,6 +1411,9 @@ func TestParseConfigEntry(t *testing.T) {
|
|||
camel: `
|
||||
Kind = "ingress-gateway"
|
||||
Name = "ingress-web"
|
||||
Tls {
|
||||
Enabled = true
|
||||
}
|
||||
Listeners = [
|
||||
{
|
||||
Port = 8080
|
||||
|
@ -1429,6 +1435,9 @@ func TestParseConfigEntry(t *testing.T) {
|
|||
{
|
||||
"kind": "ingress-gateway",
|
||||
"name": "ingress-web",
|
||||
"tls": {
|
||||
"enabled": true
|
||||
},
|
||||
"listeners": [
|
||||
{
|
||||
"port": 8080,
|
||||
|
@ -1451,6 +1460,9 @@ func TestParseConfigEntry(t *testing.T) {
|
|||
{
|
||||
"Kind": "ingress-gateway",
|
||||
"Name": "ingress-web",
|
||||
"Tls": {
|
||||
"Enabled": true
|
||||
},
|
||||
"Listeners": [
|
||||
{
|
||||
"Port": 8080,
|
||||
|
@ -1472,6 +1484,9 @@ func TestParseConfigEntry(t *testing.T) {
|
|||
expect: &api.IngressGatewayConfigEntry{
|
||||
Kind: "ingress-gateway",
|
||||
Name: "ingress-web",
|
||||
TLS: api.GatewayTLSConfig{
|
||||
Enabled: true,
|
||||
},
|
||||
Listeners: []api.IngressListener{
|
||||
{
|
||||
Port: 8080,
|
||||
|
|
Loading…
Reference in New Issue