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 events for HVS client failures #960

Merged
merged 3 commits into from
Nov 5, 2024

Conversation

hashiblaum
Copy link
Member

@hashiblaum hashiblaum commented Oct 31, 2024

This change adds events for HVS client errors emitted by the controller for the HCPVaultSecretsApp resource. Incorrect configuration of the customer resources.

HVSClientConfigError will emit if the hvs client cannot be created, which is due to misconfiguration of HCP CRDs.

HVSStaticSecretError or HVSDynamicSecretError will emit if an error is returned when trying to retrieve a secret from the HVS API, returning the error from the HVS client.

Example Events:

Events:
  Type     Reason           Age                  From                Message
  ----     ------           ----                 ----                -------
  Warning  HVSClientConfigError  9m56s (x3 over 11m)  HCPVaultSecretsApp  Failed to instantiate HVS client: failed to get HCPAuth, err=HCPAuth.secrets.hashicorp.com "hcp-auth" not found
  Warning  HVSSecretError  98s (x7 over 3m26s)  HCPVaultSecretsApp  Failed to get HVS App secrets: Get "https://api.cloud.hashicorp.com:443/secrets/2023-11-28/organizations/b66e6a7a-cd75-4f79-bb2f-faa7397fd507/projects/8d9701fc-9712-4d00-8ccb-c81548d51e17/apps/vso-app2/secrets:open?types=kv&types=rotating": failed to get new token: oauth2: "unauthorized" "Authentication failed."
  Warning  HVSSecretError  16s                  HCPVaultSecretsApp  Failed to get HVS App secrets: [GET /secrets/2023-11-28/organizations/{organization_id}/projects/{project_id}/apps/{app_name}/secrets:open][403] OpenAppSecrets default  &{Code:7 Details:[] Message:}

https://hashicorp.atlassian.net/browse/VAULT-30074

@hashiblaum hashiblaum marked this pull request as ready for review October 31, 2024 16:37
@hashiblaum hashiblaum requested a review from a team as a code owner October 31, 2024 16:37
@hashiblaum hashiblaum force-pushed the VAULT-30074/hvs-client-event-errors branch from 5725e4c to 0d4a15e Compare October 31, 2024 17:26
Copy link
Member

@tvoran tvoran left a comment

Choose a reason for hiding this comment

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

This is looking good! Just some thoughts around naming.

consts/reasons.go Outdated Show resolved Hide resolved
controllers/hcpvaultsecretsapp_controller.go Outdated Show resolved Hide resolved
controllers/hcpvaultsecretsapp_controller.go Outdated Show resolved Hide resolved
Copy link
Member

@tvoran tvoran left a comment

Choose a reason for hiding this comment

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

👍

Also feel free to add this to the v0.10.0 milestone when merging.

@hashiblaum hashiblaum added this to the v0.10.0 milestone Nov 5, 2024
@hashiblaum hashiblaum merged commit 1273434 into main Nov 5, 2024
43 checks passed
@hashiblaum hashiblaum deleted the VAULT-30074/hvs-client-event-errors branch November 5, 2024 16:17
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

Successfully merging this pull request may close these issues.

2 participants