Skip to content

(feature): Enable eventgenerator in mtar deployment #3638

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 152 commits into from
May 28, 2025

Conversation

bonzofenix
Copy link
Contributor

@bonzofenix bonzofenix commented Mar 14, 2025

This pull request includes several changes to the autoscaler project, focusing on improving deployment configurations, scripts, and server configurations. The most important changes involve adding a new UAA login script, modifying deployment-related environment variables, and updating server configurations to use more descriptive names.

Deployment and Login Improvements:

  • Added uaa-login target to Makefile to facilitate UAA login. (Makefile)
  • Introduced a new uaa-login.sh script to handle UAA login. (ci/autoscaler/scripts/uaa-login.sh)
  • Updated cf-login.sh to use ${DEPLOYMENT_NAME} instead of ${PR_NUMBER} for the autoscaling API URL. (ci/autoscaler/scripts/cf-login.sh)

Environment Variable Management:

  • Added ENABLE_MTAR environment variable and logic to set DEPLOYMENT_NAME based on its value. (ci/autoscaler/scripts/vars.source.sh) [1] [2]
  • Updated build-extension-file.sh to include new environment variables for event generator and metrics forwarder. (src/autoscaler/build-extension-file.sh) [1] [2] [3]

Server Configuration Updates:

  • Renamed VCAPServer to CFServer in multiple files for better clarity. (src/autoscaler/api/config/config.go, src/autoscaler/api/config/config_test.go, src/autoscaler/api/publicapiserver/public_api_server.go, src/autoscaler/api/publicapiserver/publicapiserver_suite_test.go) [1] [2] [3] [4] [5]
  • Updated broker_server to use HealthPath instead of BrokerHealthPath for health checks. (src/autoscaler/api/brokerserver/broker_server.go)

Miscellaneous Changes:

  • Suppressed output for cf target commands in common.sh to reduce log noise. (ci/autoscaler/scripts/common.sh) [1] [2]
  • Removed outdated configurations and paths from configure-cf-services.yml and use-cf-services.yml. (operations/configure-cf-services.yml, operations/use-cf-services.yml) [1] [2]

bonzofenix and others added 9 commits March 13, 2025 16:04
 • Centralize database configuration logic into db.ConfigureDb and db.ConfigureStoredProcedureDb
 • Remove individual configurePolicyDb and configureBindingDb functions
 • Move DatabaseConfig struct to a new models.go file in the db package
 • Update calls to database configuration in both API and metrics forwarder to use the new centralized functions
 • Change db.ConfigureDb calls to vcapReader.ConfigureDb for PolicyDb and BindingDb.
 • Introduce vcapReader.ConfigureStoredProcedureDb for handling stored procedure database configuration.
 • Remove ConfigureStoredProcedureDb and ConfigureDb from db/helper.go.
 • Update tests to reflect changes in database configuration methods.
 - Import the "time" package in db.go for time.Duration usage.
 - Introduce DatabaseConfig struct in db.go with connection parameters.
 - Delete models.go, moving DatabaseConfig to db.go.
 • Implement configuration loading for stored procedure database in config.go
 • Enable tests for stored procedure database when cred_helper_impl is set to default in config_test.go
…ting

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…tgenerator module with configuration and routes, and set default instances to 0 for new modules in autoscaler app.
@bonzofenix bonzofenix changed the title feature: Enable eventgenerator in mtar deployment (feature): Enable eventgenerator in mtar deployment Mar 17, 2025
@bonzofenix bonzofenix force-pushed the 864-enable-eventgenerator-via-mtar branch from 41ec81e to 6c5b7c7 Compare March 17, 2025 10:58
… eventgenerator

 • Refactor LoadConfig to read from file and VCAP services
 • Add error variables for configuration loading issues
 • Introduce loadYamlFile and loadVcapConfig helper functions
 • Update tests with new configuration loading logic and VCAP reader mocks
 • Remove unused imports and adjust defaultConfig function signature
@bonzofenix bonzofenix force-pushed the 864-enable-eventgenerator-via-mtar branch from 6c5b7c7 to 792c984 Compare March 17, 2025 11:18
 - Correct grammar in test descriptions for database configuration calls.
 - Change cred_helper_impl to 'stored_procedure' for storedProcedure_db service.
 - Remove redundant storedProcedureConfig and read directly from VCAP services.
 - Remove outdated tests related to default cred_helper_impl for storedProcedure_db.
… eventgenerator

 • Refactor LoadConfig to read from file and VCAP services
 • Add error variables for configuration loading issues
 • Introduce loadYamlFile and loadVcapConfig helper functions
 • Update tests with new configuration loading logic and VCAP reader mocks
 • Remove unused imports and adjust defaultConfig function signature
…enerator config

 • Implement ConfigureDb method in VCAPConfiguration to set database URL
 • Use ConfigureDb to configure PolicyDb and AppMetricsDb in eventgenerator
 • Add AppMetricsDb constant to db package
 • Update tests to reflect changes in database configuration methods
…ventgenerator

 • Update DBConfig and DatabaseConfig struct references to use pointers in eventgenerator_suite_test.go and main.go.
 • Change struct field names from DB to Db and PolicyDB to PolicyDb, AppMetricDB to AppMetricDb to align with Go naming conventions.
@bonzofenix bonzofenix force-pushed the 864-enable-eventgenerator-via-mtar branch from ba2457c to 4489e00 Compare March 18, 2025 13:48
 - Update eventgenerator configuration to use pointers for optional structs and add JSON tags
 - Modify eventgenerator test suite to handle CF environment variables and dynamically set config
 - Adjust eventgenerator main.go to load and validate config with VCAP services support
 - Implement ToJSON method in config.go for marshaling configuration to JSON
 - Change environment variable keys in mta.tpl.yaml to uppercase and use placeholders for Go version
@bonzofenix bonzofenix force-pushed the 864-enable-eventgenerator-via-mtar branch from 63e2b63 to 1b9ab3a Compare March 19, 2025 11:45
 • Introduce eventgenerator_health_password in build-extension-file.sh for event generator health checks.
 • Add eventgenerator-config resource with basic auth password in mta.tpl.yaml.
 • Implement configureMetricsCollectorTLS function in eventgenerator/config/config.go to load TLS configuration for the metrics collector from logcache-client.
 • Update eventgenerator unit tests to reflect new TLS configuration loading.
 • Remove scaling engine and metric collector TLS configs from default_config.json, streamline cf_server and db configurations.
 • Add logcache-client as a user-provided service in mta.tpl.yaml.
bonzofenix added 2 commits May 9, 2025 10:02
…nd When blocks

 - Replace Context blocks with When for better readability
 - Utilize HaveExactKeys custom matcher to simplify policy retrieval assertions
 - Remove redundant clock increment and policy existence checks
@bonzofenix bonzofenix force-pushed the 864-enable-eventgenerator-via-mtar branch from a472064 to 2267a64 Compare May 9, 2025 08:47
bonzofenix and others added 21 commits May 9, 2025 11:21
 • Remove ToJSON method from Config structs in api and eventgenerator modules
 • Add generic ToJSON function in configutil module to handle JSON marshaling
 • Update tests and usages to call configutil.ToJSON instead of Config's ToJSON
 • Remove redundant tests for ToJSON in api/config after refactoring
…ture

 • Replace interface{} with any in VCAP_SERVICES map
 • Remove redundant logcache-client TODO comment
 • Move YAML file loading to helpers.LoadYamlFile
 • Remove unused os import from config.go
We should reframe from adding complexity/tests to the cmd and relay on
integration and acceptance instead.
main.go should have as less logic as possible.
 - Modify deployment script to adjust the order of operations files
 - Extend configure-cf-services.yml to enable CF server communication for eventgenerator and add route registration details
Copy link

@bonzofenix bonzofenix merged commit 3673a92 into main May 28, 2025
35 checks passed
@bonzofenix bonzofenix deleted the 864-enable-eventgenerator-via-mtar branch May 28, 2025 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deploy-to-cf it tells that the PRs are related to deploy to cf migration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants