From 750317c0224ece2e9b18876bc3ee7fbf3314fe53 Mon Sep 17 00:00:00 2001 From: hc-github-team-consul-core Date: Wed, 20 Sep 2023 19:17:55 -0400 Subject: [PATCH] Backport of docs: Remove YAML service registration examples into release/1.16.x (#18906) backport of commit 06c2aaaf74115cdaf21af058aebe5b4c5776e037 Co-authored-by: Blake Covarrubias --- .../connect/gateways/mesh-gateway/index.mdx | 113 ++++++++++----- .../service-to-service-traffic-partitions.mdx | 129 ++++++++++++------ ...ice-to-service-traffic-wan-datacenters.mdx | 111 ++++++++++----- .../docs/services/usage/define-services.mdx | 30 +--- 4 files changed, 246 insertions(+), 137 deletions(-) diff --git a/website/content/docs/connect/gateways/mesh-gateway/index.mdx b/website/content/docs/connect/gateways/mesh-gateway/index.mdx index 17821edf531f..ca59854e342d 100644 --- a/website/content/docs/connect/gateways/mesh-gateway/index.mdx +++ b/website/content/docs/connect/gateways/mesh-gateway/index.mdx @@ -100,6 +100,17 @@ MeshGateway: - Mode: local Name: global ``` + +```json +{ + "Kind": "proxy-defaults", + "Name": "global", + "MeshGateway": { + "Mode": "local" + } +} +``` + ### Enabling Gateways Per Service @@ -123,6 +134,16 @@ MeshGateway: Name: web ``` +```json +{ + "Kind": "service-defaults", + "Name": "web", + "MeshGateway": { + "Mode": "local" + } +} +``` + ### Enabling Gateways for a Service Instance @@ -161,7 +182,7 @@ service { sidecar_service { proxy { mesh_gateway { - mode = "remote" + mode = "remote" } upstreams = [ { @@ -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 + } + ] + } + } +} ``` @@ -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" + } + } + ] + } + } +} +``` diff --git a/website/content/docs/connect/gateways/mesh-gateway/service-to-service-traffic-partitions.mdx b/website/content/docs/connect/gateways/mesh-gateway/service-to-service-traffic-partitions.mdx index 22a4e9d9b8f7..db9dd962c6e7 100644 --- a/website/content/docs/connect/gateways/mesh-gateway/service-to-service-traffic-partitions.mdx +++ b/website/content/docs/connect/gateways/mesh-gateway/service-to-service-traffic-partitions.mdx @@ -95,6 +95,16 @@ MeshGateway: Name: global ``` +```json +{ + "Kind": "proxy-defaults", + "Name": "global", + "MeshGateway": { + "Mode": "local" + } +} +``` + ### Enabling Gateways Per Service @@ -117,6 +127,17 @@ MeshGateway: - Mode: local Name: web ``` + +```json +{ + "Kind": "service-defaults", + "Name": "web", + "MeshGateway": { + "Mode": "local" + } +} +``` + ### 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) enables gateways for `web` service instances in the `finance` partition. - + ```hcl service { @@ -149,21 +170,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 + } + ] + } + } +} ``` @@ -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. - + ```hcl service { @@ -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" + } + } + ] + } + } +} ``` diff --git a/website/content/docs/connect/gateways/mesh-gateway/service-to-service-traffic-wan-datacenters.mdx b/website/content/docs/connect/gateways/mesh-gateway/service-to-service-traffic-wan-datacenters.mdx index dc017e0af232..5ea85c262718 100644 --- a/website/content/docs/connect/gateways/mesh-gateway/service-to-service-traffic-wan-datacenters.mdx +++ b/website/content/docs/connect/gateways/mesh-gateway/service-to-service-traffic-wan-datacenters.mdx @@ -110,6 +110,16 @@ MeshGateway: - Mode: local Name: global ``` + +```json +{ + "Kind": "proxy-defaults", + "Name": "global", + "MeshGateway": { + "Mode": "local" + } +} +``` ### Enabling Gateways Per Service @@ -133,6 +143,15 @@ MeshGateway: Name: web ``` +```json +{ + "Kind": "service-defaults", + "Name": "web", + "MeshGateway": { + "Mode": "local" + } +} + ### Enabling Gateways for a Service Instance @@ -186,19 +205,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 + } + ] + } + } +} ``` @@ -242,25 +269,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" + } + } + ] + } + } +} +``` + diff --git a/website/content/docs/services/usage/define-services.mdx b/website/content/docs/services/usage/define-services.mdx index 60f19997eb30..5b1450fe1a6a 100644 --- a/website/content/docs/services/usage/define-services.mdx +++ b/website/content/docs/services/usage/define-services.mdx @@ -110,26 +110,6 @@ service { } ``` - - -```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 -``` - ### Health checks @@ -427,10 +407,12 @@ service { ``` ```json -"service": { - ## ... - "enable_tag_override": true, - ## ... +{ + "service": { + ## ... + "enable_tag_override": true, + ## ... + } } ```