Add docs for Nameformat name resolution

Signed-off-by: Jon Menzies-Smith <github@menzies-smith.co.uk>
This commit is contained in:
Jon Menzies-Smith 2025-06-26 17:52:09 +01:00
parent 6863c54dab
commit d94ab4e776
No known key found for this signature in database
1 changed files with 45 additions and 0 deletions

View File

@ -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