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

[CC-7044] Start HCP manager as part of link creation #1303

Open
3 of 4 tasks
dhiaayachi opened this issue Sep 28, 2024 · 0 comments
Open
3 of 4 tasks

[CC-7044] Start HCP manager as part of link creation #1303

dhiaayachi opened this issue Sep 28, 2024 · 0 comments

Comments

@dhiaayachi
Copy link
Owner

Description

Depends on hashicorp#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:

  • 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:

  1. Start Consul without a cloud configuration
  2. Make a PUT request to create a link resource
  3. Inspect logs to see that HCP manager has started
  4. Check in HCP portal that all features are working as expected (server info and services syncing, observability, global workflows, etc.)
  5. Make a GET request to the link and check the status is successful

Other variations tested:

  • Linking via configuration rather than the API
  • Bootstrapping via configuration

Links

PR Checklist

  • updated test coverage
  • external facing docs updated
  • appropriate backport labels added
  • not a security concern
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant