Backport of docs: Remove YAML service registration examples into release/1.16.x (#18906)

backport of commit 06c2aaaf74115cdaf21af058aebe5b4c5776e037

Co-authored-by: Blake Covarrubias <blake@covarrubi.as>
This commit is contained in:
hc-github-team-consul-core 2023-09-20 19:17:55 -04:00 committed by GitHub
parent 6a7f0b774c
commit 5b8aaffd50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 246 additions and 137 deletions

View File

@ -100,6 +100,17 @@ MeshGateway:
- Mode: local - Mode: local
Name: global Name: global
``` ```
```json
{
"Kind": "proxy-defaults",
"Name": "global",
"MeshGateway": {
"Mode": "local"
}
}
```
</CodeTabs> </CodeTabs>
### Enabling Gateways Per Service ### Enabling Gateways Per Service
@ -123,6 +134,16 @@ MeshGateway:
Name: web Name: web
``` ```
```json
{
"Kind": "service-defaults",
"Name": "web",
"MeshGateway": {
"Mode": "local"
}
}
```
</CodeTabs> </CodeTabs>
### Enabling Gateways for a Service Instance ### Enabling Gateways for a Service Instance
@ -161,7 +182,7 @@ service {
sidecar_service { sidecar_service {
proxy { proxy {
mesh_gateway { mesh_gateway {
mode = "remote" mode = "remote"
} }
upstreams = [ upstreams = [
{ {
@ -176,19 +197,27 @@ service {
} }
``` ```
```yaml ```json
service: {
- kind: connect-proxy "service": {
name: web-sidecar-proxy "kind": "connect-proxy",
port: 8181 "name": "web-sidecar-proxy",
proxy: "port": 8181,
- destination_service_name: web "proxy": {
mesh_gateway: "destination_service_name": "web",
- mode: remote "mesh_gateway": {
upstreams: "mode": "remote"
- datacenter: secondary },
destination_name: api "upstreams": [
local_bind_port: 100 {
"destination_name": "api",
"datacenter": "secondary",
"local_bind_port": 10000
}
]
}
}
}
``` ```
</CodeTabs> </CodeTabs>
@ -235,25 +264,39 @@ service {
} }
} }
``` ```
```yaml ```json
service: {
- kind: connect-proxy "service": {
name: web-sidecar-proxy "kind": "connect-proxy",
port: 8181 "name": "web-sidecar-proxy",
proxy: "port": 8181,
- destination_service_name: web "proxy": {
upstreams: "destination_service_name": "web",
- destination_name: api "upstreams": [
local_bind_port: 10000 {
mesh_gateway: "destination_name": "api",
- mode: remote "local_bind_port": 10000,
- destination_name: db "mesh_gateway": {
local_bind_port: 10001 "mode": "remote"
mesh_gateway: }
- mode: local },
- destination_name: logging {
local_bind_port: 10002 "destination_name": "db",
mesh_gateway: "local_bind_port": 10001,
- mode: none "mesh_gateway": {
``` "mode": "local"
}
},
{
"destination_name": "logging",
"local_bind_port": 10002,
"mesh_gateway": {
"mode": "none"
}
}
]
}
}
}
```
</CodeTabs> </CodeTabs>

View File

@ -95,6 +95,16 @@ MeshGateway:
Name: global Name: global
``` ```
```json
{
"Kind": "proxy-defaults",
"Name": "global",
"MeshGateway": {
"Mode": "local"
}
}
```
</CodeTabs> </CodeTabs>
### Enabling Gateways Per Service ### Enabling Gateways Per Service
@ -117,6 +127,17 @@ MeshGateway:
- Mode: local - Mode: local
Name: web Name: web
``` ```
```json
{
"Kind": "service-defaults",
"Name": "web",
"MeshGateway": {
"Mode": "local"
}
}
```
</CodeTabs> </CodeTabs>
### Enabling Gateways for a Service Instance ### Enabling Gateways for a Service Instance
@ -124,7 +145,7 @@ Name: web
The following [proxy service configuration](/consul/docs/connect/proxies/deploy-service-mesh-proxies) The following [proxy service configuration](/consul/docs/connect/proxies/deploy-service-mesh-proxies)
enables gateways for `web` service instances in the `finance` partition. 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 ```hcl
service { service {
@ -149,21 +170,29 @@ service {
} }
``` ```
```yaml ```json
service: {
- kind: connect-proxy "service": {
name: web-sidecar-proxy "kind": "connect-proxy",
port: 8181 "name": "web-sidecar-proxy",
proxy: "port": 8181,
- destination_service_name: web "proxy": {
mesh_gateway: "destination_service_name": "web",
- mode: local "mesh_gateway": {
upstreams: "mode": "local"
- destination_name: billing },
destination_namespace: default "upstreams": [
destination_partition: finance {
destination_type: service "destination_name": "billing",
local_bind_port: 9090 "destination_namespace": "default",
"destination_partition": "finance",
"destination_type": "service",
"local_bind_port": 9090
}
]
}
}
}
``` ```
</CodeTabs> </CodeTabs>
@ -171,7 +200,7 @@ service:
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. 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 ```hcl
service { service {
@ -213,31 +242,45 @@ service {
} }
``` ```
```yaml ```json
service: {
- kind: connect-proxy "service": {
name: web-sidecar-proxy "kind": "connect-proxy",
port: 8181 "name": "web-sidecar-proxy",
proxy: "port": 8181,
- destination_service_name: web "proxy": {
upstreams: "destination_service_name": "web",
- destination_name: api "upstreams": [
destination_namespace: dev {
destination_partition: api "destination_name": "api",
local_bind_port: 10000 "destination_namespace": "dev",
mesh_gateway: "destination_partition": "api",
- mode: local "local_bind_port": 10000,
- destination_name: db "mesh_gateway": {
destination_namespace: dev "mode": "local"
destination_partition: db }
local_bind_port: 10001 },
mesh_gateway: {
- mode: local "destination_name": "db",
- destination_name: logging "destination_namespace": "dev",
destination_namespace: dev "destination_partition": "db",
destination_partition: logging "local_bind_port": 10001,
local_bind_port: 10002 "mesh_gateway": {
mesh_gateway: "mode": "local"
- mode: local }
},
{
"destination_name": "logging",
"destination_namespace": "dev",
"destination_partition": "logging",
"local_bind_port": 10002,
"mesh_gateway": {
"mode": "local"
}
}
]
}
}
}
``` ```
</CodeTabs> </CodeTabs>

View File

@ -110,6 +110,16 @@ MeshGateway:
- Mode: local - Mode: local
Name: global Name: global
``` ```
```json
{
"Kind": "proxy-defaults",
"Name": "global",
"MeshGateway": {
"Mode": "local"
}
}
```
</CodeTabs> </CodeTabs>
### Enabling Gateways Per Service ### Enabling Gateways Per Service
@ -133,6 +143,15 @@ MeshGateway:
Name: web Name: web
``` ```
```json
{
"Kind": "service-defaults",
"Name": "web",
"MeshGateway": {
"Mode": "local"
}
}
</CodeTabs> </CodeTabs>
### Enabling Gateways for a Service Instance ### Enabling Gateways for a Service Instance
@ -186,19 +205,27 @@ service {
} }
``` ```
```yaml ```json
service: {
- kind: connect-proxy "service": {
name: web-sidecar-proxy "kind": "connect-proxy",
port: 8181 "name": "web-sidecar-proxy",
proxy: "port": 8181,
- destination_service_name: web "proxy": {
mesh_gateway: "destination_service_name": "web",
- mode: remote "mesh_gateway": {
upstreams: "mode": "remote"
- datacenter: secondary },
destination_name: api "upstreams": [
local_bind_port: 100 {
"destination_name": "api",
"datacenter": "secondary",
"local_bind_port": 10000
}
]
}
}
}
``` ```
</CodeTabs> </CodeTabs>
@ -242,25 +269,39 @@ service {
} }
} }
``` ```
```yaml ```json
service: {
- kind: connect-proxy "service": {
name: web-sidecar-proxy "kind": "connect-proxy",
port: 8181 "name": "web-sidecar-proxy",
proxy: "port": 8181,
- destination_service_name: web "proxy": {
upstreams: "destination_service_name": "web",
- destination_name: api "upstreams": [
local_bind_port: 10000 {
mesh_gateway: "destination_name": "api",
- mode: remote "local_bind_port": 10000,
- destination_name: db "mesh_gateway": {
local_bind_port: 10001 "mode": "remote"
mesh_gateway: }
- mode: local },
- destination_name: logging {
local_bind_port: 10002 "destination_name": "db",
mesh_gateway: "local_bind_port": 10001,
- mode: none "mesh_gateway": {
``` "mode": "local"
</CodeTabs> }
},
{
"destination_name": "logging",
"local_bind_port": 10002,
"mesh_gateway": {
"mode": "none"
}
}
]
}
}
}
```
</CodeTabs>

View File

@ -110,26 +110,6 @@ service {
} }
``` ```
</CodeBlockConfig> </CodeBlockConfig>
<CodeBlockConfig heading="service.yaml">
```yaml
service:
- id: redis
meta:
- custom_meta_key: custom_meta_value
name: redis
port: 80
tagged_addresses:
- lan:
- address: 192.168.0.55
port: 8000
wan:
- address: 198.18.0.23
port: 80
tags:
- primary
```
</CodeBlockConfig>
</CodeTabs> </CodeTabs>
### Health checks ### Health checks
@ -427,10 +407,12 @@ service {
``` ```
```json ```json
"service": { {
## ... "service": {
"enable_tag_override": true, ## ...
## ... "enable_tag_override": true,
## ...
}
} }
``` ```