Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(eventgenerator): Integrate cf api with event generator (#3357)
* Adds cf_Server config for scalingengine * Adds xfcc cf endpoint support to scaling engine * Remove debug println * Update jobs/scalingengine/spec Co-authored-by: Silvestre Zabala <[email protected]> * Update jobs/scalingengine/spec Co-authored-by: Silvestre Zabala <[email protected]> * Remove pending test * Removes subrouter in api server * WIP * Fix issue with routes * Remove EventgeneratorServer interface from server.go * Adds xfcc cf endpoint support to scaling engine * WIP * Wip2 * Refactor routes * Refactor X-Forwarded-Client-Cert header handling and update tests • Remove direct sha256 usage in PublicApiHandler and replace with new auth.Cert abstraction. • Add auth.NewCert and auth.Cert.GetXFCCHeader to manage certificate encoding and header creation. • Update PublicApiHandler and tests to use the new auth.Cert methods for setting the X-Forwarded-Client-Cert header. • Adjust testhelpers.GenerateClientCert and testhelpers.SetXFCCCertHeader to align with new certificate handling logic. * Fix test * wip fix test * Enable generate-fakes target for integration tests in Makefile * Fix wrong merge conflict on public api handler * Fix regular expression to parse organization unit * Fix lint * Fix integration tests * Remove logging * Remove unused reflect import and delete redundant nil check in DetachScalingPolicy function. * Add GinkgoHelper call to ApiRunner's Start method in api_suite_test. * Refactor CF instance certificate handling to support TLS - handle CF_INSTANCE_CERT and CF_INSTANCE_KEY - Remove `CfInstanceCert` from `Config` struct and related code - Generate RSA keys and certificates for testing in `api_test.go` and `config_test.go` - Set environment variables for instance keys and certs in tests - Update `config#configureEventGenerator` to use environment variables for TLS config - Remove unused `auth` import and related code in `public_api_handler.go` - Create `MaterializeContentInFile` function in `configutil` for file operations - Add `GenerateClientCertWithPrivateKey` and `GenerateClientKeyWithPrivateKey` in `testhelpers` * Fix lints * Remove redundant comments about policy and schedule synchronization in PublicApiHandler * Remove unused certificate pool setup code from config.go in autoscaler/api * Remove CF_INSTANCE_CERT handling from VCAPConfiguration • Eliminate GetCfInstanceCert method and associated environment variable usage. • Update tests to reflect removal of CF_INSTANCE_CERT handling. * Remove redundant code and TODO comment in resetDefaultPolicy function * Remove auth helpers from golang API server package spec * Reads CF_INSTANCE_CERT and KEY from filepath - Make `generate-fakes` target `.PHONY` in Makefile - Remove dependency of `generate-fakes` from `testsuite` target - Simplify `configureEventGenerator` function by directly setting `CertFile` and `KeyFile` from environment variables - Update tests to reflect changes in `configureEventGenerator` and remove unnecessary file creation for `CF_INSTANCE_CERT` and `CF_INSTANCE_KEY` * Adds initial implementation of TLSReloadTransport * Reduce load of parsing the certificate on every request to check cert expiration date * Refactor * Refactor TLSReloadTransport to use non-pointer time.Time for cert expiration • Changed certExpiration from a pointer to a non-pointer time.Time type. • Updated GetCertExpiration and certificateExpiringWithin methods to handle the non-pointer type. • Removed unnecessary pointer dereferences in httpclient_test.go. * Simplify test * 🤖🦾🛠️ go mod tidy & make package-specs * Fix broken tests when tls config not defined in httpclinet * Fix api/cmd test to support CF_INSTANCE_CERT * fix linters --------- Co-authored-by: Silvestre Zabala <[email protected]>
- Loading branch information