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

Add telemetryCollector.cloud.resourceId field that works even when global.cloud.enabled is false #3219

Merged
merged 8 commits into from
Nov 21, 2023

Conversation

jjti
Copy link
Contributor

@jjti jjti commented Nov 15, 2023

Changes proposed in this PR:

@eddie-rowe reported that he was unable to deploy the Consul Telemetry Collector when global.cloud.enabled was false. This should be possible, but right now the telemetry-collector deployment pulls its resourceId out of global.cloud.resourceId, which may not be set even when a user is trying to use the collector.

For example, a user may link their cluster to HCP using externalServers, while global.cloud is empty (because there are no servers in the deployment), but then the telemetryCollector will fail to deploy for lack of global.cloud.resourceId

The change here is to add a new field, telemetryCollector.cloud.resourceId that's settable. If set, it's used in the consul-telemetry-collector deployment

JIRA: https://hashicorp.atlassian.net/browse/CC-6866

Time willing, in a follow up PR I'll add something to the -preset cloud to parse an HCP_RESOURCE_ID env var into a global.cloud.resourceId like we do already for client id and secret:

EnvHCPClientID = "HCP_CLIENT_ID"

How I've tested this PR:

  • new bats tests, fixed old ones

How I expect reviewers to test this PR:

  • please let me know if anything is unclear and whether bats is sufficient

Checklist:

@jjti jjti added backport/1.1.x Backport to release/1.1.x branch backport/1.2.x This release branch is no longer active. backport/1.3.x labels Nov 16, 2023
@@ -165,28 +166,46 @@ spec:
# These are mounted as secrets so that the telemetry-collector can use them when cloud is enabled.
# - the hcp-go-sdk in consul agent will already look for HCP_CLIENT_ID, HCP_CLIENT_SECRET, HCP_AUTH_URL,
# HCP_SCADA_ADDRESS, and HCP_API_HOST. so nothing more needs to be done.
# - HCP_RESOURCE_ID is created for use in the global cloud section but we will share it here
# - HCP_RESOURCE_ID is created either in the global cloud section or in telemetryCollector.cloud
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bit of re-organizing to match Values.yaml ordering

  • resource-id
  • client-id
  • client-secret

--set 'telemetryCollector.clientSecret.secretKey=client-secret-id-key' \
--set 'global.resourceId.secretName=resource-id-name' \
--set 'global.resourceId.secretKey=resource-id-key' \
--set 'telemetryCollector.cloud.clientSecret.secretName=client-secret-id-name' \
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whole lot of these kinds of bugs in the tests, missing .cloud in the secret setting

# If global.cloud.resourceId is set, this should either be unset (defaulting to global.cloud.resourceId) or be the same as global.cloud.resourceId.
#
# @default: global.cloud.resourceId
resourceId:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the new bit: adding telemetryCollector.cloud.resourceId

@jjti jjti changed the title Add telemetryCollector.cloud.resourceId and comments Add telemetryCollector.cloud.resourceId field that works even when global.cloud.enabled is false Nov 16, 2023
@jjti jjti marked this pull request as ready for review November 16, 2023 16:47
@@ -689,8 +690,7 @@ global:
# @type: string
secretKey: null

# The name of the Kubernetes secret that holds the HCP cloud client id.
# This is optional when global.cloud.enabled is true.
# The hostname of HCP's API. This setting is used for internal testing and validation.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix

@@ -699,8 +699,7 @@ global:
# @type: string
secretKey: null

# The name of the Kubernetes secret that holds the HCP cloud authorization url.
# This is optional when global.cloud.enabled is true.
# The URL of HCP's auth API. This setting is used for internal testing and validation.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix

@@ -709,8 +708,7 @@ global:
# @type: string
secretKey: null

# The name of the Kubernetes secret that holds the HCP cloud scada address.
# This is optional when global.cloud.enabled is true.
# The address of HCP's scada service. This setting is used for internal testing and validation.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix

@@ -3491,7 +3488,7 @@ telemetryCollector:
customExporterConfig: null

service:
# This value defines additional annotations for the server service account. This should be formatted as a multi-line
# This value defines additional annotations for the telemetry-collector's service account. This should be formatted as a multi-line
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix

@@ -3538,9 +3575,9 @@ telemetryCollector:
# @type: string
priorityClassName: ""

# A list of extra environment variables to set within the stateful set.
# A list of extra environment variables to set within the deployment.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix

@curtbushko curtbushko self-requested a review November 17, 2023 21:32
Copy link
Contributor

@curtbushko curtbushko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Thanks for filling in all of values.yaml. That will help a bunch with the website.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/1.1.x Backport to release/1.1.x branch backport/1.2.x This release branch is no longer active. backport/1.3.x
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants