Skip to content

Conversation

@blakerouse
Copy link
Contributor

@blakerouse blakerouse commented Nov 5, 2025

What does this PR do?

Currently the filesource provider does not handle watching the correct paths because of how Kubernetes handles mounting sercrets into a container.

Adds a unit test to validate the filesource provider works with secret replacement from Kubernetes.

Why is it important?

Ensures that secret replacement changes are noticed by the filesource provider.

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

None

How to test this PR locally

mage unitTest

Related issues

@blakerouse blakerouse self-assigned this Nov 5, 2025
@blakerouse blakerouse requested a review from a team as a code owner November 5, 2025 20:14
@blakerouse blakerouse added the Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team label Nov 5, 2025
@elasticmachine
Copy link
Collaborator

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

@mergify
Copy link
Contributor

mergify bot commented Nov 5, 2025

This pull request does not have a backport label. Could you fix it @blakerouse? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-./d./d is the label that automatically backports to the 8./d branch. /d is the digit
  • backport-active-all is the label that automatically backports to all active branches.
  • backport-active-8 is the label that automatically backports to all active minor branches for the 8 major.
  • backport-active-9 is the label that automatically backports to all active minor branches for the 9 major.

@blakerouse blakerouse changed the title Add a unit tests to validate kubernetes symlink behavior works with the filesource provider Fix filesource provider with kubernetes symlink Nov 6, 2025
@blakerouse blakerouse added the backport-active-all Automated backport with mergify to all the active branches label Nov 6, 2025
@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

cc @blakerouse

Comment on lines +365 to +366
finalTarget := filepath.Join(targetDir, targetBase)
_, err = os.Readlink(finalTarget)
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't this just target?

Suggested change
finalTarget := filepath.Join(targetDir, targetBase)
_, err = os.Readlink(finalTarget)
_, err = os.Readlink(target)

Copy link
Contributor

@ycombinator ycombinator left a comment

Choose a reason for hiding this comment

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

Just a nitpick. Code LGTM — thanks for all the comments and the unit test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-active-all Automated backport with mergify to all the active branches 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.

filesource provider does re-read kubernetes mounted secrets

3 participants