Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Type:
Refactoring
PR Description:
This PR refactors the cloud provider discovery logic in the Kollector application. The cloud provider was previously taken from the config, but this has been removed in recent versions. Instead, the cloud provider is now set once in a global variable upon initialization. The main changes include:
PR Main Files Walkthrough:
files:
watch/cloudprovider.go
: Added a new function 'setCloudProvider' that fetches the list of nodes and sets the global 'cloudProvider' variable.watch/globals.go
: Added a new global variable 'cloudProvider'.watch/jsonformat.go
: Replaced 'config.ClusterProvider' with the global variable 'cloudProvider' in the 'setInstallationData' function.watch/jsonformat_test.go
: Adjusted the tests to use the global 'cloudProvider' variable instead of 'config.ClusterProvider'.watch/watchhandler.go
: Added error handling for setting the cloud provider during the creation of the watch handler.go.mod
: Added a new dependency 'github.com/aws/aws-sdk-go'.go.sum
: Updated the project dependencies.User Description:
Kollector was taking the cloud provider from config (which was set in the Kubescape operator helm chart) but it was removed in recent versions.
Instead, we will set it once in a global var upon initialization.