From 6863c54dabc1b41094101dc9c6e042e2608bb17e Mon Sep 17 00:00:00 2001 From: Jon Menzies-Smith Date: Thu, 26 Jun 2025 17:51:41 +0100 Subject: [PATCH 1/5] Add docs for AWS Cloudmap name resolution Signed-off-by: Jon Menzies-Smith --- .../ne-awscloudmap.md | 146 ++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100644 daprdocs/content/en/reference/components-reference/supported-name-resolution/ne-awscloudmap.md diff --git a/daprdocs/content/en/reference/components-reference/supported-name-resolution/ne-awscloudmap.md b/daprdocs/content/en/reference/components-reference/supported-name-resolution/ne-awscloudmap.md new file mode 100644 index 00000000000..25aec0c8aab --- /dev/null +++ b/daprdocs/content/en/reference/components-reference/supported-name-resolution/ne-awscloudmap.md @@ -0,0 +1,146 @@ +--- +type: docs +title: "AWS Cloudmap" +linkTitle: "AWS Cloudmap" +description: Detailed information on the AWS Cloudmap name resolution component +--- + + +This component uses [AWS Cloud Map](https://aws.amazon.com/cloud-map/) for service discovery in Dapr. It supports both HTTP and DNS namespaces, allowing services to discover and connect to other services using AWS Cloud Map's service discovery capabilities. + +## Component Format + +```yaml +apiVersion: dapr.io/v1alpha1 +kind: Configuration +metadata: + name: appconfig +spec: + nameResolution: + component: "aws.cloudmap" + configuration: + # Required: AWS CloudMap namespace configuration (one of these is required) + namespaceName: "my-namespace" # The name of your CloudMap namespace + # namespaceId: "ns-xxxxxx" # Alternative: Use namespace ID instead of name + + # Optional: AWS authentication (choose one authentication method) + # Option 1: Environment variables AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY + # Option 2: IAM roles for Amazon EKS + # Option 3: Explicit credentials (not recommended for production) + accessKey: "****" + secretKey: "****" + sessionToken: "****" # Optional + + # Optional: AWS region and endpoint configuration + region: "us-west-2" + endpoint: "http://localhost:4566" # Optional: Custom endpoint for testing + + # Optional: Dapr configuration + defaultDaprPort: 50002 # Default port for Dapr sidecar if not specified in instance attributes +``` + +## Specification + +### AWS Authentication + +The component supports multiple authentication methods: + +1. Environment Variables: + - AWS_ACCESS_KEY_ID + - AWS_SECRET_ACCESS_KEY + - AWS_SESSION_TOKEN (optional) + +2. IAM Roles: + - When running on AWS (EKS, EC2, etc.), the component can use IAM roles + +3. Explicit Credentials: + - Provided in the component metadata (not recommended for production) + +### Required Permissions + +The AWS credentials must have the following permissions: +```json +{ + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Action": [ + "servicediscovery:DiscoverInstances", + "servicediscovery:GetNamespace", + "servicediscovery:ListNamespaces" + ], + "Resource": "*" + } + ] +} +``` + +### Configuration Options + +| Property | Type | Required | Default | Description | +|----------|------|----------|---------|-------------| +| namespaceName | string | One of namespaceName or namespaceId | "" | The name of your AWS CloudMap namespace | +| namespaceId | string | One of namespaceName or namespaceId | "" | The ID of your AWS CloudMap namespace | +| region | string | N | "" | AWS region. If not provided, will be determined from environment or instance metadata | +| endpoint | string | N | "" | Custom endpoint for AWS CloudMap API. Useful for testing with LocalStack | +| defaultDaprPort | number | N | 3500 | Default port for Dapr sidecar if not specified in instance attributes | + +### Service Registration + +To use this name resolver, your services must be registered in AWS CloudMap. When registering instances, ensure they have the following attributes: + +1. Required: One of these address attributes: + - `AWS_INSTANCE_IPV4`: IPv4 address of the instance + - `AWS_INSTANCE_IPV6`: IPv6 address of the instance + - `AWS_INSTANCE_CNAME`: Hostname of the instance + +2. Optional: Dapr sidecar port attribute: + - `DAPR_PORT`: The port that the Dapr sidecar is listening on + - If not specified, the component will use the `defaultDaprPort` from configuration (defaults to 3500) + +The resolver will only return healthy instances (those with `HEALTHY` status) to ensure reliable service communication. + +Example instance attributes: +```json +{ + "AWS_INSTANCE_IPV4": "10.0.0.1", + "DAPR_PORT": "50002" +} +``` + + +## Example Usage + +### Minimal Configuration + +```yaml +apiVersion: dapr.io/v1alpha1 +kind: Configuration +metadata: + name: appconfig +spec: + nameResolution: + component: "aws.cloudmap" + configuration: + namespaceName: "mynamespace.dev" + defaultDaprPort: 50002 +``` + +### Local Development with LocalStack + +```yaml +apiVersion: dapr.io/v1alpha1 +kind: Configuration +metadata: + name: appconfig +spec: + nameResolution: + component: "aws.cloudmap" + configuration: + namespaceName: "my-namespace" + region: "us-east-1" + endpoint: "http://localhost:4566" + accessKey: "test" + secretKey: "test" +``` \ No newline at end of file From d94ab4e776ceedaa3be25cc865f723e59373c51c Mon Sep 17 00:00:00 2001 From: Jon Menzies-Smith Date: Thu, 26 Jun 2025 17:52:09 +0100 Subject: [PATCH 2/5] Add docs for Nameformat name resolution Signed-off-by: Jon Menzies-Smith --- .../nr-nameformat.md | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 daprdocs/content/en/reference/components-reference/supported-name-resolution/nr-nameformat.md diff --git a/daprdocs/content/en/reference/components-reference/supported-name-resolution/nr-nameformat.md b/daprdocs/content/en/reference/components-reference/supported-name-resolution/nr-nameformat.md new file mode 100644 index 00000000000..c3202a628a7 --- /dev/null +++ b/daprdocs/content/en/reference/components-reference/supported-name-resolution/nr-nameformat.md @@ -0,0 +1,45 @@ +--- +type: docs +title: "Nameformat" +linkTitle: "NameFormat" +description: Detailed information on the NameFormat name resolution component +--- + + +The Name Format name resolver provides a flexible way to resolve service names using a configurable format string with placeholders. This is useful in scenarios where you want to map service names to predictable DNS names following a specific pattern. + +## Configuration Format + +To use the Name Format name resolver, create a configuration in your Dapr environment: + +```yaml +apiVersion: dapr.io/v1alpha1 +kind: Configuration +metadata: + name: appconfig +spec: + nameResolution: + component: "nameformat" + configuration: + format: "service-{appid}.default.svc.cluster.local" # Replace with your desired format pattern +``` + +## Configuration Fields + +| Field | Required | Details | Example | +|---------|----------|---------|---------| +| format | Y | The format string to use for name resolution. Must contain the `{appid}` placeholder which will be replaced with the actual service name. | `"service-{appid}.default.svc.cluster.local"` | + +## Examples + +When configured with `format: "service-{appid}.default.svc.cluster.local"`, the resolver will transform service names as follows: + +- Service ID "myapp" → "service-myapp.default.svc.cluster.local" +- Service ID "frontend" → "service-frontend.default.svc.cluster.local" + + +## Notes + +- Empty service IDs are not allowed and will result in an error +- The format string must be provided in the configuration +- The format string must contain at least one `{appid}` placeholder \ No newline at end of file From eb4373899bd7bd3f64b921c71c56859987cbb000 Mon Sep 17 00:00:00 2001 From: Jon Menzies-Smith Date: Thu, 3 Jul 2025 11:26:16 +0100 Subject: [PATCH 3/5] Apply suggestions from code review Co-authored-by: Mark Fussell Signed-off-by: Jon Menzies-Smith --- .../supported-name-resolution/ne-awscloudmap.md | 14 +++++++++----- .../supported-name-resolution/nr-nameformat.md | 8 ++++---- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/daprdocs/content/en/reference/components-reference/supported-name-resolution/ne-awscloudmap.md b/daprdocs/content/en/reference/components-reference/supported-name-resolution/ne-awscloudmap.md index 25aec0c8aab..a2d889a378f 100644 --- a/daprdocs/content/en/reference/components-reference/supported-name-resolution/ne-awscloudmap.md +++ b/daprdocs/content/en/reference/components-reference/supported-name-resolution/ne-awscloudmap.md @@ -8,7 +8,11 @@ description: Detailed information on the AWS Cloudmap name resolution component This component uses [AWS Cloud Map](https://aws.amazon.com/cloud-map/) for service discovery in Dapr. It supports both HTTP and DNS namespaces, allowing services to discover and connect to other services using AWS Cloud Map's service discovery capabilities. -## Component Format +## Configuration format + +Name resolution is configured via the [Dapr Configuration]({{< ref configuration-overview.md >}}). + +Within the configuration YAML, set the `spec.nameResolution.component` property to `"aws.cloudmap"`, then pass configuration options in the `spec.nameResolution.configuration` dictionary. ```yaml apiVersion: dapr.io/v1alpha1 @@ -41,7 +45,7 @@ spec: ## Specification -### AWS Authentication +### AWS authentication The component supports multiple authentication methods: @@ -56,7 +60,7 @@ The component supports multiple authentication methods: 3. Explicit Credentials: - Provided in the component metadata (not recommended for production) -### Required Permissions +### Required permissions The AWS credentials must have the following permissions: ```json @@ -76,7 +80,7 @@ The AWS credentials must have the following permissions: } ``` -### Configuration Options +### Spec configuration fields | Property | Type | Required | Default | Description | |----------|------|----------|---------|-------------| @@ -86,7 +90,7 @@ The AWS credentials must have the following permissions: | endpoint | string | N | "" | Custom endpoint for AWS CloudMap API. Useful for testing with LocalStack | | defaultDaprPort | number | N | 3500 | Default port for Dapr sidecar if not specified in instance attributes | -### Service Registration +### Service registration To use this name resolver, your services must be registered in AWS CloudMap. When registering instances, ensure they have the following attributes: diff --git a/daprdocs/content/en/reference/components-reference/supported-name-resolution/nr-nameformat.md b/daprdocs/content/en/reference/components-reference/supported-name-resolution/nr-nameformat.md index c3202a628a7..b32d4be328b 100644 --- a/daprdocs/content/en/reference/components-reference/supported-name-resolution/nr-nameformat.md +++ b/daprdocs/content/en/reference/components-reference/supported-name-resolution/nr-nameformat.md @@ -24,15 +24,15 @@ spec: format: "service-{appid}.default.svc.cluster.local" # Replace with your desired format pattern ``` -## Configuration Fields +## Spec configuration fields | Field | Required | Details | Example | |---------|----------|---------|---------| -| format | Y | The format string to use for name resolution. Must contain the `{appid}` placeholder which will be replaced with the actual service name. | `"service-{appid}.default.svc.cluster.local"` | +| format | Y | The format string to use for name resolution. Must contain the `{appid}` placeholder which is replaced with the actual service name. | `"service-{appid}.default.svc.cluster.local"` | ## Examples -When configured with `format: "service-{appid}.default.svc.cluster.local"`, the resolver will transform service names as follows: +When configured with `format: "service-{appid}.default.svc.cluster.local"`, the resolver transforms service names as follows: - Service ID "myapp" → "service-myapp.default.svc.cluster.local" - Service ID "frontend" → "service-frontend.default.svc.cluster.local" @@ -40,6 +40,6 @@ When configured with `format: "service-{appid}.default.svc.cluster.local"`, the ## Notes -- Empty service IDs are not allowed and will result in an error +- Empty service IDs are not allowed and results in an error. - The format string must be provided in the configuration - The format string must contain at least one `{appid}` placeholder \ No newline at end of file From 7963e254b62326f047c68d952a76e9bda05ef6de Mon Sep 17 00:00:00 2001 From: Jon Menzies-Smith Date: Thu, 3 Jul 2025 12:20:08 +0100 Subject: [PATCH 4/5] Updates from PR Signed-off-by: Jon Menzies-Smith --- .../{ne-awscloudmap.md => nr-awscloudmap.md} | 23 ++++++++++++------- .../nr-nameformat.md | 8 +++++-- .../data/components/name_resolution/aws.yaml | 5 ++++ .../components/name_resolution/generic.yaml | 5 ++++ 4 files changed, 31 insertions(+), 10 deletions(-) rename daprdocs/content/en/reference/components-reference/supported-name-resolution/{ne-awscloudmap.md => nr-awscloudmap.md} (77%) create mode 100644 daprdocs/data/components/name_resolution/aws.yaml diff --git a/daprdocs/content/en/reference/components-reference/supported-name-resolution/ne-awscloudmap.md b/daprdocs/content/en/reference/components-reference/supported-name-resolution/nr-awscloudmap.md similarity index 77% rename from daprdocs/content/en/reference/components-reference/supported-name-resolution/ne-awscloudmap.md rename to daprdocs/content/en/reference/components-reference/supported-name-resolution/nr-awscloudmap.md index a2d889a378f..33f61b8b0f0 100644 --- a/daprdocs/content/en/reference/components-reference/supported-name-resolution/ne-awscloudmap.md +++ b/daprdocs/content/en/reference/components-reference/supported-name-resolution/nr-awscloudmap.md @@ -22,6 +22,7 @@ metadata: spec: nameResolution: component: "aws.cloudmap" + version: "v1" configuration: # Required: AWS CloudMap namespace configuration (one of these is required) namespaceName: "my-namespace" # The name of your CloudMap namespace @@ -82,13 +83,13 @@ The AWS credentials must have the following permissions: ### Spec configuration fields -| Property | Type | Required | Default | Description | -|----------|------|----------|---------|-------------| -| namespaceName | string | One of namespaceName or namespaceId | "" | The name of your AWS CloudMap namespace | -| namespaceId | string | One of namespaceName or namespaceId | "" | The ID of your AWS CloudMap namespace | -| region | string | N | "" | AWS region. If not provided, will be determined from environment or instance metadata | -| endpoint | string | N | "" | Custom endpoint for AWS CloudMap API. Useful for testing with LocalStack | -| defaultDaprPort | number | N | 3500 | Default port for Dapr sidecar if not specified in instance attributes | +| Field | Required | Type | Default | Description | +|-----------------|-------------------------------------|--------|---------|-------------| +| namespaceName | One of namespaceName or namespaceId | string | "" | The name of your AWS CloudMap namespace | +| namespaceId | One of namespaceName or namespaceId | string | "" | The ID of your AWS CloudMap namespace | +| region | N | string | "" | AWS region. If not provided, will be determined from environment or instance metadata | +| endpoint | N | string | "" | Custom endpoint for AWS CloudMap API. Useful for testing with LocalStack | +| defaultDaprPort | N | number | 3500 | Default port for Dapr sidecar if not specified in instance attributes | ### Service registration @@ -116,6 +117,8 @@ Example instance attributes: ## Example Usage +Name resolution is configured via the [Dapr Configuration]({{< ref configuration-overview.md >}}). Here are some examples of its usage. + ### Minimal Configuration ```yaml @@ -147,4 +150,8 @@ spec: endpoint: "http://localhost:4566" accessKey: "test" secretKey: "test" -``` \ No newline at end of file +``` + +### Related Links +- [Service invocation building block]({{< ref service-invocation >}}) +- [AWS Cloudmap documentation](https://aws.amazon.com/cloud-map/) \ No newline at end of file diff --git a/daprdocs/content/en/reference/components-reference/supported-name-resolution/nr-nameformat.md b/daprdocs/content/en/reference/components-reference/supported-name-resolution/nr-nameformat.md index b32d4be328b..c86e28a4a35 100644 --- a/daprdocs/content/en/reference/components-reference/supported-name-resolution/nr-nameformat.md +++ b/daprdocs/content/en/reference/components-reference/supported-name-resolution/nr-nameformat.md @@ -6,11 +6,15 @@ description: Detailed information on the NameFormat name resolution component --- -The Name Format name resolver provides a flexible way to resolve service names using a configurable format string with placeholders. This is useful in scenarios where you want to map service names to predictable DNS names following a specific pattern. +The Name Format name resolver provides a flexible way to resolve service names using a configurable format string with placeholders. This is useful in scenarios where you want to map service names to predictable DNS names following a specific pattern. + +Consider using this name resolver if there is no specific name resolver available for your service registry, but your service registry can expose services via internal DNS names using predictable naming conventions. ## Configuration Format -To use the Name Format name resolver, create a configuration in your Dapr environment: +Name resolution is configured via the [Dapr Configuration]({{< ref configuration-overview.md >}}). + +Within the configuration YAML, set the `spec.nameResolution.component` property to `"nameformat"`, then pass configuration options in the `spec.nameResolution.configuration` dictionary. ```yaml apiVersion: dapr.io/v1alpha1 diff --git a/daprdocs/data/components/name_resolution/aws.yaml b/daprdocs/data/components/name_resolution/aws.yaml new file mode 100644 index 00000000000..92203e6c200 --- /dev/null +++ b/daprdocs/data/components/name_resolution/aws.yaml @@ -0,0 +1,5 @@ +- component: CloudMap + link: nr-awscloudmap + state: Alpha + version: v1 + since: "1.16" diff --git a/daprdocs/data/components/name_resolution/generic.yaml b/daprdocs/data/components/name_resolution/generic.yaml index 1718f2bae1e..ec7e8c97836 100644 --- a/daprdocs/data/components/name_resolution/generic.yaml +++ b/daprdocs/data/components/name_resolution/generic.yaml @@ -8,3 +8,8 @@ state: Alpha version: v1 since: "1.13" +- component: NameFormat + link: nr-nameformat + state: Alpha + version: v1 + since: "1.16" \ No newline at end of file From d44d8ec30b7ef3dd03e62a98694929b6d3801119 Mon Sep 17 00:00:00 2001 From: Mark Fussell Date: Wed, 9 Jul 2025 08:31:57 -0700 Subject: [PATCH 5/5] Update daprdocs/content/en/reference/components-reference/supported-name-resolution/nr-awscloudmap.md Signed-off-by: Mark Fussell --- .../supported-name-resolution/nr-awscloudmap.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daprdocs/content/en/reference/components-reference/supported-name-resolution/nr-awscloudmap.md b/daprdocs/content/en/reference/components-reference/supported-name-resolution/nr-awscloudmap.md index 33f61b8b0f0..6c14ea3953f 100644 --- a/daprdocs/content/en/reference/components-reference/supported-name-resolution/nr-awscloudmap.md +++ b/daprdocs/content/en/reference/components-reference/supported-name-resolution/nr-awscloudmap.md @@ -104,7 +104,7 @@ To use this name resolver, your services must be registered in AWS CloudMap. Whe - `DAPR_PORT`: The port that the Dapr sidecar is listening on - If not specified, the component will use the `defaultDaprPort` from configuration (defaults to 3500) -The resolver will only return healthy instances (those with `HEALTHY` status) to ensure reliable service communication. +The resolver only returns healthy instances (those with `HEALTHY` status) to ensure reliable service communication. Example instance attributes: ```json