che icon indicating copy to clipboard operation
che copied to clipboard

workspace pod is missing ram/cpu info

Open anselmov opened this issue 6 years ago • 10 comments

Summary

Hello, I'm trying to deploy che on my custom kubernetes cluster, it requires every pod to have specified ram/cpu info.

I've set those default limits in my config map:

  CHE_WORKSPACE_DEFAULT_MEMORY__LIMIT__MB: '300'
  CHE_WORKSPACE_DEFAULT_MEMORY__REQUEST__MB: '200'
  CHE_WORKSPACE_DEFAULT__CPU__LIMIT__CORES: '1'
  CHE_WORKSPACE_DEFAULT__CPU__REQUEST__CORES: '0.1'
  CHE_WORKSPACE_SIDECAR_DEFAULT__CPU__LIMIT__CORES: '1'
  CHE_WORKSPACE_SIDECAR_DEFAULT__CPU__REQUEST__CORES: '0.2'
  CHE_WORKSPACE_SIDECAR_DEFAULT__MEMORY__LIMIT__MB: '500'
  CHE_WORKSPACE_SIDECAR_DEFAULT__MEMORY__REQUEST__MB: '400'

Workspace startup is failing with:

Error: Failed to run the workspace: "Unrecoverable event occurred: 'FailedCreate', 'Error creating: pods "workspace0qgids43hjxohewl.maven-8f8d76bf9-rlpzx" is forbidden: failed quota: cedossan-rq: must specify limits.cpu,limits.memory,requests.cpu,requests.memory', 'workspace0qgids43hjxohewl.maven-8f8d76bf9'"

Relevant information

  • che version: 7.18.2

my devfile is based on java11 console sample with maven :

apiVersion: 1.0.0
metadata:
  name: java-mvn-uui22
projects:
  - name: console-java-simple
    source:
      location: 'https://path/to/console-java-simple.git'
      type: git
      branch: master
components:
  - mountSources: true
    cpuLimit: '1'
    memoryLimit: 512Mi
    cpuRequest: '1'
    type: dockerimage
    volumes:
      - name: m2
        containerPath: /home/user/.m2
    alias: maven
    image: 'quay.io/eclipse/che-java11-maven:7.18.2'
    env:
      - value: ''
        name: MAVEN_CONFIG
      - value: '-XX:MaxRAMPercentage=50 -XX:+UseParallelGC -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xms20m -Djava.security.egd=file:/dev/./urandom -Duser.home=/home/user'
        name: MAVEN_OPTS
      - value: '-XX:MaxRAMPercentage=50 -XX:+UseParallelGC -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xms20m -Djava.security.egd=file:/dev/./urandom'
        name: JAVA_OPTS
      - value: '-XX:MaxRAMPercentage=50 -XX:+UseParallelGC -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xms20m -Djava.security.egd=file:/dev/./urandom'
        name: JAVA_TOOL_OPTIONS
  - id: eclipse/che-theia/next
    type: cheEditor
  - id: redhat/java11/latest
    type: chePlugin
commands:
  - name: maven build
    actions:
      - workdir: '${CHE_PROJECTS_ROOT}/console-java-simple'
        type: exec
        command: mvn -s settings.xml clean install
        component: maven
  - name: maven build and run
    actions:
      - workdir: '${CHE_PROJECTS_ROOT}/console-java-simple'
        type: exec
        command: mvn -s settings.xml clean install && java -jar ./target/*.jar
        component: maven

Could you please help to specify those limits properly?

anselmov avatar Oct 05 '20 16:10 anselmov

Do simple workspaces (i.e. without quotas) start successfully?

ericwill avatar Oct 05 '20 18:10 ericwill

Yes, when I install on a cluster without this limits requirement workspaces start successfully. But what I want to do then is to install on a cluster where it is mandatory.

More info:

In che 7.8.0 provisioning was not implemented yet so I tried to patch

https://github.com/eclipse/che/blob/2bd0ea208fac5579cdb888e31b0b66f15bb6e94d/infrastructures/kubernetes/src/main/java/org/eclipse/che/workspace/infrastructure/kubernetes/util/Containers.java#L63

so it would add both ram and cpu limits with the same method. If I apply the same patch in 7.18.2 there is still missing limits/requests for workspace pod.

anselmov avatar Oct 06 '20 09:10 anselmov

cc @skabashnyuk is this a platform issue?

ericwill avatar Oct 06 '20 21:10 ericwill

cc @skabashnyuk is this a platform issue?

@ericwill looks so.

@anselmov can you try without dockerimage component. That is a known issue https://github.com/eclipse/che/issues/17540

skabashnyuk avatar Oct 07 '20 09:10 skabashnyuk

+1 as a quick debug action, i can reccomend to take a look into resulting yaml of this container in workspace pod to check that limits looks ok.

mshaposhnik avatar Oct 07 '20 10:10 mshaposhnik

cc @skabashnyuk is this a platform issue?

@ericwill looks so.

@anselmov can you try without dockerimage component. That is a known issue #17540

If I remove maven dockerimage, I get a similar error : pod "workspace6ji72333qp2zsorb.che-workspace-pod-7f77cc658b-45k2w" is missing limits.

I found this in debug logs:

[DEBUG] [etesEnvironmentProvisionerImpl 183]  - Provisioning Kubernetes environment done for workspace 'workspace6ji72333qp2zsorb'
[DEBUG] [.i.k.KubernetesInternalRuntime 311]  - Provisioning of workspace 'workspace6ji72333qp2zsorb' completed.

And deployment for workspace6ji72333qp2zsorb.che-workspace-pod had all containers with resources limits/requests set but this initContainer:

      initContainers:
        - name: remote-runtime-injectormrv
          image: >-
            quay.io/eclipse/che-theia-endpoint-runtime-binary:7.18.2
          env:
            - name: PLUGIN_REMOTE_ENDPOINT_EXECUTABLE
              value: /remote-endpoint/plugin-remote-endpoint
            - name: REMOTE_ENDPOINT_VOLUME_NAME
              value: remote-endpoint
          resources: {}

Also che-theia-endpoint-runtime-binary doesn't have resources set in maven workspace deployment. I've tried to set its limits in my plugin registry (and I select che-theia 7.19.0 in workspace creation GUI) :

  initContainers:
  - name: remote-runtime-injector
    image: "quay.io/eclipse/che-theia-endpoint-runtime-binary:7.19.0"
    cpuLimit: "2"
    cpuRequest: "2"

but still they were not propagated.

anselmov avatar Oct 07 '20 13:10 anselmov

@anselmov the setting you refer to is readonly (THE CONFIGMAP) and has to be set into the checluster/eclipse-che object using kubectl edit, and then you need to scale che deployment to 0 and back to 1 to restart che server with the new settings, which are additional to the configmap.

kubectl edit -n che checluster/eclipse-che
server:
    allowUserDefinedWorkspaceNamespaces: true
    cheCustomProperties:
      CHE_WORKSPACE_DEFAULT__CPU__LIMIT__CORES: 5999m
      CHE_WORKSPACE_DEFAULT__CPU__REQUEST__CORES: 1.75
kubectl -n che scale deployment/che --replicas=0 && \
kubectl -n che scale deployment/che --replicas=1

gattytto avatar Dec 03 '20 19:12 gattytto

Thanks for your help @gattytto but as I said in the first post, config map values didn't have any effect. As a workaround I searched for "initContainers" in the source code and added the request/limits there.

anselmov avatar Dec 03 '20 19:12 anselmov

you can set them in devfile too, in my current usecase (minikube+operator) changes are to be set to namespaces too:

apiVersion: 1.0.0
metadata:
  name: haskell
components:
  - id: eclipse/che-theia/next
    type: cheEditor
    cpuLimit: 1750m
    cpuRequest: 200m
  - preferences:
      haskell.languageServerVariant: ghcide
    type: chePlugin
    id: haskell/vscode-haskell/latest
    cpuLimit: 4001m
    cpuRequest: 200m

gattytto avatar Dec 03 '20 19:12 gattytto

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 Jun 07 '21 07:06 che-bot