Skip to content

Commit 0f92a1f

Browse files
iQQBotroboquat
authored andcommitted
[ide-proxy] add blobserve handler
1 parent d6cf319 commit 0f92a1f

File tree

3 files changed

+39
-1
lines changed

3 files changed

+39
-1
lines changed

components/blobserve/pkg/blobserve/blobserve.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ func (reg *Server) serve(w http.ResponseWriter, req *http.Request) {
215215

216216
// The blobFor operation's context must be independent of this request. Even if we do not
217217
// serve this request in time, we might want to serve another from the same ref in the future.
218-
blob, hash, err := reg.refstore.BlobFor(context.Background(), ref, req.Header.Get("X-BlobServe-ReadOnly") == "true")
218+
blob, hash, err := reg.refstore.BlobFor(context.Background(), ref, false)
219219
if err == errdefs.ErrNotFound {
220220
http.Error(w, fmt.Sprintf("image %s not found: %q", html.EscapeString(ref), err), http.StatusNotFound)
221221
return

components/ide-proxy/conf/Caddyfile

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,41 @@
33
admin off
44
}
55

6+
(compression) {
7+
encode zstd gzip
8+
}
9+
10+
(upstream_headers) {
11+
header_up X-Real-IP {http.request.remote.host}
12+
}
13+
14+
(upstream_connection) {
15+
lb_try_duration 1s
16+
}
17+
618
:80 {
719
header -Server
820

21+
@blobserve path /blobserve/*
22+
handle @blobserve {
23+
import compression
24+
25+
uri strip_prefix /blobserve
26+
uri replace /__files__/ / 1
27+
28+
header {
29+
Access-Control-Allow-Origin *
30+
Access-Control-Allow-Methods "GET, OPTIONS"
31+
}
32+
33+
reverse_proxy blobserve.{$KUBE_NAMESPACE}.{$KUBE_DOMAIN}:4000 {
34+
import upstream_headers
35+
import upstream_connection
36+
37+
flush_interval -1
38+
}
39+
}
40+
941
root * /www
1042
file_server {
1143
precompressed gzip br

install/installer/pkg/components/blobserve/networkpolicy.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package blobserve
66

77
import (
88
"github.com/gitpod-io/gitpod/installer/pkg/common"
9+
ideproxy "github.com/gitpod-io/gitpod/installer/pkg/components/ide-proxy"
910
"github.com/gitpod-io/gitpod/installer/pkg/components/proxy"
1011
wsproxy "github.com/gitpod-io/gitpod/installer/pkg/components/ws-proxy"
1112

@@ -38,9 +39,14 @@ func networkpolicy(ctx *common.RenderContext) ([]runtime.Object, error) {
3839
"component": proxy.Component,
3940
}},
4041
}, {
42+
// TODO: (pd) delete this after all workspace cluster deployed
4143
PodSelector: &metav1.LabelSelector{MatchLabels: map[string]string{
4244
"component": wsproxy.Component,
4345
}},
46+
}, {
47+
PodSelector: &metav1.LabelSelector{MatchLabels: map[string]string{
48+
"component": ideproxy.Component,
49+
}},
4450
}},
4551
}},
4652
},

0 commit comments

Comments
 (0)