Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[OSS] feat: add PeerThroughMeshGateways to mesh config #14475

Merged
merged 1 commit into from
Sep 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions agent/structs/config_entry_mesh.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ type MeshConfigEntry struct {

HTTP *MeshHTTPConfig `json:",omitempty"`

Peering *PeeringMeshConfig `json:",omitempty"`

Meta map[string]string `json:",omitempty"`
acl.EnterpriseMeta `hcl:",squash" mapstructure:",squash"`
RaftIndex
Expand Down Expand Up @@ -48,6 +50,16 @@ type MeshHTTPConfig struct {
SanitizeXForwardedClientCert bool `alias:"sanitize_x_forwarded_client_cert"`
}

// PeeringMeshConfig contains cluster-wide options pertaining to peering.
type PeeringMeshConfig struct {
// PeerThroughMeshGateways determines whether peering traffic between
// control planes should flow through mesh gateways. If enabled,
// Consul servers will advertise mesh gateway addresses as their own.
// Additionally, mesh gateways will configure themselves to expose
// the local servers using a peering-specific SNI.
PeerThroughMeshGateways bool `alias:"peer_through_mesh_gateways"`
}

func (e *MeshConfigEntry) GetKind() string {
return MeshConfig
}
Expand Down
11 changes: 10 additions & 1 deletion agent/structs/config_entry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1815,6 +1815,9 @@ func TestDecodeConfigEntry(t *testing.T) {
http {
sanitize_x_forwarded_client_cert = true
}
peering {
peer_through_mesh_gateways = true
}
`,
camel: `
Kind = "mesh"
Expand Down Expand Up @@ -1845,7 +1848,10 @@ func TestDecodeConfigEntry(t *testing.T) {
}
HTTP {
SanitizeXForwardedClientCert = true
}
}
Peering {
PeerThroughMeshGateways = true
}
`,
expect: &MeshConfigEntry{
Meta: map[string]string{
Expand Down Expand Up @@ -1876,6 +1882,9 @@ func TestDecodeConfigEntry(t *testing.T) {
HTTP: &MeshHTTPConfig{
SanitizeXForwardedClientCert: true,
},
Peering: &PeeringMeshConfig{
PeerThroughMeshGateways: true,
},
},
},
{
Expand Down
6 changes: 6 additions & 0 deletions api/config_entry_mesh.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ type MeshConfigEntry struct {

HTTP *MeshHTTPConfig `json:",omitempty"`

Peering *PeeringMeshConfig `json:",omitempty"`

Meta map[string]string `json:",omitempty"`

// CreateIndex is the Raft index this entry was created at. This is a
Expand Down Expand Up @@ -54,6 +56,10 @@ type MeshHTTPConfig struct {
SanitizeXForwardedClientCert bool `alias:"sanitize_x_forwarded_client_cert"`
}

type PeeringMeshConfig struct {
PeerThroughMeshGateways bool `json:",omitempty" alias:"peer_through_mesh_gateways"`
}

func (e *MeshConfigEntry) GetKind() string { return MeshConfig }
func (e *MeshConfigEntry) GetName() string { return MeshConfigMesh }
func (e *MeshConfigEntry) GetPartition() string { return e.Partition }
Expand Down
6 changes: 6 additions & 0 deletions api/config_entry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1314,6 +1314,9 @@ func TestDecodeConfigEntry(t *testing.T) {
},
"HTTP": {
"SanitizeXForwardedClientCert": true
},
"Peering": {
"PeerThroughMeshGateways": true
}
}
`,
Expand Down Expand Up @@ -1346,6 +1349,9 @@ func TestDecodeConfigEntry(t *testing.T) {
HTTP: &MeshHTTPConfig{
SanitizeXForwardedClientCert: true,
},
Peering: &PeeringMeshConfig{
PeerThroughMeshGateways: true,
},
},
},
} {
Expand Down
22 changes: 22 additions & 0 deletions proto/pbconfigentry/config_entry.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions proto/pbconfigentry/config_entry.pb.binary.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading