mirror of https://github.com/status-im/consul.git
docs: Remove YAML service registration examples (#18877)
Remove YAML service registration examples and replace them with JSON. This is because YAML is not a supported configuration format for the Consul's agent configuration, nor is it supported by the HTTP API. This commit replaces the YAML examples with JSON and adds additional JSON examples where they were missing.
This commit is contained in:
parent
70e738ce20
commit
a62c75f43c
|
@ -103,6 +103,17 @@ spec:
|
|||
meshGateway:
|
||||
mode: local
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"Kind": "proxy-defaults",
|
||||
"Name": "global",
|
||||
"MeshGateway": {
|
||||
"Mode": "local"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
</CodeTabs>
|
||||
|
||||
### Enabling Gateways Per Service
|
||||
|
@ -129,6 +140,16 @@ spec:
|
|||
mode: local
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"Kind": "service-defaults",
|
||||
"Name": "web",
|
||||
"MeshGateway": {
|
||||
"Mode": "local"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
</CodeTabs>
|
||||
|
||||
### Enabling Gateways for a Service Instance
|
||||
|
@ -182,19 +203,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>
|
||||
|
@ -241,25 +270,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>
|
||||
|
|
|
@ -98,6 +98,16 @@ spec:
|
|||
mode: local
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"Kind": "proxy-defaults",
|
||||
"Name": "global",
|
||||
"MeshGateway": {
|
||||
"Mode": "local"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
</CodeTabs>
|
||||
|
||||
### Enabling Gateways Per Service
|
||||
|
@ -123,6 +133,17 @@ spec:
|
|||
meshGateway:
|
||||
mode: local
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"Kind": "service-defaults",
|
||||
"Name": "web",
|
||||
"MeshGateway": {
|
||||
"Mode": "local"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
</CodeTabs>
|
||||
|
||||
### Enabling Gateways for a Service Instance
|
||||
|
@ -130,7 +151,7 @@ spec:
|
|||
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 {
|
||||
|
@ -155,21 +176,29 @@ 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>
|
||||
|
||||
|
@ -177,7 +206,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.
|
||||
|
||||
<CodeTabs heading="Example: Enabling gateways for a proxy upstream.">
|
||||
<CodeTabs heading="Example: Enabling gateways for a proxy upstream">
|
||||
|
||||
```hcl
|
||||
service {
|
||||
|
@ -219,31 +248,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>
|
||||
|
|
|
@ -113,6 +113,16 @@ spec:
|
|||
meshGateway:
|
||||
mode: local
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"Kind": "proxy-defaults",
|
||||
"Name": "global",
|
||||
"MeshGateway": {
|
||||
"Mode": "local"
|
||||
}
|
||||
}
|
||||
```
|
||||
</CodeTabs>
|
||||
|
||||
### Enabling Gateways Per Service
|
||||
|
@ -139,6 +149,15 @@ spec:
|
|||
mode: local
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"Kind": "service-defaults",
|
||||
"Name": "web",
|
||||
"MeshGateway": {
|
||||
"Mode": "local"
|
||||
}
|
||||
}
|
||||
|
||||
</CodeTabs>
|
||||
|
||||
### Enabling Gateways for a Service Instance
|
||||
|
@ -192,19 +211,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>
|
||||
|
@ -248,25 +275,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
|
||||
```
|
||||
</CodeTabs>
|
||||
```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>
|
||||
|
|
|
@ -110,26 +110,6 @@ service {
|
|||
}
|
||||
```
|
||||
</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>
|
||||
|
||||
### Health checks
|
||||
|
@ -427,10 +407,12 @@ service {
|
|||
```
|
||||
|
||||
```json
|
||||
"service": {
|
||||
{
|
||||
"service": {
|
||||
## ...
|
||||
"enable_tag_override": true,
|
||||
## ...
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
|
Loading…
Reference in New Issue