Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[8.18](backport #6841) [k8s] improve kubernetes_secrets provider secret logging #7007

Open
wants to merge 1 commit into
base: 8.18
Choose a base branch
from

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Feb 25, 2025

What does this PR do?

This PR enhances the logging of the kubernetes_secrets provider to improve visibility into secret updates and cache operations. The changes include:

  • Improving cache update logging to specify which secrets were updated or expired.
  • Enhancing error messages to clarify failures in secret retrieval.
  • Updating the function fetchFromAPI to return the resource version of a secret.
  • Adding unit tests for fetchFromAPI to validate secret retrieval behavior.

Why is it important?

Previously, the kubernetes_secrets provider had minimal logging, making it difficult to determine when secrets were updated, expired, or failed to refresh. This lack of visibility led to troubleshooting challenges, especially in cases where secrets did not rotate as expected. With these improvements, users can now track secret updates more effectively without exposing sensitive values.

Checklist

  • I have read and understood the pull request guidelines of this project.
  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in ./changelog/fragments using the changelog tool
  • I have added an integration test or an E2E test

Disruptive User Impact

This change does not alter the core functionality of the kubernetes_secrets provider but improves logging. Users should see more detailed logs related to secret updates, which can be useful for debugging. There are no breaking changes expected.

How to test this PR locally

Run the kubernetes_secrets provider unit-tests

Related issues


This is an automatic backport of pull request #6841 done by [Mergify](https://mergify.com).

* feat: improve kubernetes_secrets provider secret logging

* feat: improve readability by replacing Info with Infof

* fix: categorise properly the type of change

* feat: more logging readability improvements

* feat: improve readability by replacing "%s" with %q

(cherry picked from commit 0ae5d35)
@mergify mergify bot requested a review from a team as a code owner February 25, 2025 12:05
@mergify mergify bot added the backport label Feb 25, 2025
@mergify mergify bot requested review from michel-laterman and swiatekm and removed request for a team February 25, 2025 12:05
@github-actions github-actions bot added the Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team label Feb 25, 2025
@elasticmachine
Copy link
Contributor

Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane)

@elasticmachine
Copy link
Contributor

💔 Build Failed

Failed CI Steps

cc @pkoutsovasilis

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
backport Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants