Consul: Change service tags via UI and/or CLI

Created on 4 Sep 2018  Â·  3Comments  Â·  Source: hashicorp/consul

When using tags to denote e.g. the current database primary, it's somewhat clunky to update tags via the /catalog/register endpoint (it is low-level, accepts nodes/services/checks at the same endpoint — or a combination of all at once).

A dedicated endpoint for the tags of a specific service (at the node), or a CLI command, would go a long way to make it easier.

Previous discussion: https://github.com/hashicorp/consul/issues/867#issuecomment-299667949

themoperator-usability themui typenhancement

Most helpful comment

@pearkes Thanks for clarifying!

Yes, enable_tag_override is great, and will get even better when updates to the catalog is easier (which is the topic of my issue).

All 3 comments

I understand you're asking for an additional CLl/API/UI interaction here to modify tags, but for the sake of anyone else finding this issue as we leave it open I wanted to call out the ability to make this change via the catalog using enable_tag_override.

The enable_tag_override can optionally be specified to disable the anti-entropy feature for this service. If enable_tag_override is set to TRUE then external agents can update this service in the catalog and modify the tags. Subsequent local sync operations by this agent will ignore the updated tags. For example, if an external agent modified both the tags and the port for this service and enable_tag_override was set to TRUE then after the next sync cycle the service's port would revert to the original value but the tags would maintain the updated value. As a counter example: If an external agent modified both the tags and port for this service and enable_tag_override was set to FALSE then after the next sync cycle the service's port and the tags would revert to the original value and all modifications would be lost.

https://www.consul.io/docs/agent/services.html

@pearkes Thanks for clarifying!

Yes, enable_tag_override is great, and will get even better when updates to the catalog is easier (which is the topic of my issue).

Hello, any possibility to edit multiple services tags via a transaction ? I need to edit a lot of them.
Is there any possibility to changes the Tags without having to register again the services ?

Also, I'm quite new to Consul and don't get the point about updating services from Catalog or Agent endpoint, I did a test and when I register a service from the agent endpoint, tags are reflected when I query the catalog.

Really straightforward payload

{
  "Name": "test-guigui",
  "Tags": [
    "prometheus-4"
  ]
}

curl http://.....:8500/v1/catalog/services

  "test-guigui": [
    "prometheus-4"
  ],

curl http://.....:8500/v1/agent/services

  "test-guigui": {
    "ID": "test-guigui",
    "Service": "test-guigui",
    "Tags": [
      "prometheus-4"
    ],
    "Meta": {},
    "Port": 0,
    "Address": "",
    "Weights": {
      "Passing": 1,catalog
      "Warning": 1
    },
    "EnableTagOverride": false
  },

Note the tag override default value

Was this page helpful?
0 / 5 - 0 ratings