From 247fdc1f3d76a754504fd87fcaf28b6813fb5f66 Mon Sep 17 00:00:00 2001 From: hc-github-team-consul-core Date: Fri, 11 Aug 2023 13:30:42 -0400 Subject: [PATCH] Backport of NET-4952 Add docs for export command into release/1.16.x (#18449) * backport of commit d6d0450665659f172360d4daebc3103777e6c8a9 * backport of commit 39feb999f1dd5327ff2d3c9f425a58f4d6ec51bb * backport of commit 8b1398a9b1b80bc2491f55f4fcc4ed028c2f6590 * backport of commit 47b9c12a044f37649c906a9b6acf85d6e3055f56 * backport of commit db8d974cf156e4374307ac4a990373ec2bfd0d8d * backport of commit f64e808d5bac95257e1162475ee2bcf9c855060c * backport of commit 6b6dbb4f74fc49171b830c84138d2efd14656d52 * backport of commit 2e34721547ddc39162456e182fac7b611197a4f5 * backport of commit 2d52b0ca24bcfbbf747b8f1b6693660b03cbd3a9 --------- Co-authored-by: Nathan Coleman --- website/content/commands/services/export.mdx | 64 ++++++++++++++++++++ website/content/commands/services/index.mdx | 1 + website/data/commands-nav-data.json | 4 ++ 3 files changed, 69 insertions(+) create mode 100644 website/content/commands/services/export.mdx diff --git a/website/content/commands/services/export.mdx b/website/content/commands/services/export.mdx new file mode 100644 index 000000000..281d5f23e --- /dev/null +++ b/website/content/commands/services/export.mdx @@ -0,0 +1,64 @@ +--- +layout: commands +page_title: 'Commands: Services Export' +description: | + The `consul services export` command exports a service from one peer or admin partition to another. +--- + +# Consul Services Export + +Command: `consul services export` + +The `services export` command exports a service from one admin partition +or cluster peer to another. This command can be used in lieu of creating or updating the corresponding +`exported-services` configuration entry. Running the command multiple times with the same +arguments results in a no-op. + +```text +Usage: consul services export [options] -name -consumer-peers + + Export a service to a peered cluster. + + $ consul services export -name=web -consumer-peers=other-cluster + + Use the -consumer-partitions flag instead of -consumer-peers to export to a different partition in the same cluster. + + $ consul services export -name=web -consumer-partitions=other-partition + + Additional flags and more advanced use cases are detailed below. +``` + +#### Command options + +- `-name=` - (Required) The name of the service to export. + +- `-consumer-peers=` - (Required) A comma-separated list of cluster peers to export the service to. + In Consul Enterprise, this flag is optional when `-consumer-partitions` is specified. + +#### Enterprise options + +- `-consumer-partitions=` - A comma-separated list of admin partitions within the + same datacenter to export the service to. This flag is optional when `-consumer-peers` is specified. + +@include 'http_api_partition_options.mdx' + +@include 'http_api_namespace_options.mdx' + +#### API options + +@include 'http_api_options_client.mdx' + +## Examples + +In the following example, the `consul services export` command makes the `web` service available to services running in a cluster named `dc2` that has a previously-established cluster peering connection. + +```shell-session hideClipboard +$ consul services export -name=web -consumer-peers=dc2 +``` + +In the following example, the `consul services export` command makes the `web` service located in the +namespace `ns1` and the admin partition `alpha` to other admin partitions named `beta` and `delta`. + +```shell-session hideClipboard +$ consul services export -name=web -namespace=ns1 -partition=alpha -consumer-partitions=beta,delta +``` diff --git a/website/content/commands/services/index.mdx b/website/content/commands/services/index.mdx index ec26946c5..f511ffe2e 100644 --- a/website/content/commands/services/index.mdx +++ b/website/content/commands/services/index.mdx @@ -31,6 +31,7 @@ Usage: consul services [options] [args] Subcommands: deregister Deregister services with the local agent register Register services with the local agent + export Export services from one cluster peer or admin partition to another ``` For more information, examples, and usage about a subcommand, click on the name diff --git a/website/data/commands-nav-data.json b/website/data/commands-nav-data.json index ee491e9df..dd38459a9 100644 --- a/website/data/commands-nav-data.json +++ b/website/data/commands-nav-data.json @@ -487,6 +487,10 @@ { "title": "deregister", "path": "services/deregister" + }, + { + "title": "export", + "path": "services/export" } ] },