minio / sidekick

High Performance HTTP Sidecar Load Balancer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

v2 is rejecting `tasks.*` (Docker Swarm) hostnames

francisfontoura opened this issue · comments

Expected Behavior

Command sidekick -p /minio/health/ready http://tasks.s3_minio{1...4} should work like v1.

Current Behavior

Console logs sidekick: <ERROR> invalid endpoint "http://tasks.s3_minio1:9000" and health check path "/minio/health/ready": invalid hostname and Sidekick fails to start.

Possible Solution

Sidekicks relies on github.com/minio/pkg/net package to validate endpoint argument. The library identifies the hostname as FQDN and test against ^[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?$ regular expression, what fails because of _ character.

Steps to Reproduce (for bugs)

N/A.

Context

tasks.* Docker Swarm hostnames are useful in cross stack network access between containers and always follows the tasks.${Stack.Name}_${Service.Name} pattern.

Regression

No.

Your Environment

  • Version used (sidekick version): 2.0.3
  • Environment name and version (e.g. nginx 1.9.1): n/a.
  • Server type and version: n/a.
  • Operating System and version (uname -a): n/a.
  • Link to your project: n/a.

_ is not a valid DNS name @francisfontoura - however that it's supported via Docker it is incorrect to have such hostnames use something like - instead of _

According to RFC 2181, section 11 "Name syntax:

The DNS itself places only one restriction on the particular labels that can be used to identify resource records. That one restriction relates to the length of the label and the full name. [...] Implementations of the DNS protocols must not place any restrictions on the labels that can be used.

Despite RFC 952 defines legal internet host names restrictions, internal Docker Swarm DNS resolution doesn't have to follow It, because it's not about "internet host names", only DNS. tasks.* names are not FQDNs, but are valid DNS addresses and, IMO at least, should not be refused by MinIO Sidekick, nor by minio/pkg/net.

Hope you reconsider. Thanks for attention.

Despite RFC 952 defines legal internet host names restrictions, internal Docker Swarm DNS resolution doesn't have to follow It, because it's not about "internet host names", only DNS. tasks.* names are not FQDNs, but are valid DNS addresses and, IMO at least, should not be refused by MinIO Sidekick, nor by minio/pkg/net.

No, for now, we may not support it - we have rejected similar requests in the past. Please change your hostnames to comply with the RFC 952

Unfortunately, I cannot. As explained in "Context" section of post, the "invalid" character _ is put by Docker:

[...] follows the tasks.${Stack.Name}_${Service.Name} pattern.

In my example, s3 is stack's name and minio1 is service's. There's no way to change "underscore" intentionally. Until you reconsider, we're stuck on v1. Thanks anyway.