Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Separate image URLs into production and development * Add parameter to settings for image URL and policy * Remove Python application emulator * Target Go 1.20 and upgrade all packages This shouldn't change anything since k8s.io/apimachinery already requires Go 1.20 * Move the application model into a separate directory * Add placeholder Go emulator * Move Dockerfile to the repo root This is necessary because the emulator needs to access both emulator/ and model/ * Read config in emulator (test) * Set GOMAXPROCS to the number of processes in configmap * Shebang should always be on the first line * Add script to redeploy emulator in dev environment * Move HTTP server into goroutine * Use encoding/json instead of sending string * Add notFoundHandler * Add endpointHandler * Clean up emulator code * Add testing config map for running emulator outside of K8s * Change JSON response to better match old Python emulator * Use struct instead of creating functions * Export response structs * Add CPU stressor * Move CPU time function into util * Add basic logging for endpoint calls * Add ExecParallel for stressors * Read SERVICE_NAME from env * Remove unused istio.go and redis.go * Use Go workspace to separate modules * Add CPU task response * Add network task function * Refactor stressors to use interface * Indent JSON response * Forward the HTTP request to NetworkTask * Propagate headers from inbound to outbound * Move payload generation into separate function * Format time when logging * Add a restful.POST function for forwarding requests * Restructure code to avoid import cycles * Change called service port type to int * Add function for forwarding requests to endpoints * Set the slice capacity on init * Call other endpoints in NetworkTask * Combine network responses I don't like this code... * Omit port if zero This seems to match what Python does * Simplify code for network complexity * Fix for NetworkTask == nil * Don't append services and statuses twice * Format status properly * Fix duplicated service name in network complexity * Embed task responses in RESTResponse * Add ForwardParallel function * Move threads parameter into CPU complexity * Support CPU stressor on multiple goroutines * Rename response.go to api.go Since it contains requests now * Log CPU tasks if logging=true * Move documentation from wiki into repo * Move documentation from wiki into repo * Worker image should not be built in model/ anymore * Worker image should not be built in model/ anymore * Add logging for network tasks * Also remove threads from model.Service * Remove the workaround for null network complexity In Go, a nil slice is an empty slice, so it works without panicking * Ensure CPU complexity uses at least one thread in generator * Allow processes = 0 in service * Panic if input contains unknown fields * Show protocol in network task log * Set execution mode and forward requests in validation.go * Update simple example to work with the new emulator * Generate a new complex example * Log configuration on startup * Add documentation for adding a new stressor * Add stressor documentation to generator-parameters.md * Fix issue with execution time rounding * Remove lock_threads from cpu complexity It always needs to be on or the stressor doesn't work properly * Fix image link in complex example * Add comment to clarify that HTTP server should always be running * Launch gRPC server on demand * Convert requests and responses to protobufs gRPC works with protobufs so this makes it easier to share types between the HTTP and gRPC server * Move protobuf structs to generated package * Add a generated placeholder gRPC service to the repo * Set AllowPartial to true Should be faster * Unconditionally use HTTP server as readiness probe * Compile the service at runtime This is necessary once gRPC support is added * Set run.sh executable bit * Clean caches after build * More edits to try to save space * Add placeholder file for registering services * Remove status from response HTTP provides 200 OK, 404 Not Found, etc and gRPC provides OK, INVALID_ARGUMENT, etc * Start gRPC server * Update stressors.md for new API * Start generating emulator code * Add function for converting K8s name to Go name * Use goname to generate service.go * Add logging to stressors.md * Generate gRPC code in run.sh * Implement gRPC health service * Generate service name when Check is called This is faster since we only have one service anyway * Do not update modules in run.sh The emulator is supposed to use the modules in the base image * Download protoc in run.sh * Fix protoc not finding packages * Use goname in service.tmpl * Fix segfault in generator * Fix go build not working * Expose gRPC on port 81 * Add function CallGeneratedEndpoint * Enable gRPC reflection service For grpcurl, etc * Only generate protobufs for gRPC services * Install grpc_health_probe in base image * Check for empty response data * Also check ResponseData.Tasks != nil * Specify protocol for microservice instead of endpoint As discussed with Aleksandra, running two servers on two ports is complicated and unrealistic for a microservice * Forward requests to gRPC endpoints * Add protocols to network task response * Update impl.tmpl to match new definition * Print protocols in LogNetworkTask * Fix parallel gRPC request * Update stressors.md to match current implementation * Create Dockerfile for application-generator * Write generated files to k8s/generated * Build Docker image in generator * Write Docker output to stdout/stderr * Fix error in Docker build * Do not download modules for model Since emulator depends on model * Delete placeholder files from base layer * Copy grpc_health_probe into final image * Fix grpc_health_probe path * Improve endpoint response format to be less ambiguous * Add build ID to Docker image and config to make sure they match * Warn instead of panicking on build ID mismatch * Change all errors to lowercase https://github.com/golang/go/wiki/CodeReviewComments#error-strings * Update documentation to match new response format * Fix inconsistent endpoint keys * Fix buildID not being set in emulator * Remove most TODOs * Fix buildID not being set in Dockerfile * Move generated files out of k8s/ Fixes warning when running deploy.sh * Remove the development config map * Document api.proto * Use strcase package * Ignore go.work.sum This file includes other modules installed by the user, such as gopls * Separate generated files into client and server Prevents import cycle error * Remove old run.sh script * Ensure that gRPC status codes are returned on error * Return INVALID_ARGUMENT if endpoint doesn't exist * Fix api.proto comment * Update documentation for Docker base and layered images * Add DefaultProtocol back into generator * Split CreateK8sYaml into two functions * Name docker images after hostname This ensures they won't be pulled down from the Docker registry * Remove buildID and give all images unique tag * Delete old hydragen-emulator images * Never cache results from image build * Add auto-deployment of images for Kind * Add break to deploy.sh * Add containerd-push-image-to-clusters.sh * Pass sudo password to remote script * Fix containerd-push-image-to-clusters.sh * Remove old code from deploy.sh * Fix ssh commands in containerd-push-image-to-clusters.sh * Document helper scripts for kind and containerd * Run goimports after generating gRPC code * Ensure TrafficForwardRatio is positive * Implement TrafficForwardRatio * Don't allow traffic forward ratio under 1 Otherwise the default is 0 * Make sure multiple responses from endpoint can be returned * Change container name back to "app" * Add SSH and sudo password options to containerd-push-image-to-clusters.sh * Set GOMEMLIMIT in k8s manifest * Add debug output to containerd script * Only use contexts in containerd script * Don't reference loop variable in HTTP server https://github.com/golang/go/wiki/CommonMistakes#using-reference-to-loop-iterator-variable * Set default emulator base image to busybox Provides a shell and utilities without increasing image size by much * Rename "base image" to "source image" * Add a base_image option in config * Set BASEIMAGE in Dockerfile * Document base_image parameter * Automatically determine port and protocol of called service * Add an option to use the development image with the random preset * Fix port and protocol not applying in network complexity * Update simple example for new Go emulator * Update complex example by generating new application --------- Co-authored-by: Hannes Mann <[email protected]>
- Loading branch information