che icon indicating copy to clipboard operation
che copied to clipboard

CHE_INFRA_KUBERNETES_NAMESPACE_ANNOTATIONS does not work as expected for OpenShift Node Selector annotation

Open simonkrenger opened this issue 10 months ago • 1 comments

Describe the bug

The customer would like to set the openshift.io/node-selector annotation on newly created namespaces. They are aware of devEnvironments.nodeSelector, but would like to set the Node Selector on the namespace via this annotation still.

When they set CHE_INFRA_KUBERNETES_NAMESPACE_ANNOTATIONS: openshift.io/node-selector=node-role.kubernetes.io/worker= in .spec.components.cheServer.extraProperties on the CheCluster however this does not work as expected (likely due to the "=" at the end). See the attached screenshots.

I believe this is a Bug on how these additional annotations are handled. Or do you have any hints on how to set the necessary annotation like openshift.io/node-selector: node-role.kubernetes.io/worker= on Dev Spaces namespaces?

Che version

other (please specify in additional context)

Steps to reproduce

  1. Set CHE_INFRA_KUBERNETES_NAMESPACE_ANNOTATIONS: openshift.io/node-selector=node-role.kubernetes.io/worker= in .spec.components.cheServer.extraProperties on the CheCluster
  2. Create a new Dev Space so that a new namespace is created
  3. Observe the annotations on the newly created namespace

Expected behavior

The annotation openshift.io/node-selector=node-role.kubernetes.io/worker= is set on the newly created namespace.

Runtime

OpenShift

Screenshots

Image

Image

Installation method

OperatorHub

Environment

Linux

Eclipse Che Logs


Additional context

No response

simonkrenger avatar Mar 05 '25 10:03 simonkrenger

@simonkrenger hello, please take a look at the similar issue https://github.com/eclipse-che/che/issues/23350 that might be useful. In general, annotations are expected to be comma-separated + if you override it you should consider adding che.eclipse.org/username=<username> (which is the default one)

# List of annotations to find {orch-namespace} prepared for {prod-short} user workspaces.
# Only {orch-namespace} matching the `che.infra.kubernetes.namespace.labels` is matched against these annotations.
# {orch-namespace} that matches both `che.infra.kubernetes.namespace.labels` and `che.infra.kubernetes.namespace.annotations`
# is used preferentially for user workspaces.
# It's possible to use `<username>` placeholder to specify the {orch-namespace} to concrete user.
# They are used to:
#  - Find prepared {orch-namespace} for users in combination with `che.infra.kubernetes.namespace.labels`.
#  - Actively annotate {orch-namespace} with any workspace.
che.infra.kubernetes.namespace.annotations=che.eclipse.org/username=<username>

however, if you think there is bug, contributions are most welcome ;-) see KubernetesNamespaceFactory.java

ibuziuk avatar Mar 05 '25 12:03 ibuziuk

Issues go stale after 180 days of inactivity. lifecycle/stale issues rot after an additional 7 days of inactivity and eventually close.

Mark the issue as fresh with /remove-lifecycle stale in a new comment.

If this issue is safe to close now please do so.

Moderators: Add lifecycle/frozen label to avoid stale mode.

che-bot avatar Nov 13 '25 08:11 che-bot