Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nomad service name validation stricter than Consul validation #11097

Closed
craigday opened this issue Aug 30, 2021 · 2 comments
Closed

Nomad service name validation stricter than Consul validation #11097

craigday opened this issue Aug 30, 2021 · 2 comments
Assignees
Labels
good first issue help-wanted We encourage community PRs for these issues! stage/accepted Confirmed, and intend to work on. No timeline committment though. theme/consul theme/service-discovery/consul type/bug

Comments

@craigday
Copy link

Nomad version

Nomad v1.1.3 (8c0c814)

Operating system and Environment details

Linux ip-172-25-216-30.ap-southeast-2.compute.internal 3.10.0-1160.36.2.el7.x86_64 #1 SMP Wed Jul 21 11:57:15 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Issue

The validation of service name when registering services in Consul via the service{} block is stricter than that of Consul. Consul allows registering service names that don't comply with RFC1123, since that restriction is purely to satisfy DNS based service discovery, and not everyone uses Consul DNS.

Example Error:

Service name must be valid per RFC 1123 and can contain only alphanumeric characters or dashes: "com.daml.ledger.api.v1.ActiveContractsService"

Reproduction steps

  service {
    name = "com.daml.ledger.api.v1.ActiveContractsService"
    port = "service"
    address_mode = "host"
    check {
      type = "tcp"
      address_mode = "host"
      port = "service"
      interval = "10s"
      timeout = "5s"
    }
 }

Expected Result

The service is registered with Consul.

Actual Result

Service name must be valid per RFC 1123 and can contain only alphanumeric characters or dashes: "com.daml.ledger.api.v1.ActiveContractsService"

@lgfa29 lgfa29 added stage/accepted Confirmed, and intend to work on. No timeline committment though. theme/consul labels Sep 2, 2021
@lgfa29
Copy link
Contributor

lgfa29 commented Sep 2, 2021

Thanks for the report @craigday. Consul's documentation does mention that valid DNS labels are recommended, but not required.

We recommend using valid DNS labels for service definition names for compatibility with external DNS.

Testing a manual service registration also works in Consul

$ consul catalog services
consul
web.1

@Juanadelacuesta
Copy link
Member

After going through some possible solutions for this issue, it was decided to maintain the current validation in place because it will make a future transition to an external DNS compatible with all currently existing services and also, even though Consul does not enforce any type of validation, Consul templates does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue help-wanted We encourage community PRs for these issues! stage/accepted Confirmed, and intend to work on. No timeline committment though. theme/consul theme/service-discovery/consul type/bug
Projects
None yet
Development

No branches or pull requests

5 participants