From eb129271a5a305cb5e69bd7f2ec6815b4b57b116 Mon Sep 17 00:00:00 2001 From: Masaki Muranaka Date: Fri, 23 Feb 2024 06:33:09 +0000 Subject: [PATCH] Support `devWorkspace.ignoredUnrecoverableEvents`. --- api/v2/checluster_types.go | 7 +++++++ api/v2/zz_generated.deepcopy.go | 5 +++++ .../manifests/che-operator.clusterserviceversion.yaml | 4 ++-- .../manifests/org.eclipse.che_checlusters.yaml | 10 ++++++++++ config/crd/bases/org.eclipse.che_checlusters.yaml | 10 ++++++++++ deploy/deployment/kubernetes/combined.yaml | 10 ++++++++++ ...sters.org.eclipse.che.CustomResourceDefinition.yaml | 10 ++++++++++ deploy/deployment/openshift/combined.yaml | 10 ++++++++++ ...sters.org.eclipse.che.CustomResourceDefinition.yaml | 10 ++++++++++ ...sters.org.eclipse.che.CustomResourceDefinition.yaml | 10 ++++++++++ .../dev-workspace-config/dev_workspace_config.go | 7 +++++++ 11 files changed, 91 insertions(+), 2 deletions(-) diff --git a/api/v2/checluster_types.go b/api/v2/checluster_types.go index a9c008360..5e7d59b42 100644 --- a/api/v2/checluster_types.go +++ b/api/v2/checluster_types.go @@ -192,6 +192,13 @@ type CheClusterDevEnvironments struct { // WorkspacesPodAnnotations defines additional annotations for workspace pods. // +optional WorkspacesPodAnnotations map[string]string `json:"workspacesPodAnnotations,omitempty"` + // IgnoredUnrecoverableEvents defines a list of Kubernetes event names that should + // be ignored when deciding to fail a workspace that is starting. This option should be used + // if a transient cluster issue is triggering false-positives (for example, if + // the cluster occasionally encounters FailedScheduling events). Events listed + // here will not trigger workspace failures. + // +optional + IgnoredUnrecoverableEvents []string `json:"ignoredUnrecoverableEvents,omitempty"` } // Che components configuration. diff --git a/api/v2/zz_generated.deepcopy.go b/api/v2/zz_generated.deepcopy.go index 63c613e5e..d289d3bbc 100644 --- a/api/v2/zz_generated.deepcopy.go +++ b/api/v2/zz_generated.deepcopy.go @@ -309,6 +309,11 @@ func (in *CheClusterDevEnvironments) DeepCopyInto(out *CheClusterDevEnvironments (*out)[key] = val } } + if in.IgnoredUnrecoverableEvents != nil { + in, out := &in.IgnoredUnrecoverableEvents, &out.IgnoredUnrecoverableEvents + *out = make([]string, len(*in)) + copy(*out, *in) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CheClusterDevEnvironments. diff --git a/bundle/next/eclipse-che/manifests/che-operator.clusterserviceversion.yaml b/bundle/next/eclipse-che/manifests/che-operator.clusterserviceversion.yaml index 7c51ff1a1..d7edabac5 100644 --- a/bundle/next/eclipse-che/manifests/che-operator.clusterserviceversion.yaml +++ b/bundle/next/eclipse-che/manifests/che-operator.clusterserviceversion.yaml @@ -104,7 +104,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.v7.88.0-873.next + name: eclipse-che.v7.89.0-876.next namespace: placeholder spec: apiservicedefinitions: {} @@ -1036,7 +1036,7 @@ spec: minKubeVersion: 1.19.0 provider: name: Eclipse Foundation - version: 7.88.0-873.next + version: 7.89.0-876.next webhookdefinitions: - admissionReviewVersions: - v1 diff --git a/bundle/next/eclipse-che/manifests/org.eclipse.che_checlusters.yaml b/bundle/next/eclipse-che/manifests/org.eclipse.che_checlusters.yaml index af26cebcf..25ba7550f 100644 --- a/bundle/next/eclipse-che/manifests/org.eclipse.che_checlusters.yaml +++ b/bundle/next/eclipse-che/manifests/org.eclipse.che_checlusters.yaml @@ -7010,6 +7010,16 @@ spec: type: object type: object type: object + ignoredUnrecoverableEvents: + description: |- + IgnoredUnrecoverableEvents defines a list of Kubernetes event names that should + be ignored when deciding to fail a workspace that is starting. This option should be used + if a transient cluster issue is triggering false-positives (for example, if + the cluster occasionally encounters FailedScheduling events). Events listed + here will not trigger workspace failures. + items: + type: string + type: array imagePullPolicy: description: ImagePullPolicy defines the imagePullPolicy used for containers in a DevWorkspace. diff --git a/config/crd/bases/org.eclipse.che_checlusters.yaml b/config/crd/bases/org.eclipse.che_checlusters.yaml index ddab2990a..b3742bbf0 100644 --- a/config/crd/bases/org.eclipse.che_checlusters.yaml +++ b/config/crd/bases/org.eclipse.che_checlusters.yaml @@ -6963,6 +6963,16 @@ spec: type: object type: object type: object + ignoredUnrecoverableEvents: + description: |- + IgnoredUnrecoverableEvents defines a list of Kubernetes event names that should + be ignored when deciding to fail a workspace that is starting. This option should be used + if a transient cluster issue is triggering false-positives (for example, if + the cluster occasionally encounters FailedScheduling events). Events listed + here will not trigger workspace failures. + items: + type: string + type: array imagePullPolicy: description: ImagePullPolicy defines the imagePullPolicy used for containers in a DevWorkspace. diff --git a/deploy/deployment/kubernetes/combined.yaml b/deploy/deployment/kubernetes/combined.yaml index 4e32ca212..22526d7c5 100644 --- a/deploy/deployment/kubernetes/combined.yaml +++ b/deploy/deployment/kubernetes/combined.yaml @@ -6984,6 +6984,16 @@ spec: type: object type: object type: object + ignoredUnrecoverableEvents: + description: |- + IgnoredUnrecoverableEvents defines a list of Kubernetes event names that should + be ignored when deciding to fail a workspace that is starting. This option should be used + if a transient cluster issue is triggering false-positives (for example, if + the cluster occasionally encounters FailedScheduling events). Events listed + here will not trigger workspace failures. + items: + type: string + type: array imagePullPolicy: description: ImagePullPolicy defines the imagePullPolicy used for containers in a DevWorkspace. diff --git a/deploy/deployment/kubernetes/objects/checlusters.org.eclipse.che.CustomResourceDefinition.yaml b/deploy/deployment/kubernetes/objects/checlusters.org.eclipse.che.CustomResourceDefinition.yaml index b2706cb2b..1215ada3f 100644 --- a/deploy/deployment/kubernetes/objects/checlusters.org.eclipse.che.CustomResourceDefinition.yaml +++ b/deploy/deployment/kubernetes/objects/checlusters.org.eclipse.che.CustomResourceDefinition.yaml @@ -6979,6 +6979,16 @@ spec: type: object type: object type: object + ignoredUnrecoverableEvents: + description: |- + IgnoredUnrecoverableEvents defines a list of Kubernetes event names that should + be ignored when deciding to fail a workspace that is starting. This option should be used + if a transient cluster issue is triggering false-positives (for example, if + the cluster occasionally encounters FailedScheduling events). Events listed + here will not trigger workspace failures. + items: + type: string + type: array imagePullPolicy: description: ImagePullPolicy defines the imagePullPolicy used for containers in a DevWorkspace. diff --git a/deploy/deployment/openshift/combined.yaml b/deploy/deployment/openshift/combined.yaml index a115b46c2..be767243d 100644 --- a/deploy/deployment/openshift/combined.yaml +++ b/deploy/deployment/openshift/combined.yaml @@ -6984,6 +6984,16 @@ spec: type: object type: object type: object + ignoredUnrecoverableEvents: + description: |- + IgnoredUnrecoverableEvents defines a list of Kubernetes event names that should + be ignored when deciding to fail a workspace that is starting. This option should be used + if a transient cluster issue is triggering false-positives (for example, if + the cluster occasionally encounters FailedScheduling events). Events listed + here will not trigger workspace failures. + items: + type: string + type: array imagePullPolicy: description: ImagePullPolicy defines the imagePullPolicy used for containers in a DevWorkspace. diff --git a/deploy/deployment/openshift/objects/checlusters.org.eclipse.che.CustomResourceDefinition.yaml b/deploy/deployment/openshift/objects/checlusters.org.eclipse.che.CustomResourceDefinition.yaml index b77bd5304..3cf81b7d1 100644 --- a/deploy/deployment/openshift/objects/checlusters.org.eclipse.che.CustomResourceDefinition.yaml +++ b/deploy/deployment/openshift/objects/checlusters.org.eclipse.che.CustomResourceDefinition.yaml @@ -6979,6 +6979,16 @@ spec: type: object type: object type: object + ignoredUnrecoverableEvents: + description: |- + IgnoredUnrecoverableEvents defines a list of Kubernetes event names that should + be ignored when deciding to fail a workspace that is starting. This option should be used + if a transient cluster issue is triggering false-positives (for example, if + the cluster occasionally encounters FailedScheduling events). Events listed + here will not trigger workspace failures. + items: + type: string + type: array imagePullPolicy: description: ImagePullPolicy defines the imagePullPolicy used for containers in a DevWorkspace. diff --git a/helmcharts/next/crds/checlusters.org.eclipse.che.CustomResourceDefinition.yaml b/helmcharts/next/crds/checlusters.org.eclipse.che.CustomResourceDefinition.yaml index b2706cb2b..1215ada3f 100644 --- a/helmcharts/next/crds/checlusters.org.eclipse.che.CustomResourceDefinition.yaml +++ b/helmcharts/next/crds/checlusters.org.eclipse.che.CustomResourceDefinition.yaml @@ -6979,6 +6979,16 @@ spec: type: object type: object type: object + ignoredUnrecoverableEvents: + description: |- + IgnoredUnrecoverableEvents defines a list of Kubernetes event names that should + be ignored when deciding to fail a workspace that is starting. This option should be used + if a transient cluster issue is triggering false-positives (for example, if + the cluster occasionally encounters FailedScheduling events). Events listed + here will not trigger workspace failures. + items: + type: string + type: array imagePullPolicy: description: ImagePullPolicy defines the imagePullPolicy used for containers in a DevWorkspace. diff --git a/pkg/deploy/dev-workspace-config/dev_workspace_config.go b/pkg/deploy/dev-workspace-config/dev_workspace_config.go index 59ed273c9..91c0e9163 100644 --- a/pkg/deploy/dev-workspace-config/dev_workspace_config.go +++ b/pkg/deploy/dev-workspace-config/dev_workspace_config.go @@ -107,6 +107,8 @@ func updateWorkspaceConfig(ctx *chetypes.DeployContext, operatorConfig *controll updateAnnotations(devEnvironments.WorkspacesPodAnnotations, operatorConfig.Workspace) + updateIgnoredUnrecoverableEvents(operatorConfig, devEnvironments.IgnoredUnrecoverableEvents) + // If the CheCluster has a configured proxy, or if the Che Operator has detected a proxy configuration, // we need to disable automatic proxy handling in the DevWorkspace Operator as its implementation collides // with ours -- they set environment variables the deployment spec explicitly, which overrides the proxy-settings @@ -200,6 +202,11 @@ func updateAnnotations(annotations map[string]string, workspaceConfig *controlle workspaceConfig.PodAnnotations = annotations } +func updateIgnoredUnrecoverableEvents(operatorConfig *controllerv1alpha1.OperatorConfiguration, ignoredUnrecoverableEvents []string) { + operatorConfig.Workspace.IgnoredUnrecoverableEvents = ignoredUnrecoverableEvents +} + + func updateWorkspaceServiceAccountConfig(devEnvironments *chev2.CheClusterDevEnvironments, workspaceConfig *controllerv1alpha1.WorkspaceConfig) { isNamespaceAutoProvisioned := pointer.BoolDeref(devEnvironments.DefaultNamespace.AutoProvision, constants.DefaultAutoProvision)