-
Notifications
You must be signed in to change notification settings - Fork 5
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
CNS-2791: Add a remote configurator that pulls changes from CB Console and applies them to the CR #184
Conversation
Release/6.0.1
Adding ccs to charts
…parate helper function to make testing easier
… context in the UI
…d (so it is not ON by default when testing)
"testing" | ||
) | ||
|
||
func TestFeatureTogglesAreAppliedCorrectly(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this test tried to save code by wrapping the tests with appliedChangeTest
, iterating them and run them, but since the actual test is only:
remote_configuration.ApplyConfigChangeToCR(testCase.change, &testCase.initialCR)
testCase.assertFinalCR(t, testCase.initialCR)
I think this wrapping and "code saving" didn't save a lot of code, but did made the test more messy and harder to read and understand.
I think simple 4 t.Run tests with the 4 test cases will be clearer and probably will resolve with close code lines
…e and applies them to the CR (#184) * Update README.md * Update README.md * Fix charts for main to be idetical to latest release v6.0.1 * Update README.md * Adding labels field to charts * Adding company code secret template to charts * Adding company code secret template to charts fix * Add documentation for secrets with helm * config applier skeleton * More work on the configuration applier loop. * Happy path test for config_applier * Pass context to API functions as they'll do IO * More tests * Send Failed status to backend when failing to list or update CR * Treat missing CR when a change is pending as error * Move "scheduling" logic to a separate struct for config applier * Use a DummyAPI implementation * Small refactoring * Add test for feature toggles * Add tests for the version field. Split the modification logic in a separate helper function to make testing easier * Sort the change slice in case there are multiple pending changes * Clearing TODOs, small fixes * Removing more TODOs * Turn off configurator by default and use env var to enable * Renaming things * Refactor tests a bit and remove more TODOs * Change the configurator to read the CR first , so it can extract the cluster name * Validate change against sensor capabilities * Validate operator and agent version compatibility * Tests for positive validation path * Bring the Validate and Apply change funcs under 1 struct and validate before applying * Adding change validation to the configuration * Change validator interface and add fetcher to download metadata from the API * Add auth_provider and adjust test to match * Create AccessTokenProvider in main.go * Extract the ApiGateway from processors.* and use it in configurator as well. * Go back to the previous version as it looked simpler * Fixing some tests and main.go * Change the agent_processor tests to match the new func. Remove a test that was not deterministic * Add clusterIdentifier parameter to GetConfigurationChanges * Add clusterID to the status update model call * Add secret detection to the changer * Add secret detection to the validation * Minor TODOs * Some missing test cases for validation * More minor changes * Add sensor metadata implementation. Add dummy config changes implementation. * Move data classes around * Removing TODOs * Change the feature toggle to be part of the CR * Change errors to have system info and user info for debugging vs user context in the UI * Small refactor * Change dummy struct to just a func * Bump timeout a bit * Remove controller_test.go * Add back the env var during development until the feature is completed (so it is not ON by default when testing) * Add remote_configuration to docker build * Fix not wrapped error * Fix missing generate run * Fix sensors path and response * Increase iteration sleep time * Fix helm indentation * Change the version reset to be more readable * Move the remote_configuration under cbcontainers and controllers * Added godoc --------- Co-authored-by: BenRub <[email protected]> Co-authored-by: benrub <[email protected]>
…e and applies them to the CR (#184) * Update README.md * Update README.md * Fix charts for main to be idetical to latest release v6.0.1 * Update README.md * Adding labels field to charts * Adding company code secret template to charts * Adding company code secret template to charts fix * Add documentation for secrets with helm * config applier skeleton * More work on the configuration applier loop. * Happy path test for config_applier * Pass context to API functions as they'll do IO * More tests * Send Failed status to backend when failing to list or update CR * Treat missing CR when a change is pending as error * Move "scheduling" logic to a separate struct for config applier * Use a DummyAPI implementation * Small refactoring * Add test for feature toggles * Add tests for the version field. Split the modification logic in a separate helper function to make testing easier * Sort the change slice in case there are multiple pending changes * Clearing TODOs, small fixes * Removing more TODOs * Turn off configurator by default and use env var to enable * Renaming things * Refactor tests a bit and remove more TODOs * Change the configurator to read the CR first , so it can extract the cluster name * Validate change against sensor capabilities * Validate operator and agent version compatibility * Tests for positive validation path * Bring the Validate and Apply change funcs under 1 struct and validate before applying * Adding change validation to the configuration * Change validator interface and add fetcher to download metadata from the API * Add auth_provider and adjust test to match * Create AccessTokenProvider in main.go * Extract the ApiGateway from processors.* and use it in configurator as well. * Go back to the previous version as it looked simpler * Fixing some tests and main.go * Change the agent_processor tests to match the new func. Remove a test that was not deterministic * Add clusterIdentifier parameter to GetConfigurationChanges * Add clusterID to the status update model call * Add secret detection to the changer * Add secret detection to the validation * Minor TODOs * Some missing test cases for validation * More minor changes * Add sensor metadata implementation. Add dummy config changes implementation. * Move data classes around * Removing TODOs * Change the feature toggle to be part of the CR * Change errors to have system info and user info for debugging vs user context in the UI * Small refactor * Change dummy struct to just a func * Bump timeout a bit * Remove controller_test.go * Add back the env var during development until the feature is completed (so it is not ON by default when testing) * Add remote_configuration to docker build * Fix not wrapped error * Fix missing generate run * Fix sensors path and response * Increase iteration sleep time * Fix helm indentation * Change the version reset to be more readable * Move the remote_configuration under cbcontainers and controllers * Added godoc --------- Co-authored-by: BenRub <[email protected]> Co-authored-by: benrub <[email protected]>
…e and applies them to the CR (#184) * Update README.md * Update README.md * Fix charts for main to be idetical to latest release v6.0.1 * Update README.md * Adding labels field to charts * Adding company code secret template to charts * Adding company code secret template to charts fix * Add documentation for secrets with helm * config applier skeleton * More work on the configuration applier loop. * Happy path test for config_applier * Pass context to API functions as they'll do IO * More tests * Send Failed status to backend when failing to list or update CR * Treat missing CR when a change is pending as error * Move "scheduling" logic to a separate struct for config applier * Use a DummyAPI implementation * Small refactoring * Add test for feature toggles * Add tests for the version field. Split the modification logic in a separate helper function to make testing easier * Sort the change slice in case there are multiple pending changes * Clearing TODOs, small fixes * Removing more TODOs * Turn off configurator by default and use env var to enable * Renaming things * Refactor tests a bit and remove more TODOs * Change the configurator to read the CR first , so it can extract the cluster name * Validate change against sensor capabilities * Validate operator and agent version compatibility * Tests for positive validation path * Bring the Validate and Apply change funcs under 1 struct and validate before applying * Adding change validation to the configuration * Change validator interface and add fetcher to download metadata from the API * Add auth_provider and adjust test to match * Create AccessTokenProvider in main.go * Extract the ApiGateway from processors.* and use it in configurator as well. * Go back to the previous version as it looked simpler * Fixing some tests and main.go * Change the agent_processor tests to match the new func. Remove a test that was not deterministic * Add clusterIdentifier parameter to GetConfigurationChanges * Add clusterID to the status update model call * Add secret detection to the changer * Add secret detection to the validation * Minor TODOs * Some missing test cases for validation * More minor changes * Add sensor metadata implementation. Add dummy config changes implementation. * Move data classes around * Removing TODOs * Change the feature toggle to be part of the CR * Change errors to have system info and user info for debugging vs user context in the UI * Small refactor * Change dummy struct to just a func * Bump timeout a bit * Remove controller_test.go * Add back the env var during development until the feature is completed (so it is not ON by default when testing) * Add remote_configuration to docker build * Fix not wrapped error * Fix missing generate run * Fix sensors path and response * Increase iteration sleep time * Fix helm indentation * Change the version reset to be more readable * Move the remote_configuration under cbcontainers and controllers * Added godoc --------- Co-authored-by: BenRub <[email protected]> Co-authored-by: benrub <[email protected]>
This MR adds a secondary "loop" within the operator, in addition to the main one that is responsible to maintain the agent.
Structure:
The major changes are under
remote_configuration
package so I'd recommend starting the review from there and goingController->Configurator->Change_applier
.Other changes:
Separate MR will handle: