Skip to content

Commit 23f41cb

Browse files
aledbfroboquat
authored andcommitted
[ws-proxy] Remove proxy of ws-manager.
1 parent 092ec2f commit 23f41cb

File tree

6 files changed

+1
-156
lines changed

6 files changed

+1
-156
lines changed

chart/templates/ws-proxy-configmap.yaml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,7 @@ data:
6363
"location": "/app/public"
6464
}
6565
},
66-
{{ if (and $comp.wsManagerProxy $comp.wsManagerProxy.enabled) }}
67-
"wsManagerProxy": {
68-
"listenAddress": "{{ $comp.wsManagerProxy.listenAddress }}",
69-
"rateLimiter": {
70-
"refillInterval": "1s",
71-
"bucketSize": {{ $comp.wsManagerProxy.ratelimit.maxRPS }}
72-
}
73-
},
74-
{{ end }}
75-
"pprofAddr": ":60060",
66+
"pprofAddr": ":6060",
7667
"readinessProbeAddr": ":60088",
7768
"prometheusAddr": ":60095"
7869
}

chart/templates/ws-proxy-networkpolicy.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,4 @@ spec:
2626
port: {{ $comp.ports.httpProxy.containerPort }}
2727
- protocol: TCP
2828
port: {{ $comp.ports.httpsProxy.containerPort }}
29-
{{ if $comp.ports.wsManagerProxy }}
30-
- protocol: TCP
31-
port: {{ $comp.ports.wsManagerProxy.containerPort }}
32-
{{ end }}
3329
{{ end }}

chart/values.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -524,12 +524,6 @@ components:
524524
memory: 64Mi
525525
replicas: 1
526526
hostHeader: "x-wsproxy-host"
527-
wsManagerProxy:
528-
enabled: false
529-
listenAddress: ":8081"
530-
ratelimit:
531-
# Limits the # of requests (per second)
532-
maxRPS: 10
533527
ports:
534528
httpProxy:
535529
expose: true

components/ws-proxy/cmd/root.go

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

1515
"github.com/gitpod-io/gitpod/common-go/log"
1616
"github.com/gitpod-io/gitpod/common-go/tracing"
17-
"github.com/gitpod-io/gitpod/common-go/util"
1817
"github.com/gitpod-io/gitpod/ws-proxy/pkg/proxy"
1918
)
2019

@@ -60,7 +59,6 @@ type Config struct {
6059
PProfAddr string `json:"pprofAddr"`
6160
PrometheusAddr string `json:"prometheusAddr"`
6261
ReadinessProbeAddr string `json:"readinessProbeAddr"`
63-
WSManagerProxy WSManagerProxyConfig `json:"wsManagerProxy"`
6462
}
6563

6664
// Validate validates the configuration to catch issues during startup and not at runtime
@@ -74,38 +72,7 @@ func (c *Config) Validate() error {
7472
if err := c.WorkspaceInfoProviderConfig.Validate(); err != nil {
7573
return err
7674
}
77-
if err := c.WSManagerProxy.Validate(); err != nil {
78-
return err
79-
}
80-
81-
return nil
82-
}
83-
84-
// WSManagerProxyConfig configures the ws-manager TCP proxy
85-
type WSManagerProxyConfig struct {
86-
ListenAddress string `json:"listenAddress"`
87-
RateLimiter RateLimiterConfig `json:"rateLimiter"`
88-
}
8975

90-
// Validate validates this config
91-
func (c *WSManagerProxyConfig) Validate() error {
92-
if c != nil && len(c.ListenAddress) > 0 {
93-
return c.RateLimiter.Validate()
94-
}
95-
return nil
96-
}
97-
98-
// RateLimiterConfig configures a rate limiter
99-
type RateLimiterConfig struct {
100-
RefillInterval util.Duration `json:"refillInterval"`
101-
BucketSize int `json:"bucketSize"`
102-
}
103-
104-
// Validate validates this config
105-
func (c *RateLimiterConfig) Validate() error {
106-
if c == nil {
107-
return xerrors.Errorf("rate limiter config is nil")
108-
}
10976
return nil
11077
}
11178

components/ws-proxy/cmd/run.go

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,19 @@
55
package cmd
66

77
import (
8-
"context"
9-
"net"
108
"net/http"
119
"os"
1210
"os/signal"
1311
"syscall"
1412
"time"
1513

16-
"github.com/google/tcpproxy"
1714
"github.com/prometheus/client_golang/prometheus"
1815
"github.com/prometheus/client_golang/prometheus/promhttp"
1916
"github.com/spf13/cobra"
2017

2118
"github.com/gitpod-io/gitpod/common-go/log"
2219
"github.com/gitpod-io/gitpod/common-go/pprof"
2320
"github.com/gitpod-io/gitpod/ws-proxy/pkg/proxy"
24-
"github.com/gitpod-io/gitpod/ws-proxy/pkg/ratelimit"
2521
)
2622

2723
var jsonLog bool
@@ -96,26 +92,11 @@ var runCmd = &cobra.Command{
9692
}()
9793
}
9894

99-
ctx, cancel := context.WithCancel(context.Background())
100-
if cfg.WSManagerProxy.ListenAddress != "" {
101-
go func() {
102-
tcpProxyListenAddr := cfg.WSManagerProxy.ListenAddress
103-
wsManagerAddr := cfg.WorkspaceInfoProviderConfig.WsManagerAddr
104-
refillInterval := time.Duration(cfg.WSManagerProxy.RateLimiter.RefillInterval)
105-
bucketSize := cfg.WSManagerProxy.RateLimiter.BucketSize
106-
err := startWSManagerTCPProxy(ctx, tcpProxyListenAddr, wsManagerAddr, refillInterval, bucketSize)
107-
if err != nil {
108-
log.WithError(err).Fatal("starting ws-manger TCP proxy failed")
109-
}
110-
}()
111-
}
112-
11395
log.Info("🚪 ws-proxy is up and running")
11496
sigChan := make(chan os.Signal, 1)
11597
signal.Notify(sigChan, os.Interrupt, syscall.SIGTERM)
11698
<-sigChan
11799
log.Info("received SIGTERM, ws-proxy is stopping...")
118-
cancel()
119100

120101
defer func() {
121102
log.Info("ws-proxy stopped.")
@@ -126,21 +107,3 @@ var runCmd = &cobra.Command{
126107
func init() {
127108
rootCmd.AddCommand(runCmd)
128109
}
129-
130-
func startWSManagerTCPProxy(ctx context.Context, listenAddr string, wsManagerAddr string, refillInterval time.Duration, bucketSize int) error {
131-
var p tcpproxy.Proxy
132-
p.AddRoute(listenAddr, tcpproxy.To(wsManagerAddr))
133-
if refillInterval != 0 && bucketSize != 0 {
134-
p.ListenFunc = func(network, address string) (net.Listener, error) {
135-
return ratelimit.NewListener(
136-
ctx,
137-
network,
138-
address,
139-
refillInterval,
140-
bucketSize,
141-
)
142-
}
143-
}
144-
log.Infof("Forwarding ws-manager traffic: %s -> %s\n", listenAddr, wsManagerAddr)
145-
return p.Run()
146-
}

components/ws-proxy/pkg/ratelimit/rate-limited-listener.go

Lines changed: 0 additions & 66 deletions
This file was deleted.

0 commit comments

Comments
 (0)