Skip to content

feat: solve secrets on config and backends setup data #93

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

Merged
merged 2 commits into from
Apr 9, 2025

Conversation

leoparente
Copy link
Contributor

This pull request includes several changes to the agent package, focusing on refactoring, adding new functionality for environment variable resolution, and updating tests. The most important changes include modifying the startBackends method to accept additional parameters, adding new functions to resolve environment variables, and updating the configuration manager to use these new functions.

Refactoring and Enhancements:

  • agent/agent.go: Modified the startBackends method to accept cfgBackends and labels as parameters instead of using a.config.OrbAgent.Backends and a.config.OrbAgent.Labels directly. Also, updated the Start method to solve configuration secrets before starting backends. [1] [2] [3]

Environment Variable Resolution:

  • agent/config/env.go: Added new functions ResolveEnv, ResolveEnvInMap, and ResolveEnvInSlice to handle environment variable resolution within strings, maps, and slices.
  • agent/config/config_test.go: Added comprehensive tests for the new environment variable resolution functions.

Configuration Manager Updates:

  • agent/configmgr/git.go: Updated the Git configuration manager to use the new config.ResolveEnv function for resolving environment variables. Removed the old resolveEnv function. [1] [2] [3]
  • agent/configmgr/manager.go: Modified the New function to accept an active string parameter instead of a config.ManagerConfig object.

Test Updates:

  • agent/agent_prof_test.go: Removed the Test_orbAgent_startBackends test as it was outdated and not providing value.
  • agent/configmgr/git_test.go, agent/configmgr/local_test.go, agent/configmgr/manager_test.go: Updated tests to reflect changes in the configuration manager initialization and environment variable resolution. [1] [2] [3] [4] [5] [6] [7] [8]

Policy Manager Updates:

@leoparente leoparente self-assigned this Apr 8, 2025
Copy link

github-actions bot commented Apr 8, 2025

Go test coverage

STATUS ELAPSED PACKAGE COVER PASS FAIL SKIP
🟢 PASS 0.01s github.com/netboxlabs/orb-agent/agent 0.0% 0 0 0
🟢 PASS 0.01s github.com/netboxlabs/orb-agent/agent/backend 0.0% 0 0 0
🟢 PASS 4.03s github.com/netboxlabs/orb-agent/agent/backend/devicediscovery 77.7% 2 0 0
🟢 PASS 0.01s github.com/netboxlabs/orb-agent/agent/backend/mocks 0.0% 0 0 0
🟢 PASS 4.02s github.com/netboxlabs/orb-agent/agent/backend/networkdiscovery 77.5% 2 0 0
🟢 PASS 4.02s github.com/netboxlabs/orb-agent/agent/backend/otel 76.4% 2 0 0
🟢 PASS 3.02s github.com/netboxlabs/orb-agent/agent/backend/pktvisor 67.8% 2 0 0
🟢 PASS 4.03s github.com/netboxlabs/orb-agent/agent/backend/worker 76.9% 2 0 0
🟢 PASS 1.01s github.com/netboxlabs/orb-agent/agent/config 100.0% 6 0 0
🟢 PASS 1.05s github.com/netboxlabs/orb-agent/agent/configmgr 49.4% 9 0 0
🟢 PASS 1.01s github.com/netboxlabs/orb-agent/agent/policies 100.0% 15 0 0
🟢 PASS 1.02s github.com/netboxlabs/orb-agent/agent/policymgr 70.3% 10 0 0
🟢 PASS 2.49s github.com/netboxlabs/orb-agent/agent/secretsmgr 45.7% 45 0 0
🟢 PASS 1.01s github.com/netboxlabs/orb-agent/agent/version 100.0% 1 0 0

Total coverage: 60.3%

@leoparente leoparente merged commit 13f0c67 into develop Apr 9, 2025
5 checks passed
@leoparente leoparente deleted the feat/secretsmgr-solve-config-secrets branch April 9, 2025 12:57
Copy link

🎉 This PR is included in version 2.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants