From 5552c48cd3b3dbaf573fc8f86dc2640f62c08712 Mon Sep 17 00:00:00 2001 From: Anatolii Bazko Date: Wed, 16 Mar 2022 12:09:55 +0200 Subject: [PATCH] Fixes Signed-off-by: Anatolii Bazko --- api/conversion_test.go | 11 ++++++++++ api/v1/conversion.go | 6 ++++++ api/v1/zz_generated.deepcopy.go | 1 - api/v2/checluster_types.go | 6 ++++++ api/v2/zz_generated.deepcopy.go | 2 +- api/v2alpha1/zz_generated.deepcopy.go | 3 +-- .../che-operator.clusterserviceversion.yaml | 20 +++++++++---------- .../manifests/org_v1_che_crd.yaml | 7 +++++++ config/crd/bases/org_v1_che_crd.yaml | 19 ++++++++++++++++++ .../che-operator.clusterserviceversion.yaml | 16 +++++++-------- helmcharts/next/crds/org_v1_che_crd.yaml | 19 ++++++++++++++++++ main.go | 2 +- 12 files changed, 87 insertions(+), 25 deletions(-) diff --git a/api/conversion_test.go b/api/conversion_test.go index 1aed587282..bc0fba6bad 100644 --- a/api/conversion_test.go +++ b/api/conversion_test.go @@ -170,6 +170,10 @@ func TestConvertTo(t *testing.T) { DevWorkspace: v1.CheClusterSpecDevWorkspace{ Enable: true, ControllerImage: "ControllerImage", + RunningLimit: "RunningLimit", + }, + Dashboard: v1.CheClusterSpecDashboard{ + Warning: "DashboardWarning", }, }, Status: v1.CheClusterStatus{ @@ -252,6 +256,7 @@ func TestConvertTo(t *testing.T) { assert.Equal(t, checlusterv2.Spec.Dashboard.Deployment.Container.Resources.Requests.Memory, "DashboardMemoryRequest") assert.Equal(t, checlusterv2.Spec.Dashboard.Deployment.SecurityContext.FsGroup, "SecurityContextFsGroup") assert.Equal(t, checlusterv2.Spec.Dashboard.Deployment.SecurityContext.RunAsUser, "SecurityContextRunAsUser") + assert.Equal(t, checlusterv2.Spec.Dashboard.Warning, "DashboardWarning") assert.Equal(t, checlusterv2.Spec.Database.CredentialsSecretRef, "ChePostgresSecret") assert.Equal(t, checlusterv2.Spec.Database.Deployment.Container.Image, "PostgresImage") @@ -271,6 +276,7 @@ func TestConvertTo(t *testing.T) { assert.Equal(t, checlusterv2.Spec.Database.Pvc.StorageClass, "PostgresPVCStorageClassName") assert.Equal(t, checlusterv2.Spec.DevWorkspace.Deployment.Container.Image, "ControllerImage") + assert.Equal(t, checlusterv2.Spec.DevWorkspace.RunningLimit, "RunningLimit") assert.Equal(t, checlusterv2.Spec.ImagePuller.Enable, true) assert.Equal(t, checlusterv2.Spec.Metrics.Enable, true) @@ -522,6 +528,7 @@ func TestConvertFrom(t *testing.T) { FsGroup: "FsGroup", }, }, + Warning: "DashboardWarning", }, Storage: v2.CheClusterSpecStorage{ Pvc: v2.PVC{ @@ -544,6 +551,7 @@ func TestConvertFrom(t *testing.T) { Image: "DevWorkspaceImage", }, }, + RunningLimit: "RunningLimit", }, }, Status: v2.CheClusterStatus{ @@ -595,6 +603,9 @@ func TestConvertFrom(t *testing.T) { assert.Equal(t, checlusterv1.Spec.Database.PvcClaimSize, "DatabaseClaimSize") assert.Equal(t, checlusterv1.Spec.DevWorkspace.ControllerImage, "DevWorkspaceImage") + assert.Equal(t, checlusterv1.Spec.DevWorkspace.RunningLimit, "RunningLimit") + + assert.Equal(t, checlusterv1.Spec.Dashboard.Warning, "DashboardWarning") assert.Equal(t, checlusterv1.Spec.ImagePuller.Enable, true) assert.Equal(t, checlusterv1.Spec.Metrics.Enable, true) diff --git a/api/v1/conversion.go b/api/v1/conversion.go index 9753fbf478..1a327b2cae 100644 --- a/api/v1/conversion.go +++ b/api/v1/conversion.go @@ -121,6 +121,7 @@ func (src *CheCluster) ConvertTo(dstRaw conversion.Hub) error { FsGroup: src.Spec.K8s.SecurityContextFsGroup, }, } + dst.Spec.Dashboard.Warning = src.Spec.Dashboard.Warning // Devfile registry dst.Spec.DevfileRegistry.DisableInternalRegistry = src.Spec.Server.ExternalDevfileRegistry @@ -261,6 +262,7 @@ func (src *CheCluster) ConvertTo(dstRaw conversion.Hub) error { Image: src.Spec.DevWorkspace.ControllerImage, }, } + dst.Spec.DevWorkspace.RunningLimit = src.Spec.DevWorkspace.RunningLimit // ImagePuller dst.Spec.ImagePuller.Enable = src.Spec.ImagePuller.Enable @@ -426,6 +428,7 @@ func (dst *CheCluster) ConvertFrom(srcRaw conversion.Hub) error { // DevWorkspace dst.Spec.DevWorkspace.ControllerImage = src.Spec.DevWorkspace.Deployment.Container.Image + dst.Spec.DevWorkspace.RunningLimit = src.Spec.DevWorkspace.RunningLimit // ImagePuller dst.Spec.ImagePuller.Enable = src.Spec.ImagePuller.Enable @@ -434,6 +437,9 @@ func (dst *CheCluster) ConvertFrom(srcRaw conversion.Hub) error { // Metrics dst.Spec.Metrics.Enable = src.Spec.Metrics.Enable + // Dashboard + dst.Spec.Dashboard.Warning = src.Spec.Dashboard.Warning + // Storage dst.Spec.Storage.PostgresPVCStorageClassName = src.Spec.Database.Pvc.StorageClass dst.Spec.Storage.PreCreateSubPaths = src.Spec.Storage.PreCreateSubPaths diff --git a/api/v1/zz_generated.deepcopy.go b/api/v1/zz_generated.deepcopy.go index ffac0d4f46..5d8eae6c0d 100644 --- a/api/v1/zz_generated.deepcopy.go +++ b/api/v1/zz_generated.deepcopy.go @@ -1,4 +1,3 @@ -//go:build !ignore_autogenerated // +build !ignore_autogenerated // diff --git a/api/v2/checluster_types.go b/api/v2/checluster_types.go index fb92bcbbeb..05e4b742da 100644 --- a/api/v2/checluster_types.go +++ b/api/v2/checluster_types.go @@ -171,6 +171,9 @@ type CheClusterSpecDashboard struct { // Deployment override options. // +optional Deployment DeploymentCustomSettings `json:"deployment,omitempty"` + // Warning message that will be displayed on the User Dashboard + // +optional + Warning string `json:"warning,omitempty"` } // Configuration settings related to the Plugin Registry used by the Che installation. @@ -289,6 +292,9 @@ type CheClusterSpecDevWorkspace struct { // Deployment override options. // +optional Deployment DeploymentCustomSettings `json:"deployment,omitempty"` + // Maximum number of the running workspaces per user. + // +optional + RunningLimit string `json:"runningLimit,omitempty"` } type WorkspacesDefaultPlugins struct { diff --git a/api/v2/zz_generated.deepcopy.go b/api/v2/zz_generated.deepcopy.go index dd45a4defb..b9284d5252 100644 --- a/api/v2/zz_generated.deepcopy.go +++ b/api/v2/zz_generated.deepcopy.go @@ -17,7 +17,7 @@ package v2 import ( - "k8s.io/api/core/v1" + v1 "k8s.io/api/core/v1" runtime "k8s.io/apimachinery/pkg/runtime" ) diff --git a/api/v2alpha1/zz_generated.deepcopy.go b/api/v2alpha1/zz_generated.deepcopy.go index ad7ac1b6a2..4a0ff7cda8 100644 --- a/api/v2alpha1/zz_generated.deepcopy.go +++ b/api/v2alpha1/zz_generated.deepcopy.go @@ -1,4 +1,3 @@ -//go:build !ignore_autogenerated // +build !ignore_autogenerated // @@ -18,7 +17,7 @@ package v2alpha1 import ( - "k8s.io/api/core/v1" + v1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/labels" runtime "k8s.io/apimachinery/pkg/runtime" ) diff --git a/bundle/next/eclipse-che-preview-openshift/manifests/che-operator.clusterserviceversion.yaml b/bundle/next/eclipse-che-preview-openshift/manifests/che-operator.clusterserviceversion.yaml index 856a23f253..20fd700bcd 100644 --- a/bundle/next/eclipse-che-preview-openshift/manifests/che-operator.clusterserviceversion.yaml +++ b/bundle/next/eclipse-che-preview-openshift/manifests/che-operator.clusterserviceversion.yaml @@ -75,7 +75,7 @@ metadata: operators.operatorframework.io/project_layout: go.kubebuilder.io/v3 repository: https://github.com/eclipse-che/che-operator support: Eclipse Foundation - name: eclipse-che-preview-openshift.v7.44.0-440.next + name: eclipse-che-preview-openshift.v7.45.0-441.next namespace: placeholder spec: apiservicedefinitions: {} @@ -122,15 +122,9 @@ spec: by the Che installation. displayName: Authentication path: auth - - description: Deprecated. The value of this flag is ignored. Sidecar functionality - is now implemented in Traefik plugin. - displayName: Gateway Header Rewrite Sidecar Image - path: auth.gatewayHeaderRewriteSidecarImage - x-descriptors: - - urn:alm:descriptor:com.tectonic.ui:hidden - - description: Configuration settings related to the User Dashboard used - by the Che installation. - displayName: User Dashboard + - description: Configuration settings related to the Dashboard sed by the + Che installation. + displayName: Devfile registry path: dashboard - description: Configuration settings related to the database used by the Che installation. @@ -255,6 +249,10 @@ spec: path: auth.gatewayHeaderRewriteSidecarImage x-descriptors: - urn:alm:descriptor:com.tectonic.ui:hidden + - description: Configuration settings related to the User Dashboard used + by the Che installation. + displayName: User Dashboard + path: dashboard - description: Configuration settings related to the database used by the Che installation. displayName: Database @@ -1421,7 +1419,7 @@ spec: maturity: stable provider: name: Eclipse Foundation - version: 7.44.0-440.next + version: 7.45.0-441.next webhookdefinitions: - admissionReviewVersions: - v1 diff --git a/bundle/next/eclipse-che-preview-openshift/manifests/org_v1_che_crd.yaml b/bundle/next/eclipse-che-preview-openshift/manifests/org_v1_che_crd.yaml index ef5d8269b3..fd8c248136 100644 --- a/bundle/next/eclipse-che-preview-openshift/manifests/org_v1_che_crd.yaml +++ b/bundle/next/eclipse-che-preview-openshift/manifests/org_v1_che_crd.yaml @@ -1449,6 +1449,10 @@ spec: type: string type: object type: object + warning: + description: Warning message that will be displayed on the User + Dashboard + type: string type: object database: description: Configuration settings related to the database used @@ -1627,6 +1631,9 @@ spec: type: string type: object type: object + runningLimit: + description: Maximum number of the running workspaces per user. + type: string type: object devfileRegistry: description: Configuration settings related to the Devfile registry diff --git a/config/crd/bases/org_v1_che_crd.yaml b/config/crd/bases/org_v1_che_crd.yaml index e1955817b8..5970ddde59 100644 --- a/config/crd/bases/org_v1_che_crd.yaml +++ b/config/crd/bases/org_v1_che_crd.yaml @@ -285,6 +285,15 @@ spec: first login. Defaults to `false`. type: boolean type: object + dashboard: + description: Configuration settings related to the User Dashboard + used by the Che installation. + properties: + warning: + description: Warning message that will be displayed on the User + Dashboard + type: string + type: object database: description: Configuration settings related to the database used by the Che installation. @@ -401,6 +410,9 @@ spec: installed. Fails when a non-matching version of the Operator is already installed. type: boolean + runningLimit: + description: Maximum number of the running workspaces per user. + type: string required: - enable type: object @@ -1421,6 +1433,10 @@ spec: type: string type: object type: object + warning: + description: Warning message that will be displayed on the User + Dashboard + type: string type: object database: description: Configuration settings related to the database used @@ -1599,6 +1615,9 @@ spec: type: string type: object type: object + runningLimit: + description: Maximum number of the running workspaces per user. + type: string type: object devfileRegistry: description: Configuration settings related to the Devfile registry diff --git a/config/manifests/bases/che-operator.clusterserviceversion.yaml b/config/manifests/bases/che-operator.clusterserviceversion.yaml index 4ed591aa69..1c0d51639e 100644 --- a/config/manifests/bases/che-operator.clusterserviceversion.yaml +++ b/config/manifests/bases/che-operator.clusterserviceversion.yaml @@ -74,15 +74,9 @@ spec: the Che installation. displayName: Authentication path: auth - - description: Deprecated. The value of this flag is ignored. Sidecar functionality - is now implemented in Traefik plugin. - displayName: Gateway Header Rewrite Sidecar Image - path: auth.gatewayHeaderRewriteSidecarImage - x-descriptors: - - urn:alm:descriptor:com.tectonic.ui:hidden - - description: Configuration settings related to the User Dashboard used by - the Che installation. - displayName: User Dashboard + - description: Configuration settings related to the Dashboard sed by the Che + installation. + displayName: Devfile registry path: dashboard - description: Configuration settings related to the database used by the Che installation. @@ -207,6 +201,10 @@ spec: path: auth.gatewayHeaderRewriteSidecarImage x-descriptors: - urn:alm:descriptor:com.tectonic.ui:hidden + - description: Configuration settings related to the User Dashboard used by + the Che installation. + displayName: User Dashboard + path: dashboard - description: Configuration settings related to the database used by the Che installation. displayName: Database diff --git a/helmcharts/next/crds/org_v1_che_crd.yaml b/helmcharts/next/crds/org_v1_che_crd.yaml index e1955817b8..5970ddde59 100644 --- a/helmcharts/next/crds/org_v1_che_crd.yaml +++ b/helmcharts/next/crds/org_v1_che_crd.yaml @@ -285,6 +285,15 @@ spec: first login. Defaults to `false`. type: boolean type: object + dashboard: + description: Configuration settings related to the User Dashboard + used by the Che installation. + properties: + warning: + description: Warning message that will be displayed on the User + Dashboard + type: string + type: object database: description: Configuration settings related to the database used by the Che installation. @@ -401,6 +410,9 @@ spec: installed. Fails when a non-matching version of the Operator is already installed. type: boolean + runningLimit: + description: Maximum number of the running workspaces per user. + type: string required: - enable type: object @@ -1421,6 +1433,10 @@ spec: type: string type: object type: object + warning: + description: Warning message that will be displayed on the User + Dashboard + type: string type: object database: description: Configuration settings related to the database used @@ -1599,6 +1615,9 @@ spec: type: string type: object type: object + runningLimit: + description: Maximum number of the running workspaces per user. + type: string type: object devfileRegistry: description: Configuration settings related to the Devfile registry diff --git a/main.go b/main.go index 35b56ff731..cee9ded79a 100644 --- a/main.go +++ b/main.go @@ -323,7 +323,7 @@ func main() { setupLog.Error(err, "unable to create webhook", "webhook", "CheCluster") os.Exit(1) } - + // +kubebuilder:scaffold:builder if err := mgr.AddHealthzCheck("healthz", healthz.Ping); err != nil { setupLog.Error(err, "unable to set up health check")