Consul is a distributed, highly available, and data center aware solution to connect and configure applications across dynamic, distributed infrastructure.
This PR starts the HCP manger when an HCP link resource is created instead of when Consul is started. This allows the linking process to be initiated via the HCP link API.
These changes are best viewed commit-by-commit. A summary of the changes are:
Check explicitly for ACL policies since the HCP manger will create a token, so acl:write is also now required in addition to operator:write
Change the HCP manager’s Run method to a Start method, keep track of if its running, and only allow to start once
Always initialize the required HCP components (i.e., SCADA provider, HCP metrics sink) when Consul starts
Pass the HCP manager as a dependency to the link controller
When a link is created, update the HCP manager with the HCP configs and start it
This PR also introduces a breaking change, though that change actually fixes Consul's behavior to match what we have documented. The agent telemetry docs and the agent configuration docs for telemetry.disable_hostname both state that by default, the hostname of the Consul agent should prefix gauge-type metrics. However, before this PR, if there were no additional metrics sinks enabled, the hostname prefixing was disabled. Now that we're always enabling the HCP metrics sink, we will now always prefix the gauge-metrics by default.
Testing & Reproduction steps
Linking via API:
Start Consul without a cloud configuration
Make a PUT request to create a link resource
Inspect logs to see that HCP manager has started
Check in HCP portal that all features are working as expected (server info and services syncing, observability, global workflows, etc.)
Make a GET request to the link and check the status is successful
Description
Depends on https://github.com/hashicorp/consul/pull/20306
This PR starts the HCP manger when an HCP link resource is created instead of when Consul is started. This allows the linking process to be initiated via the HCP link API.
These changes are best viewed commit-by-commit. A summary of the changes are:
acl:write
is also now required in addition tooperator:write
This PR also introduces a breaking change, though that change actually fixes Consul's behavior to match what we have documented. The agent telemetry docs and the agent configuration docs for
telemetry.disable_hostname
both state that by default, the hostname of the Consul agent should prefix gauge-type metrics. However, before this PR, if there were no additional metrics sinks enabled, the hostname prefixing was disabled. Now that we're always enabling the HCP metrics sink, we will now always prefix the gauge-metrics by default.Testing & Reproduction steps
Linking via API:
cloud
configurationOther variations tested:
Links
PR Checklist