From d9b9f3087b2570a481e800d04846fbafe53087f9 Mon Sep 17 00:00:00 2001 From: Tarun Pothulapati Date: Tue, 22 Feb 2022 12:54:09 +0000 Subject: [PATCH] installer: make OpenVSX URL configurable Fixes #8224 This PR adds a new `OpenVSX` object into the top-level `Config` field to support configurations of the `openvsx-proxy` component. Currently, Only `URL` field is present. This is needed to support air-gap instlalations where people are expected to host their own open-vsx. This config is top-level and not under the workspace or IDE as this configures the proxy, but not the IDE. The URL is validated by using the validate go tags. Signed-off-by: Tarun Pothulapati --- .../installer/pkg/components/openvsx-proxy/configmap.go | 2 +- install/installer/pkg/config/v1/config.go | 7 +++++++ install/installer/pkg/config/v1/load.go | 3 +++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/install/installer/pkg/components/openvsx-proxy/configmap.go b/install/installer/pkg/components/openvsx-proxy/configmap.go index ac2657eef2e0d2..4de958a49a2a82 100644 --- a/install/installer/pkg/components/openvsx-proxy/configmap.go +++ b/install/installer/pkg/components/openvsx-proxy/configmap.go @@ -22,7 +22,7 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) { LogDebug: false, CacheDurationRegular: util.Duration(time.Minute), CacheDurationBackup: util.Duration(time.Hour * 72), - URLUpstream: "https://open-vsx.org", // todo(sje): make configurable + URLUpstream: ctx.Config.OpenVSX.URL, URLLocal: fmt.Sprintf("https://open-vsx.%s", ctx.Config.Domain), MaxIdleConns: 1000, MaxIdleConnsPerHost: 1000, diff --git a/install/installer/pkg/config/v1/config.go b/install/installer/pkg/config/v1/config.go index 7730c5ac2c2302..9b784bc7c14ddc 100644 --- a/install/installer/pkg/config/v1/config.go +++ b/install/installer/pkg/config/v1/config.go @@ -55,6 +55,7 @@ func (v version) Defaults(in interface{}) error { cfg.Workspace.Runtime.FSShiftMethod = FSShiftFuseFS cfg.Workspace.Runtime.ContainerDSocket = "/run/containerd/containerd.sock" cfg.Workspace.Runtime.ContainerDRuntimeDir = "/var/lib/containerd/io.containerd.runtime.v2.task/k8s.io" + cfg.OpenVSX.URL = "https://open-vsx.org" return nil } @@ -82,6 +83,8 @@ type Config struct { Workspace Workspace `json:"workspace" validate:"required"` + OpenVSX OpenVSX `json:"openVSX"` + AuthProviders []ObjectRef `json:"authProviders" validate:"dive"` BlockNewUsers BlockNewUsers `json:"blockNewUsers"` License *ObjectRef `json:"license,omitempty"` @@ -229,6 +232,10 @@ type Workspace struct { Templates *WorkspaceTemplates `json:"templates,omitempty"` } +type OpenVSX struct { + URL string `json:"url" validate:"url"` +} + type FSShiftMethod string const ( diff --git a/install/installer/pkg/config/v1/load.go b/install/installer/pkg/config/v1/load.go index 576ce9cbc3c49d..ac5795d46e3905 100644 --- a/install/installer/pkg/config/v1/load.go +++ b/install/installer/pkg/config/v1/load.go @@ -50,6 +50,9 @@ func LoadMock() *Config { Kind: ObjectRefSecret, Name: "https-certs", }, + OpenVSX: OpenVSX{ + URL: "https://open-vsx.org", + }, Workspace: Workspace{ Runtime: WorkspaceRuntime{ FSShiftMethod: FSShiftFuseFS,