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

consul: Include port-label in service registration #5829

Merged
merged 1 commit into from
Jun 13, 2019
Merged

Commits on Jun 13, 2019

  1. consul: Include port-label in service registration

    It is possible to provide multiple identically named services with
    different port assignments in a Nomad configuration.
    
    We introduced a regression when migrating to stable service identifiers where
    multiple services with the same name would conflict, and the last definition
    would take precedence.
    
    This commit includes the port label in the stable service identifier to
    allow the previous behaviour where this was supported, for example
    providing:
    
    ```hcl
    service {
      name = "redis-cache"
      tags = ["global", "cache"]
      port = "db"
      check {
        name     = "alive"
        type     = "tcp"
        interval = "10s"
        timeout  = "2s"
      }
    }
    
    service {
      name = "redis-cache"
      tags = ["global", "foo"]
      port = "foo"
    
      check {
        name     = "alive"
        type     = "tcp"
        port     = "db"
        interval = "10s"
        timeout  = "2s"
      }
    }
    
    service {
      name = "redis-cache"
      tags = ["global", "bar"]
      port = "bar"
    
      check {
        name     = "alive"
        type     = "tcp"
        port     = "db"
        interval = "10s"
        timeout  = "2s"
      }
    }
    ```
    
    in a nomad task definition is now completely valid. Each service
    definition with the same name must still have a unique port label however.
    endocrimes committed Jun 13, 2019
    Configuration menu
    Copy the full SHA
    efdfef8 View commit details
    Browse the repository at this point in the history