Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add HTTP/XFCCAuth endpoint in the scheduler component (#3437)
* Adds cf_Server config for scalingengine Adds xfcc cf endpoint support to scaling engine Remove debug println WIP wip Fix warning Initial implementation of CF ServeR Add .trunk to .gitignore for Devbox configuration. Add .trunk to .gitignore for Devbox configuration. * Refactor configuration keys and update tests for cfServer in scheduler component * Update CFServerConfiguration property prefix to camelCase * Refactor configuration property names and update scheduler YAML - Rename cfServer to cf-server in configuration properties - Add launch.json for VSCode Java debugging setup - Remove destroyMethod annotation from CFServerConfig bean - Update application.yml to reflect new property names for cf-server * Remove validOrgGuid validation and refactor property names in application.yml * Updated VSCode settings and added HTTP configuration for scheduler • Changed VSCode Java build configuration setting from automatic to interactive • Added new CFHTTPConfiguration class to configure additional Tomcat connector for HTTP on port 8090 • Set server port to 8083 and added HTTP port configuration in application.yml * WIP: Integration test for api - scheduler cf http server endpoint * Add gorouter CA and client certificate generation to test scripts; update gorouterproxy to handle TLS and XFCC header; extend testhelpers with localhost SANs in certs. * Refactor XFCCAuthMiddleware and improve error handling • Implement NewXfccAuthMiddleware constructor for initializing middleware • Add XFCCAuthenticationMiddleware method to handle authentication within middleware • Enhance checkAuth method to include XFCC header parsing and certificate validation • Introduce parseXFCCHeader utility method for extracting attributes from XFCC header • Add getSpaceGuid and getOrgGuid methods to extract GUIDs from certificate • Optimize mapFrom method for parsing organizational units from certificates * Refactor XFCC auth middleware and update gorouterproxy tests • Extract CheckAuth function from xfccAuthMiddleware for standalone use with org and space parameters. • Replace instance method calls with standalone function calls in auth checks. • Update gorouterproxy tests to use the new CheckAuth function and pass org and space GUIDs directly. • Remove debug logging from mapFrom function. * Remove cf_server.port configuration from scheduler spec * Exclude 'vendor' and 'integration' directories from binaries search in Makefile * Fix function parameter and update GoRouterProxy command arguments - Correct the missing type for the `portToForward` parameter in `GoRouterProxy` function. - Update command arguments to include `--port` and `--forwardTo` flags in `GoRouterProxy`. - Add `GoRouterProxy` port to the `PreparePorts` function. - Prefix a test with `FWhen` to focus on a specific scheduler test. * Add build-gorouterproxy target and update tests for gorouterproxy - Introduce a new Makefile target `build-gorouterproxy` to compile the gorouterproxy component. - Mark `testsuite` as a PHONY target in the Makefile. - Update gorouterproxy tests to check for the new startup log message. - Add TLS certificate and key file flags to gorouterproxy and update the main function to use provided paths if available. - Include additional configuration for the Golang API server in the integration tests. - Implement AfterEach cleanup for stopping the Golang API server and gorouterproxy in integration tests. - Add GoRouterProxy to the list of compiled executables in the integration suite setup. - Allocate a new port for GolangAPICFServer in the integration test suite. * Increase max_connections to 1000 for PostgreSQL in Makefile * Enhance Makefile to pass GINKGO_OPTS in test-autoscaler-suite and run Postgres container detached with corrected max_connections config * WIP: Add SchedulerCFServer component and refactor integration tests - Introduce SchedulerCFServer component to handle CF server connections - Update integration tests to use temporary directories and URLs - Remove CFHTTPConfiguration class and adjust application.yml for scheduler - Refactor integration test code for clarity and consistency * chore: remove self-hosted image input and add devbox installation steps * 🤖🦾🛠️ scripts/asdf2devbox.py * Add build-gorouterproxy target to Makefile and include in build-all target * chore(deps): update github/codeql-action digest to 17a820b (#3471) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update google.golang.org/genproto digest to 29210b9 (#3472) * chore(deps): update google.golang.org/genproto digest to 29210b9 * 🤖🦾🛠️ go mod tidy & make package-specs --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update ghcr.io/cloudfoundry/app-autoscaler-release-tools:main docker digest to a850ee8 (#3470) * chore(deps): update ghcr.io/cloudfoundry/app-autoscaler-release-tools:main docker digest to a850ee8 * trigger new ci run --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: geigerj0 <112163019+geigerj0@users.noreply.github.com> * Refactor Golang API server test configuration and remove hardcoded paths • Extract default API server configuration into defaultGolangAPITestConfig function • Remove hardcoded file paths for API info, schema validation, and service catalog • Simplify PrepareGolangApiServerConfig by using the new default config function • Clean up commented-out password hash code and other unused variables • Update configuration structure to match new defaults and remove unnecessary URI settings * Refactor Golang API server configuration and tests • Refactor defaultGolangAPITestConfig to DefaultGolangAPITestConfig and add dbURI parameter. • Include Port in Server and BrokerServer configurations within DefaultGolangAPITestConfig. • Add Db and MetricsForwarder configurations to DefaultGolangAPITestConfig. • Simplify PrepareGolangApiServerConfig by removing explicit port parameters and using DefaultGolangAPITestConfig. • Rename writeYmlConfig to WriteYmlConfig and update its usages across test files. • Update test setup functions to reflect changes in configuration functions. • Remove redundant port and metrics forwarder URL parameters from test configurations. * feat: replace` swagger-cli` with `redocly` for OpenAPI validation # Issue Redocly CLI is the recommended replacement for the deprecated swagger-cli package # Fix See https://redocly.com/docs/cli/guides/migrate-from-swagger-cli * Update GitHub Actions workflow and Devbox configuration for Java linting - Remove container usage from the code-style job in GitHub Actions workflow - Add steps to install Devbox and make its shell environment available - Resolve merge conflict in devbox.json by including google-java-format - Add google-java-format to devbox.lock with support for multiple architectures - Create new Makefile in src/scheduler for Java formatting and checking * Remove echo statement from check-format target in scheduler Makefile * Fix go linting * Fix more linting errors * Add scheduler's HTTP port configuration and update references in templates and specs * Update scheduler port descriptions in spec to distinguish between HTTPS and HTTP ports * Update GoRouterProxy command initialization and add cfserver config to scheduler template * Simplify Java CI lint workflow by using container and removing devbox setup * Update GitHub Actions and dependencies - Update devbox-install-action to v0.12.0 across workflows - Update CodeQL actions to latest version - Add devbox installation step to java-ci-lint workflow - Upgrade loggregator-agent-release and tlsconfig in go.mod - Bump chi, ginkgo, gomega, grpc, and grpc-gateway versions - Update indirect dependencies in go.sum * Add makefile start scheduler task * Small fix on gorouter proxy * Add .DS_Store to .gitignore to exclude macOS folder metadata files * Add removal of scheduler target directory in clean-scheduler make target * Uses ginkgo from devbox for autoscaler tasks * Update Makefile to include build-gorouterproxy in integration target * Refactor VCAP configuration reader to remove error handling • Simplify NewVCAPConfigurationReader by removing error return value • Update calls to NewVCAPConfigurationReader to handle the new function signature without error checking • Adjust error message in NewVCAPConfigurationReader to include the error details when failing to read VCAP environment variables * Add JSON encoding support and fix public API server config retrieval in autoscaler API config * Add Scheduler TLS configuration setup in API config loading * Refactors GetDbVcapServices into testhelpers for further reusage * Add JSON tags to api config structs and implement FromJSON function • Implement FromJSON function to unmarshal JSON into config structs • Add JSON tags to all configuration structs to support JSON serialization and deserialization • Modify ToJSON function to return an error if marshaling fails • Add tests for ToJSON and FromJSON functions to ensure proper JSON handling • Fix incorrect YAML tag in cf.Config for Secret field * Improve gorouterproxy tests and request forwarding - Update gorouterproxy tests to forward path from original request. - Enhance request forwarding in main.go to include the original request method, headers, and body. - Add error logging for forwarding failures and ensure the XFCC header is not empty before forwarding. * Adds working integration test for api-scheduler when running in cf container * Fix formating * Update credentials key in VCAP_SERVICES for publicapiserver-config in api_test. * Fix typo * Rename cf-server to cfserver in scheduler config and update specs accordingly * Add CFHTTPConfiguration class to configure additional HTTP connector for Tomcat in Cloud Foundry Autoscaler Scheduler * Remove commented code * Uses DBURL when creating stubed api json configuration * Remove .vscode/settings.json from scheduler module * Adds missing Remove All * Remove SynchronizedAfterSuite cleanup block from integration tests * Remove unused logging * Fix typo * Ensure error handling for JSON conversion in config_test.go * Add nosec annotation to suppress G204 warning in GoRouterProxy command execution * Rename CFHTTPConfiguration class to CfHttpConfiguration and update references * Remove check on non empty xfcc space and org in scheduler xfcc filter * Improve policy deletion and retrieval error handling in API tests * Remove default HTTP port from scheduler spec and handle zero port configuration in CfHttpConfiguration * Change logging order in scheduler xfcc filter * Enable test case for retrieving policy with expected 404 response * Fix sonarque issue in gorouter proxy test * Update fly package from 7.12.0 to 7.12.1 across multiple architectures * Fix flaky test * Fix scheduler template spec * Remove unused PostConstruct import from XfccFilter in scheduler module * Remove httpcore dependency from scheduler module's pom.xml * Update credhub-cli from 2.9.29 to 2.9.42 and specify version for temurin-bin-21 * Improves scheduler cf_server property structure * review-commits * scheduler-> add unit tests for filtering logic * Removes cf configutil from helper logger - bubble up the errors to consumers of the cf config util. * Remove redundant devbox dependencies * Remove build-gorouterproxy from build-all target in Makefile * Fix java format * Amends Abbreviation in java class name classes must contain no more than '1' consecutive capital letters. * Update devbox lock * Update devbox.lock Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Remove unused dependencies from eventgenerator, operator, and scalingengine specs - Deleted autoscaler/configutil/* from eventgenerator, operator, and scalingengine - Removed autoscaler/vendor/github.com/cloud-gov/go-cfenv/* from eventgenerator and operator - Eliminated autoscaler/vendor/github.com/mitchellh/mapstructure/* from eventgenerator and scalingengine * Fix missing quote in json tag for TLSClientCerts in ScalingEngineConfig * Fix tabulation --------- Co-authored-by: app-autoscaler-ci-bot <ApplicationAutoscaler@sap.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: geigerj0 <112163019+geigerj0@users.noreply.github.com> Co-authored-by: Silvestre Zabala <silvestre.zabala@sap.com> Co-authored-by: Arsalan Khan <muhammad.arsalan.khan@sap.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
- Loading branch information