Che: CHE_WORKSPACE_NAMESPACE value set in workspace does not match the CHE_INFRA_KUBERNETES_NAMESPACE_DEFAULT pattern

Created on 12 Mar 2020  路  13Comments  路  Source: eclipse/che

If CHE_INFRA_KUBERNETES_NAMESPACE_DEFAULT=foo-<username>
then the runtime value for CHE_WORKSPACE_NAMESPACE on has the <username> part.

The namespace itself is correct; just the env variable value is wrong.

aredoc kinquestion statuinfo-needed

All 13 comments

We don't expose the name of the Kubernetes namespace (or OpenShift project) the workspace runs in. The CHE_WORKSPACE_NAMESPACE environment variable contains what can basically be described as the name of the owner of the workspace. I've created a PR to the Che documentation to clarify the meaning of that environment variable.

@metlos @mingfang
Does it mean that the issue is solved?

@metlos @mingfang
Does it mean that the issue is solved?

What is the reason you don't expose the name of the Kubernetes namespace?

I workaround this issue using the Downwards API like this
https://github.com/mingfang/terraform-provider-k8s/blob/master/devfile.yaml#L33

@metlos I can't make sense of what is being said here. The var name, CHE_WORKSPACE_NAMESPACE, clearly indicates that it would contain the namespace. Also why would this info not be exposed. It is actually useful info. If you need a var that contains the owner then create a var that is named something that communicates that it contains the owner. Reasonable expectation is violated when the var CHE_WORKSPACE_NAMESPACE does not contain the namespace. If the names match the contents then documentation should be superfluous.

@mingfang @jflowers let's start from expectation. What do you want to see in the workspace?

right?

Wait there is a Che concept of namespace that is distinct from the kubernetes namespace?

Wait there is a Che concept of namespace that is distinct from the kubernetes namespace?

yes. As @metlos mention https://github.com/eclipse/che/issues/16325#issuecomment-598068062 it can be a username(in 99% cases) or organization name https://www.eclipse.org/che/docs/che-7/using-organizations/

I don't see the word namespace in that at all. It sounds like this variable was named poorly. I can't find in documentation anywhere that Che has a concept of a namespace distinct from kubernetes.

you right. That is a concept of che comes before the k8s era. We definitely need to improve our docs in this area.

okay, that is unfortunate.

To get back to you question... I am interested in knowing the kubernetes namespace so I can programmatically construct a URL to and endpoint in the Che Workspace...

If I set the endpoint name in the devfile.yaml I can use:
https://docs.openshift.com/enterprise/3.0/architecture/additional_concepts/networking.html

<endpoint_from_devfile>.<namespace>.endpoints.cluster.local

then I can run a selenium test against that from a Selenium Grid hosted in the same cluster

here is an example:
https://github.com/jflowers/spring-petclinic/blob/master/devfile.yaml

@mingfang @jflowers let's start from expectation. What do you want to see in the workspace?

right?

I was thinking of Kubernetes Namepspace

@jflowers you probably wants something like this https://github.com/eclipse/che/issues/15021 no?
@mingfang if there is no such information already exist I think it's legitimate request to add it.

@skabashnyuk that would be great, yes

Was this page helpful?
0 / 5 - 0 ratings