Skip to content
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

Feature/enable multi pool client connections #5

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

sinadarbouy
Copy link
Owner

Ticket(s)

Description

Related PRs

Development Checklist

  • I have added a descriptive title to this PR.
  • I have squashed related commits together.
  • I have rebased my branch on top of the latest main branch.
  • I have performed a self-review of my own code.
  • I have commented on my code, particularly in hard-to-understand areas.
  • I have added docstring(s) to my code.
  • I have made corresponding changes to the documentation (docs).
  • I have updated docs using make gen-docs command.
  • I have added tests for my changes.
  • I have signed all the commits.

Legal Checklist

Copy link

github-actions bot commented Jul 14, 2024

Overview

Image reference ghcr.io/sinadarbouy/gatewayd:905bc10 gatewaydio/gatewayd:latest
- digest 32154d578741 93100deaec5d
- tag 905bc10 latest
- provenance gatewayd-io@f70e428
- vulnerabilities critical: 0 high: 0 medium: 0 low: 0 critical: 2 high: 1 medium: 3 low: 1 unspecified: 1
- platform linux/amd64 linux/amd64
- size 19 MB 17 MB (-2.1 MB)
- packages 133 128 (-5)
Base Image alpine:3
also known as:
3.20
3.20.2
latest
alpine:3.20
also known as:
3
latest
- vulnerabilities critical: 0 high: 0 medium: 0 low: 0 critical: 1 high: 0 medium: 2 low: 0 unspecified: 1
Packages and Vulnerabilities (35 package changes and 3 vulnerability changes)
  • ➕ 1 packages added
  • ➖ 5 packages removed
  • ♾️ 29 packages changed
  • 96 packages unchanged
  • ❗ 3 vulnerabilities added
Changes for packages of type apk (9 changes)
Package Version
ghcr.io/sinadarbouy/gatewayd:905bc10
Version
gatewaydio/gatewayd:latest
♾️ busybox 1.36.1-r29 1.36.1-r28
♾️ busybox-binsh 1.36.1-r29 1.36.1-r28
ca-certificates 20240705-r0
♾️ ca-certificates-bundle 20240705-r0 20240226-r0
♾️ libcrypto3 3.3.1-r3 3.3.0-r2
♾️ libssl3 3.3.1-r3 3.3.0-r2
critical: 1 high: 0 medium: 0 low: 0
Added vulnerabilities (1):
  • critical : CVE--2024--5535
openssl 3.3.1-r3
pax-utils 1.3.7-r2
♾️ ssl_client 1.36.1-r29 1.36.1-r28
Changes for packages of type golang (26 changes)
Package Version
ghcr.io/sinadarbouy/gatewayd:905bc10
Version
gatewaydio/gatewayd:latest
♾️ github.com/gatewayd-io/gatewayd (devel) 0.9.6
♾️ github.com/gatewayd-io/gatewayd-plugin-sdk 0.3.0 0.2.15
♾️ github.com/getsentry/sentry-go 0.28.0 0.27.0
♾️ github.com/go-logr/logr 1.4.2 1.4.1
github.com/munnerz/goautoneg 0.0.0-20191010083416-a7dc8b61c822
♾️ github.com/prometheus/common 0.55.0 0.53.0
♾️ github.com/prometheus/procfs 0.15.1 0.15.0
♾️ github.com/redis/go-redis/v9 9.5.4 9.5.1
♾️ github.com/spf13/cobra 1.8.1 1.8.0
♾️ github.com/wasilibs/go-pgquery 0.0.0-20240606042535-c0843d6592cc 0.0.0-20240510022537-eb0917feddeb
github.com/wasilibs/wazero-helpers 0.0.0-20240604052452-61d7981e9a38
♾️ go.opentelemetry.io/otel 1.27.0 1.26.0
♾️ go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc 1.27.0 1.26.0
♾️ go.opentelemetry.io/otel/metric 1.27.0 1.26.0
♾️ go.opentelemetry.io/otel/sdk 1.27.0 1.26.0
♾️ go.opentelemetry.io/otel/trace 1.27.0 1.26.0
♾️ golang.org/x/crypto 0.25.0 0.23.0
♾️ golang.org/x/net 0.27.0 0.25.0
♾️ golang.org/x/oauth2 0.21.0 0.20.0
♾️ golang.org/x/sys 0.22.0 0.20.0
♾️ golang.org/x/text 0.16.0 0.15.0
♾️ google.golang.org/genproto/googleapis/rpc 0.0.0-20240711142825-46eb208f015d 0.0.0-20240528184218-531527333157
♾️ google.golang.org/grpc 1.65.0 1.64.0
♾️ google.golang.org/protobuf 1.34.2 1.34.1
gopkg.in/yaml.v2 2.4.0
♾️ stdlib go1.22.5 1.22.3
critical: 1 high: 1 medium: 0 low: 0
Added vulnerabilities (2):
  • critical : CVE--2024--24790
  • high : CVE--2024--24791

@sinadarbouy sinadarbouy force-pushed the feature/enable-multi-pool-client-connections branch 3 times, most recently from 04334b8 to d35c2ab Compare July 14, 2024 17:26
@coveralls
Copy link

coveralls commented Jul 17, 2024

Pull Request Test Coverage Report for Build 10134448031

Details

  • 347 of 444 (78.15%) changed or added relevant lines in 8 files are covered.
  • 3 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.2%) to 62.144%

Changes Missing Coverage Covered Lines Changed/Added Lines %
api/api.go 31 33 93.94%
network/roundrobin.go 8 10 80.0%
plugin/utils.go 0 5 0.0%
network/server.go 60 76 78.95%
config/config.go 44 71 61.97%
cmd/run.go 195 240 81.25%
Files with Coverage Reduction New Missed Lines %
config/config.go 3 71.75%
Totals Coverage Status
Change from base Build 9921192072: 0.2%
Covered Lines: 4209
Relevant Lines: 6773

💛 - Coveralls

@sinadarbouy sinadarbouy force-pushed the feature/enable-multi-pool-client-connections branch 3 times, most recently from 016dac1 to 491cad3 Compare July 23, 2024 18:32
This commit introduces significant updates to enhance the handling of proxies within the server configuration and adds support for load balancing strategies.

Changes:
- Updated API tests to reflect changes from a single `Proxy` to a list of `Proxies`.
- Adjusted initialization and configuration of proxies in `run.go` to support multiple proxies and load balancer strategies.
- Updated configuration files to include new fields for multiple proxies and load balancer strategies.
- Enhanced global configuration validation for clients, pools, and proxies.
- Added new `loadBalancer` section in `gatewayd.yaml` for rules and strategies.
- Implemented load balancing strategy selection and Round Robin strategy.
- Added tests for load balancer strategies.
- Added new error type `ErrorCodeLoadBalancerStrategyNotFound`.
- Improved proxy connection handling and added informative comments.

Configuration Example:
- Updated `gatewayd.yaml` to reflect new support for multiple proxies and load balancer strategies.
- Ensure to update your configuration files accordingly.

Testing:
- Updated existing tests and added new tests for multi-proxy and load balancing functionality.
- Verified configuration validation for proxies and load balancers.

Impact:
- Improved flexibility and scalability of server configuration.
- Enabled robust proxy management and efficient load distribution.

Update errors/errors.go

Co-authored-by: Mostafa Moradian <[email protected]>
Signed-off-by: sina <[email protected]>

fixed review problems
@sinadarbouy sinadarbouy force-pushed the feature/enable-multi-pool-client-connections branch from 491cad3 to 585ed7f Compare July 23, 2024 20:11
sinadarbouy and others added 14 commits July 26, 2024 14:47
- Change pools, clients, and proxies to use map[string]map[string] instead of map[string]
- Update related code for compatibility with new nested map structure
remvoed server 2 from gatewatd.yaml file
…iles

Updated variable names in the API, test files, run command, and configuration files to improve code readability and maintainability. Key changes include:

1. **api.go**:
   - Renamed `configurationGroupPools` to `configGroupPools` for clarity.

2. **api_helpers_test.go, api_test.go**:
   - Updated to use `config.DefaultConfigurationBlock` instead of `config.DefaultPool` and `config.DefaultProxy` for better naming consistency.

3. **run.go**:
   - Changed iteration variables to `configGroup` and `configBlockName` for better descriptive naming.
   - Updated logging and error handling to use `configBlockName`.
   - Modified span attribute naming for tracing proxy creation.

4. **config.go**:
   - Updated `DefaultPool`, `DefaultClient`, and `DefaultProxy` to `DefaultConfigurationBlock` in the `LoadDefaults` function.
   - Enhanced configuration parsing logic to handle `DefaultConfigurationBlock` appropriately and ensure robust error handling.

5. **constants.go**:
   - Renamed `DefaultClient`, `DefaultPool`, and `DefaultProxy` to `DefaultConfigurationBlock`.
   - Retained other configuration constants for environment prefix, tracer name, and configuration filenames.

These changes enhance the codebase by standardizing variable names, improving readability, and making the code easier to maintain.
- Enhanced the Client struct by adding YAML tags to all fields, ensuring compatibility with YAML parsers.
- Added YAML tags to the Size field in the Pool struct.
- Included YAML tags for the HealthCheckPeriod field in the Proxy struct.

These changes address limitations of the YAML parser and ensure proper serialization and deserialization of configuration data.
- Modified the GetServers endpoint to return the current load balancer configuration for each server.
- Added a new field "loadBalancer" to the server details, including the load balancer strategy name.
- Updated unit tests to validate the new "loadBalancer" field in the API response.
- Adjusted test setup to include the default load balancer strategy configuration.
Renamed short variable names used in type assertions to longer, more descriptive names to resolve golint warnings about variable name length.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants