Skip to content

Commit

Permalink
feat: Copy slowStartConfig for Gloo upstreams
Browse files Browse the repository at this point in the history
Signed-off-by: Nick Caballero <[email protected]>
  • Loading branch information
nickcaballero committed Jul 5, 2023
1 parent 4c2de0c commit 66d5a94
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
25 changes: 25 additions & 0 deletions pkg/apis/gloo/gloo/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type UpstreamSpec struct {
SslConfig *UpstreamSslConfig `json:"sslConfig,omitempty"`
CircuitBreakers *CircuitBreakerConfig `json:"circuitBreakers,omitempty"`
ConnectionConfig *ConnectionConfig `json:"connectionConfig,omitempty"`
LoadBalancerConfig *LoadBalancerConfig `json:"loadBalancerConfig,omitempty"`
UseHttp2 bool `json:"useHttp2,omitempty"`
InitialStreamWindowSize uint32 `json:"initialStreamWindowSize,omitempty"`
InitialConnectionWindowSize uint32 `json:"initialConnectionWindowSize,omitempty"`
Expand Down Expand Up @@ -109,11 +110,35 @@ type ConnectionConfig_HttpProtocolOptions struct {
HeadersWithUnderscoresAction uint32 `json:"headersWithUnderscoresAction,omitempty"`
}

type LoadBalancerConfig struct {
RoundRobin *LoadBalancerConfig_RoundRobin `json:"roundRobin,omitempty"`
LeastRequest *LoadBalancerConfig_LeastRequest `json:"leastRequest,omitempty"`
}

type LoadBalancerConfig_RoundRobin struct {
SlowStartConfig *SlowStartConfig `json:"slowStartConfig,omitempty"`
}

type LoadBalancerConfig_LeastRequest struct {
SlowStartConfig *SlowStartConfig `json:"slowStartConfig,omitempty"`
ChoiceCount uint32 `json:"choiceCount,omitempty"`
}

type SlowStartConfig struct {
SlowStartWindow *Duration `json:"slowStartWindow,omitempty"`
Aggression *DoubleValue `json:"aggression,omitempty"`
MinWeightPercent *DoubleValue `json:"minWeightPercent,omitempty"`
}

type Duration struct {
Seconds int64 `json:"seconds,omitempty"`
Nanos int32 `json:"nanos,omitempty"`
}

type DoubleValue struct {
Value float64 `json:"value,omitempty"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// UpstreamList is a list of Upstream resources
Expand Down
1 change: 1 addition & 0 deletions pkg/router/gloo.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ func (gr *GlooRouter) getGlooUpstreamKubeService(canary *flaggerv1.Canary, svc *
SslConfig: configSpec.SslConfig,
CircuitBreakers: configSpec.CircuitBreakers,
ConnectionConfig: configSpec.ConnectionConfig,
LoadBalancerConfig: configSpec.LoadBalancerConfig,
UseHttp2: configSpec.UseHttp2,
InitialStreamWindowSize: configSpec.InitialStreamWindowSize,
InitialConnectionWindowSize: configSpec.InitialConnectionWindowSize,
Expand Down
5 changes: 5 additions & 0 deletions test/gloo/test-canary.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ spec:
port: 80
connectionConfig:
maxRequestsPerConnection: 51
loadBalancerConfig:
roundRobin:
slowStartConfig:
slowStartWindow: 2m
minWeightPercent: 5
EOF

cat <<EOF | kubectl apply -f -
Expand Down

0 comments on commit 66d5a94

Please sign in to comment.