Skip to content

Commit a58dd5a

Browse files
authored
chore: prep 0.19.0 release (#638)
1 parent 06ff27c commit a58dd5a

File tree

9 files changed

+60
-11
lines changed

9 files changed

+60
-11
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Changes
22

3+
## [0.19.0](https://github.com/SwissDataScienceCenter/renku-gateway/compare/0.18.1...0.19.0) (2023-03-31)
4+
5+
6+
### Features
7+
8+
* **app:** sticky sessions middleware ([#630](https://github.com/SwissDataScienceCenter/renku-gateway/issues/630)) ([06ff27c](https://github.com/SwissDataScienceCenter/renku-gateway/commit/06ff27cbdc7ba7f5bc7cfbf235c6e643042faecd))
9+
* **app:** use golang echo as reverse proxy ([#623](https://github.com/SwissDataScienceCenter/renku-gateway/issues/623)) ([58e3cd0](https://github.com/SwissDataScienceCenter/renku-gateway/commit/58e3cd06b6da46cfd5f1d8ec929fee7db1873224))
10+
11+
12+
313
## [0.18.1](https://github.com/SwissDataScienceCenter/renku-gateway/compare/0.18.0...0.18.1) (2023-02-24)
414

515
### Bug Fixes

cmd/revproxy/config.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,19 @@ type metricsConfig struct {
2525
Port int `mapstructure:"metrics_port"`
2626
}
2727

28+
type rateLimits struct {
29+
Enabled bool `mapstructure:"rate_limits_enabled"`
30+
Rate float64 `mapstructure:"rate_limits_average"`
31+
Burst int `mapstructure:"rate_limits_burst"`
32+
}
33+
2834
type revProxyConfig struct {
2935
RenkuBaseURL *url.URL `mapstructure:"renku_base_url"`
3036
AllowOrigin []string `mapstructure:"allow_origin"`
3137
ExternalGitlabURL *url.URL `mapstructure:"external_gitlab_url"`
3238
RenkuServices renkuServicesConfig `mapstructure:",squash"`
3339
Metrics metricsConfig `mapstructure:",squash"`
40+
RateLimits rateLimits `mapstructure:",squash"`
3441
Port int
3542
}
3643

cmd/revproxy/main.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212

1313
"github.com/labstack/echo/v4"
1414
"github.com/labstack/echo/v4/middleware"
15+
"golang.org/x/time/rate"
1516
)
1617

1718
func setupServer(config revProxyConfig) *echo.Echo {
@@ -43,6 +44,17 @@ func setupServer(config revProxyConfig) *echo.Echo {
4344
e := echo.New()
4445
e.Pre(middleware.RemoveTrailingSlash())
4546
e.Use(middleware.Recover())
47+
if config.RateLimits.Enabled {
48+
e.Use(middleware.RateLimiter(
49+
middleware.NewRateLimiterMemoryStoreWithConfig(
50+
middleware.RateLimiterMemoryStoreConfig{
51+
Rate: rate.Limit(config.RateLimits.Rate),
52+
Burst: config.RateLimits.Burst,
53+
ExpiresIn: 3 * time.Minute,
54+
}),
55+
),
56+
)
57+
}
4658

4759
// Routing for Renku services
4860
e.Group("/api/auth", logger, authSvcProxy)

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ require (
88
github.com/mitchellh/mapstructure v1.5.0
99
github.com/spf13/viper v1.15.0
1010
github.com/stretchr/testify v1.8.1
11+
golang.org/x/time v0.3.0
1112
k8s.io/api v0.26.1
1213
k8s.io/apimachinery v0.26.1
1314
k8s.io/client-go v0.26.1
@@ -61,7 +62,6 @@ require (
6162
golang.org/x/sys v0.5.0 // indirect
6263
golang.org/x/term v0.5.0 // indirect
6364
golang.org/x/text v0.7.0 // indirect
64-
golang.org/x/time v0.3.0 // indirect
6565
google.golang.org/appengine v1.6.7 // indirect
6666
google.golang.org/protobuf v1.28.1 // indirect
6767
gopkg.in/inf.v0 v0.9.1 // indirect

helm-chart/renku-gateway/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ appVersion: "2.0"
33
description: A Helm chart for the Renku gateway
44
name: renku-gateway
55
icon: https://github.com/SwissDataScienceCenter/renku-sphinx-theme/raw/master/renku_sphinx_theme/static/favicon.png
6-
version: 0.18.1
6+
version: 0.19.0

helm-chart/renku-gateway/templates/deployment-revproxy.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ spec:
6565
value: {{ .Values.reverseProxy.metrics.enabled | quote }}
6666
- name: REVPROXY_METRICS_PORT
6767
value: {{ .Values.reverseProxy.metrics.port | quote }}
68+
- name: REVPROXY_RATE_LIMITS_ENABLED
69+
value: {{ .Values.rateLimits.general.enabled | quote }}
70+
- name: REVPROXY_RATE_LIMITS_AVERAGE
71+
value: {{ .Values.rateLimits.general.average | quote }}
72+
- name: REVPROXY_RATE_LIMITS_BURST
73+
value: {{ .Values.rateLimits.general.burst | quote }}
6874
volumeMounts:
6975
{{- include "certificates.volumeMounts.system" . | nindent 12 }}
7076
livenessProbe:
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{{- if or (gt (int .Values.reverseProxy.replicaCount) 1) (and .Values.reverseProxy.autoscaling.enabled (gt (int .Values.reverseProxy.autoscaling.minReplicas) 1)) }}
2+
apiVersion: policy/v1
3+
kind: PodDisruptionBudget
4+
metadata:
5+
name: {{ template "gateway.fullname" . }}-revproxy
6+
labels:
7+
app: {{ template "gateway.name" . }}-revproxy
8+
chart: {{ template "gateway.chart" . }}
9+
release: {{ .Release.Name }}
10+
heritage: {{ .Release.Service }}
11+
spec:
12+
maxUnavailable: 50%
13+
selector:
14+
matchLabels:
15+
app: {{ template "gateway.name" . }}-revproxy
16+
release: {{ .Release.Name }}
17+
{{- end }}

helm-chart/renku-gateway/values.yaml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@ global:
6161
## should have the .crt extension otherwise it is ignored. The
6262
## keys across all secrets are mounted as files in one location so
6363
## the keys across all secrets have to be unique.
64-
## In addition to this the certificates have to be seperately defined
65-
## in the Traefik section below for the Traefik Helm sub-chart.
6664
certificates:
6765
image:
6866
repository: renku/certificates
@@ -102,13 +100,12 @@ development: false
102100

103101
## To protect the backend services from an excessive amount of API calls
104102
## issued by one client, one can enforce rate limits here. The limits apply
105-
## per UI client session (identified by the cookies). For an explanation of
106-
## the different values check out the rate limiting documentation of traefik
107-
## v2.0.
103+
## based on the IP address of the client.
108104
rateLimits:
109-
## General rate limit, applies to all /api calls combined.
105+
## General rate limit, applies to all calls combined.
110106
general:
111-
period: 10s
107+
enabled: false
108+
## average rate units are requests per second
112109
average: 20
113110
burst: 100
114111

@@ -214,7 +211,7 @@ reverseProxy:
214211
metrics:
215212
enabled: true
216213
port: 8765
217-
replicaCount: 1
214+
replicaCount: 2
218215
podAnnotations: {}
219216
resources: {}
220217
autoscaling:

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "renku-gateway"
3-
version = "0.18.1"
3+
version = "0.19.0"
44
description = ""
55
authors = ["Your Name <[email protected]>"]
66
license = "Apache 2"

0 commit comments

Comments
 (0)