Skip to content

Commit

Permalink
Backport of docs: Remove YAML service registration examples into rele…
Browse files Browse the repository at this point in the history
…ase/1.16.x (#18906)

backport of commit 06c2aaa

Co-authored-by: Blake Covarrubias <[email protected]>
  • Loading branch information
hc-github-team-consul-core and blake authored Sep 20, 2023
1 parent 8b43309 commit 750317c
Show file tree
Hide file tree
Showing 4 changed files with 246 additions and 137 deletions.
113 changes: 78 additions & 35 deletions website/content/docs/connect/gateways/mesh-gateway/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,17 @@ MeshGateway:
- Mode: local
Name: global
```
```json
{
"Kind": "proxy-defaults",
"Name": "global",
"MeshGateway": {
"Mode": "local"
}
}
```

</CodeTabs>

### Enabling Gateways Per Service
Expand All @@ -123,6 +134,16 @@ MeshGateway:
Name: web
```
```json
{
"Kind": "service-defaults",
"Name": "web",
"MeshGateway": {
"Mode": "local"
}
}
```

</CodeTabs>

### Enabling Gateways for a Service Instance
Expand Down Expand Up @@ -161,7 +182,7 @@ service {
sidecar_service {
proxy {
mesh_gateway {
mode = "remote"
mode = "remote"
}
upstreams = [
{
Expand All @@ -176,19 +197,27 @@ service {
}
```

```yaml
service:
- kind: connect-proxy
name: web-sidecar-proxy
port: 8181
proxy:
- destination_service_name: web
mesh_gateway:
- mode: remote
upstreams:
- datacenter: secondary
destination_name: api
local_bind_port: 100
```json
{
"service": {
"kind": "connect-proxy",
"name": "web-sidecar-proxy",
"port": 8181,
"proxy": {
"destination_service_name": "web",
"mesh_gateway": {
"mode": "remote"
},
"upstreams": [
{
"destination_name": "api",
"datacenter": "secondary",
"local_bind_port": 10000
}
]
}
}
}
```

</CodeTabs>
Expand Down Expand Up @@ -235,25 +264,39 @@ service {
}
}
```
```yaml
service:
- kind: connect-proxy
name: web-sidecar-proxy
port: 8181
proxy:
- destination_service_name: web
upstreams:
- destination_name: api
local_bind_port: 10000
mesh_gateway:
- mode: remote
- destination_name: db
local_bind_port: 10001
mesh_gateway:
- mode: local
- destination_name: logging
local_bind_port: 10002
mesh_gateway:
- mode: none
```
```json
{
"service": {
"kind": "connect-proxy",
"name": "web-sidecar-proxy",
"port": 8181,
"proxy": {
"destination_service_name": "web",
"upstreams": [
{
"destination_name": "api",
"local_bind_port": 10000,
"mesh_gateway": {
"mode": "remote"
}
},
{
"destination_name": "db",
"local_bind_port": 10001,
"mesh_gateway": {
"mode": "local"
}
},
{
"destination_name": "logging",
"local_bind_port": 10002,
"mesh_gateway": {
"mode": "none"
}
}
]
}
}
}
```
</CodeTabs>
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,16 @@ MeshGateway:
Name: global
```
```json
{
"Kind": "proxy-defaults",
"Name": "global",
"MeshGateway": {
"Mode": "local"
}
}
```

</CodeTabs>

### Enabling Gateways Per Service
Expand All @@ -117,14 +127,25 @@ MeshGateway:
- Mode: local
Name: web
```
```json
{
"Kind": "service-defaults",
"Name": "web",
"MeshGateway": {
"Mode": "local"
}
}
```

</CodeTabs>

### Enabling Gateways for a Service Instance

The following [proxy service configuration](/consul/docs/connect/proxies/deploy-service-mesh-proxies)
enables gateways for `web` service instances in the `finance` partition.

<CodeTabs heading="Example: Enabling gateways for a service instance.">
<CodeTabs heading="Example: Enabling gateways for a service instance">

```hcl
service {
Expand All @@ -149,29 +170,37 @@ service {
}
```

```yaml
service:
- kind: connect-proxy
name: web-sidecar-proxy
port: 8181
proxy:
- destination_service_name: web
mesh_gateway:
- mode: local
upstreams:
- destination_name: billing
destination_namespace: default
destination_partition: finance
destination_type: service
local_bind_port: 9090
```json
{
"service": {
"kind": "connect-proxy",
"name": "web-sidecar-proxy",
"port": 8181,
"proxy": {
"destination_service_name": "web",
"mesh_gateway": {
"mode": "local"
},
"upstreams": [
{
"destination_name": "billing",
"destination_namespace": "default",
"destination_partition": "finance",
"destination_type": "service",
"local_bind_port": 9090
}
]
}
}
}
```
</CodeTabs>

### Enabling Gateways for a Proxy Upstream

The following service definition will enable gateways in `local` mode for three different partitions. Note that each service exists in the same namespace, but are separated by admin partition.

<CodeTabs heading="Example: Enabling gateways for a proxy upstream.">
<CodeTabs heading="Example: Enabling gateways for a proxy upstream">

```hcl
service {
Expand Down Expand Up @@ -213,31 +242,45 @@ service {
}
```

```yaml
service:
- kind: connect-proxy
name: web-sidecar-proxy
port: 8181
proxy:
- destination_service_name: web
upstreams:
- destination_name: api
destination_namespace: dev
destination_partition: api
local_bind_port: 10000
mesh_gateway:
- mode: local
- destination_name: db
destination_namespace: dev
destination_partition: db
local_bind_port: 10001
mesh_gateway:
- mode: local
- destination_name: logging
destination_namespace: dev
destination_partition: logging
local_bind_port: 10002
mesh_gateway:
- mode: local
```json
{
"service": {
"kind": "connect-proxy",
"name": "web-sidecar-proxy",
"port": 8181,
"proxy": {
"destination_service_name": "web",
"upstreams": [
{
"destination_name": "api",
"destination_namespace": "dev",
"destination_partition": "api",
"local_bind_port": 10000,
"mesh_gateway": {
"mode": "local"
}
},
{
"destination_name": "db",
"destination_namespace": "dev",
"destination_partition": "db",
"local_bind_port": 10001,
"mesh_gateway": {
"mode": "local"
}
},
{
"destination_name": "logging",
"destination_namespace": "dev",
"destination_partition": "logging",
"local_bind_port": 10002,
"mesh_gateway": {
"mode": "local"
}
}
]
}
}
}
```
</CodeTabs>
Loading

0 comments on commit 750317c

Please sign in to comment.