Skip to content

Commit

Permalink
[installer]: deprecate the experimental IDE configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
iQQBot authored and roboquat committed Feb 1, 2023
1 parent 6b08f86 commit 739cae9
Show file tree
Hide file tree
Showing 14 changed files with 184 additions and 72 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 8 additions & 7 deletions install/installer/cmd/testdata/render/ide-config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@

apiVersion: v1
domain: gitpod.example.com
experimental:
components:
ide:
resolveLatest: true
ideProxy:
metrics:
errorReportingEnabled: true
proxy:
serviceAnnotations:
ideProxyAnnotation: some-value
openvsxProxy:
serviceAnnotations:
openvsxProxyAnnotation: some-other-value
ideMetrics:
enabledErrorReporting: true
openVSX:
proxy:
serviceAnnotations:
openvsxProxyAnnotation: some-other-value
50 changes: 37 additions & 13 deletions install/installer/cmd/testdata/render/ide-config/output.golden

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 6 additions & 13 deletions install/installer/pkg/components/ide-metrics/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ package ide_metrics
import (
"github.com/gitpod-io/gitpod/installer/pkg/cluster"
"github.com/gitpod-io/gitpod/installer/pkg/common"
"github.com/gitpod-io/gitpod/installer/pkg/config/v1/experimental"

appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -48,18 +47,12 @@ func deployment(ctx *common.RenderContext) ([]runtime.Object, error) {
common.DefaultEnv(&ctx.Config),
))

_ = ctx.WithExperimental(func(cfg *experimental.Config) error {
if cfg.IDE != nil && cfg.IDE.IDEMetricsConfig != nil {
if cfg.IDE.IDEMetricsConfig.EnabledErrorReporting {
env = append(env, corev1.EnvVar{
Name: "GITPOD_ENABLED_ERROR_REPORTING",
Value: "true",
})
}

}
return nil
})
if ctx.Config.Components != nil && ctx.Config.Components.IDE != nil && ctx.Config.Components.IDE.Metrics != nil && ctx.Config.Components.IDE.Metrics.ErrorReportingEnabled {
env = append(env, corev1.EnvVar{
Name: "GITPOD_ENABLED_ERROR_REPORTING",
Value: "true",
})
}

return []runtime.Object{
&appsv1.Deployment{
Expand Down
11 changes: 4 additions & 7 deletions install/installer/pkg/components/ide-proxy/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,17 @@ package ide_proxy

import (
"github.com/gitpod-io/gitpod/installer/pkg/common"
"github.com/gitpod-io/gitpod/installer/pkg/config/v1/experimental"

corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/runtime"
)

func service(ctx *common.RenderContext) ([]runtime.Object, error) {
var annotations map[string]string
_ = ctx.WithExperimental(func(cfg *experimental.Config) error {
if cfg.IDE != nil && cfg.IDE.IDEProxyConfig != nil {
annotations = cfg.IDE.IDEProxyConfig.ServiceAnnotations
}
return nil
})

if ctx.Config.Components != nil && ctx.Config.Components.IDE != nil && ctx.Config.Components.IDE.Proxy != nil {
annotations = ctx.Config.Components.IDE.Proxy.ServiceAnnotations
}

ports := []common.ServicePort{
{
Expand Down
11 changes: 5 additions & 6 deletions install/installer/pkg/components/ide-proxy/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@ import (

"github.com/gitpod-io/gitpod/installer/pkg/common"
config "github.com/gitpod-io/gitpod/installer/pkg/config/v1"
"github.com/gitpod-io/gitpod/installer/pkg/config/v1/experimental"
"github.com/gitpod-io/gitpod/installer/pkg/config/versions"
)

func TestServiceAnnotations(t *testing.T) {
annotations := map[string]string{"hello": "world"}

ctx := renderContextWithIDEProxyConfig(t, &experimental.IDEProxyConfig{ServiceAnnotations: annotations})
ctx := renderContextWithIDEProxyConfig(t, &config.Proxy{ServiceAnnotations: annotations})

objects, err := service(ctx)
require.NoError(t, err)
Expand All @@ -33,11 +32,11 @@ func TestServiceAnnotations(t *testing.T) {
}
}

func renderContextWithIDEProxyConfig(t *testing.T, proxyConfig *experimental.IDEProxyConfig) *common.RenderContext {
func renderContextWithIDEProxyConfig(t *testing.T, proxyConfig *config.Proxy) *common.RenderContext {
ctx, err := common.NewRenderContext(config.Config{
Experimental: &experimental.Config{
IDE: &experimental.IDEConfig{
IDEProxyConfig: proxyConfig,
Components: &config.Components{
IDE: &config.IDEComponents{
Proxy: proxyConfig,
},
},
}, versions.Manifest{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"github.com/gitpod-io/gitpod/installer/pkg/common"
"github.com/gitpod-io/gitpod/installer/pkg/components/workspace"
"github.com/gitpod-io/gitpod/installer/pkg/components/workspace/ide"
"github.com/gitpod-io/gitpod/installer/pkg/config/v1/experimental"
"github.com/gitpod-io/gitpod/installer/pkg/config/versions"

ide_config "github.com/gitpod-io/gitpod/ide-service-api/config"
Expand Down Expand Up @@ -38,12 +37,9 @@ func ideConfigConfigmap(ctx *common.RenderContext) ([]runtime.Object, error) {

resolveLatestImage := func(name string, tag string, bundledLatest versions.Versioned) string {
resolveLatest := true
ctx.WithExperimental(func(ucfg *experimental.Config) error {
if ucfg.IDE != nil && ucfg.IDE.ResolveLatest != nil {
resolveLatest = *ucfg.IDE.ResolveLatest
}
return nil
})
if ctx.Config.Components != nil && ctx.Config.Components.IDE != nil && ctx.Config.Components.IDE.ResolveLatest != nil {
resolveLatest = *ctx.Config.Components.IDE.ResolveLatest
}
if resolveLatest {
return ctx.ImageName(ctx.Config.Repository, name, tag)
}
Expand Down
11 changes: 4 additions & 7 deletions install/installer/pkg/components/openvsx-proxy/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,17 @@ package openvsx_proxy
import (
"github.com/gitpod-io/gitpod/common-go/baseserver"
"github.com/gitpod-io/gitpod/installer/pkg/common"
"github.com/gitpod-io/gitpod/installer/pkg/config/v1/experimental"

corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/runtime"
)

func service(ctx *common.RenderContext) ([]runtime.Object, error) {
var annotations map[string]string
_ = ctx.WithExperimental(func(cfg *experimental.Config) error {
if cfg.IDE != nil && cfg.IDE.VSXProxyConfig != nil {
annotations = cfg.IDE.VSXProxyConfig.ServiceAnnotations
}
return nil
})

if ctx.Config.OpenVSX.Proxy != nil {
annotations = ctx.Config.OpenVSX.Proxy.ServiceAnnotations
}

ports := []common.ServicePort{
{
Expand Down
17 changes: 9 additions & 8 deletions install/installer/pkg/components/openvsx-proxy/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,19 @@ import (

"github.com/gitpod-io/gitpod/installer/pkg/common"
config "github.com/gitpod-io/gitpod/installer/pkg/config/v1"
"github.com/gitpod-io/gitpod/installer/pkg/config/v1/experimental"
"github.com/gitpod-io/gitpod/installer/pkg/config/versions"
)

func TestServiceAnnotations(t *testing.T) {
annotations := map[string]string{"hello": "world"}

ctx := renderContextWithVSXProxyConfig(t, &experimental.VSXProxyConfig{ServiceAnnotations: annotations})
ctx := renderContextWithVSXProxyConfig(t, &config.OpenVSX{
Proxy: &config.OpenVSXProxy{
Proxy: config.Proxy{
ServiceAnnotations: annotations,
},
},
})

objects, err := service(ctx)
require.NoError(t, err)
Expand All @@ -33,13 +38,9 @@ func TestServiceAnnotations(t *testing.T) {
}
}

func renderContextWithVSXProxyConfig(t *testing.T, proxyConfig *experimental.VSXProxyConfig) *common.RenderContext {
func renderContextWithVSXProxyConfig(t *testing.T, openvsxConfig *config.OpenVSX) *common.RenderContext {
ctx, err := common.NewRenderContext(config.Config{
Experimental: &experimental.Config{
IDE: &experimental.IDEConfig{
VSXProxyConfig: proxyConfig,
},
},
OpenVSX: *openvsxConfig,
}, versions.Manifest{
Components: versions.Components{
PublicAPIServer: versions.Versioned{
Expand Down
Loading

0 comments on commit 739cae9

Please sign in to comment.