diff --git a/pkg/common/constants/constants.go b/pkg/common/constants/constants.go index fc7595feb..547add9c2 100644 --- a/pkg/common/constants/constants.go +++ b/pkg/common/constants/constants.go @@ -33,10 +33,12 @@ const ( DefaultDashboardCpuRequest = "100m" // PluginRegistry - DefaultPluginRegistryMemoryLimit = "1536Mi" - DefaultPluginRegistryMemoryRequest = "32Mi" - DefaultPluginRegistryCpuLimit = "500m" - DefaultPluginRegistryCpuRequest = "100m" + DefaultPluginRegistryMemoryLimit = "256Mi" + DefaultPluginRegistryMemoryLimitEmbeddedOpenVSXRegistry = "2Gi" + DefaultPluginRegistryMemoryRequest = "32Mi" + DefaultPluginRegistryMemoryRequestEmbeddedOpenVSXRegistry = "512Mi" + DefaultPluginRegistryCpuLimit = "500m" + DefaultPluginRegistryCpuRequest = "100m" // DevfileRegistry DefaultDevfileRegistryMemoryLimit = "256Mi" diff --git a/pkg/deploy/pluginregistry/pluginregistry_deployment.go b/pkg/deploy/pluginregistry/pluginregistry_deployment.go index 72adb2d27..ff7e70759 100644 --- a/pkg/deploy/pluginregistry/pluginregistry_deployment.go +++ b/pkg/deploy/pluginregistry/pluginregistry_deployment.go @@ -41,6 +41,11 @@ func (p *PluginRegistryReconciler) getPluginRegistryDeploymentSpec(ctx *chetypes }, } + if ctx.CheCluster.Spec.Components.PluginRegistry.OpenVSXURL == "" { + resources.Requests[corev1.ResourceMemory] = resource.MustParse(constants.DefaultPluginRegistryMemoryRequestEmbeddedOpenVSXRegistry) + resources.Limits[corev1.ResourceMemory] = resource.MustParse(constants.DefaultPluginRegistryMemoryLimitEmbeddedOpenVSXRegistry) + } + deployment := registry.GetSpecRegistryDeployment( ctx, registryType, diff --git a/pkg/deploy/pluginregistry/pluginregistry_deployment_test.go b/pkg/deploy/pluginregistry/pluginregistry_deployment_test.go index 4905b30a5..34791e814 100644 --- a/pkg/deploy/pluginregistry/pluginregistry_deployment_test.go +++ b/pkg/deploy/pluginregistry/pluginregistry_deployment_test.go @@ -36,7 +36,21 @@ func TestGetPluginRegistryDeploymentSpec(t *testing.T) { testCases := []testCase{ { - name: "Test default limits", + name: "Test default limits for embedded OpenVSX registry", + initObjects: []runtime.Object{}, + memoryLimit: constants.DefaultPluginRegistryMemoryLimitEmbeddedOpenVSXRegistry, + memoryRequest: constants.DefaultPluginRegistryMemoryRequestEmbeddedOpenVSXRegistry, + cpuLimit: constants.DefaultPluginRegistryCpuLimit, + cpuRequest: constants.DefaultPluginRegistryCpuRequest, + cheCluster: &chev2.CheCluster{ + ObjectMeta: metav1.ObjectMeta{ + Namespace: "eclipse-che", + Name: "eclipse-che", + }, + }, + }, + { + name: "Test default limits for external openVSX registry", initObjects: []runtime.Object{}, memoryLimit: constants.DefaultPluginRegistryMemoryLimit, memoryRequest: constants.DefaultPluginRegistryMemoryRequest, @@ -47,6 +61,13 @@ func TestGetPluginRegistryDeploymentSpec(t *testing.T) { Namespace: "eclipse-che", Name: "eclipse-che", }, + Spec: chev2.CheClusterSpec{ + Components: chev2.CheClusterComponents{ + PluginRegistry: chev2.PluginRegistry{ + OpenVSXURL: "open-vsx-url", + }, + }, + }, }, }, {