Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to set JAVA_OPTS or MAVEN_OPTS in kubernetes component of devfile #13340

Closed
sleshchenko opened this issue May 15, 2019 · 6 comments
Closed
Assignees
Labels
kind/bug Outline of a bug - must adhere to the bug report template. severity/blocker Causes system to crash and be non-recoverable or prevents Che developers from working on Che code.
Milestone

Comments

@sleshchenko
Copy link
Member

Description

Unable to set JAVA_OPTS or MAVEN_OPTS in kubernetes component of devfile since Che Server overrides it with its owns values.

Reproduction Steps

  1. Create a workspace from the following Devfile.
Devfile
specVersion: 0.0.1
name: spring-petclinic
projects:
  - name: spring-petclinic
    source:
      type: git
      location: 'https://github.com/sleshchenko/spring-petclinic.git'
components:
  - alias: theia-ide
    type: cheEditor
    id: eclipse/che-theia/next
  - alias: mysql
    type: openshift
    referenceContent: |
      apiVersion: v1
      kind: List
      items:
      - apiVersion: v1
        kind: Pod
        metadata:
          name: mysql-petclinic
          labels:
            app.kubernetes.io/name: petclinic
            app.kubernetes.io/component: mysql
        spec:
          containers:
          - name: mysql
            image: centos/mysql-57-centos7
            env:
            - name: MYSQL_USER
              value: petclinic
            - name: MYSQL_PASSWORD
              value: petclinic
            - name: MYSQL_ROOT_PASSWORD
              value: petclinic
            - name: MYSQL_DATABASE
              value: petclinic
            volumeMounts:
            - mountPath: /var/lib/mysql/data
              name: mysql-storage
            ports:
            - containerPort: 3306
              protocol: TCP
            resources:
              limits:
                memory: 512Mi
          volumes:
          - name: mysql-storage
            persistentVolumeClaim:
              claimName: mysql-storage
      - kind: Service
        apiVersion: v1
        metadata:
          name: mysql
          labels:
            app.kubernetes.io/name: petclinic
            app.kubernetes.io/component: mysql
        spec:
          ports:
            - name: mysql
              port: 3306
              targetPort: 3306
          selector:
            app.kubernetes.io/name: petclinic
            app.kubernetes.io/component: mysql
      - kind: PersistentVolumeClaim
        apiVersion: v1
        metadata:
          labels:
            app: petclinic
          name: mysql-storage
        spec:
          accessModes:
          - ReadWriteOnce
          resources:
            requests:
              storage: 1Gi
  - alias: petclinic
    type: openshift
    referenceContent: |
      apiVersion: v1
      kind: List
      items:
      - apiVersion: v1
        kind: Pod
        metadata:
          name: petclinic
          labels:
            app.kubernetes.io/name: petclinic
            app.kubernetes.io/component: web-app
        spec:
          containers:
          - name: server
            image: sleshchenko/petclinic
            ports:
            - containerPort: 8080
              protocol: TCP
            resources:
              limits:
                memory: 2Gi
            env:
            - name: MAVEN_OPTS
              value: '-Xmx1500m'
            volumeMounts:
            - mountPath: /projects
              name: projects
          volumes:
          - name: projects
            persistentVolumeClaim:
              claimName: projects
      - kind: Service
        apiVersion: v1
        metadata:
          name: petclinic
          labels:
            app.kubernetes.io/name: petclinic
            app.kubernetes.io/component: web-app
        spec:
          ports:
            - name: web
              port: 8080
              targetPort: 8080
          selector:
            app.kubernetes.io/name: petclinic
            app.kubernetes.io/component: web-app
      - apiVersion: v1
        kind: Route
        metadata:
          name: nodejs-web-endpoint
          labels:
            app.kubernetes.io/name: petclinic
            app.kubernetes.io/component: web-app
        spec:
          to:
            kind: Service
            name: petclinic
          port:
            targetPort: web
      - apiVersion: v1
        kind: PersistentVolumeClaim
        metadata:
          name: projects
          labels:
            app.kubernetes.io/name: petclinic
            app.kubernetes.io/component: web-app
        spec:
          accessModes:
           - ReadWriteOnce
          resources:
            requests:
              storage: 1Gi
    entrypoints:
      - containerName: server
        command: ["tail"]
        args: ["-f", "/dev/null"]
commands:
  - name: build
    actions:
      - type: exec
        component: petclinic
        command: './mvnw package'
        workdir: /projects/spring-petclinic
  - name: run
    actions:
      - type: exec
        component: petclinic
        command: java -jar /spring-petclinic-2.1.0.BUILD-SNAPSHOT.jar --spring.profiles.active=mysql
        workdir: /projects/spring-petclinic
  - name: mysql-version
    actions:
      - type: exec
        component: mysql
        command: mysql --version
  1. Open a terminal in server container.
  2. Check MAVEN_OPTS env var.
    Expected: MAVEN_OPTS=-Xmx1500m
    Actual: Value from Che Server configuration -XX:MaxRAM=150m -XX:MaxRAMFraction=2 -... -Djava.security.egd=file:/dev/./urandom
    https://github.com/eclipse/che/blob/master/assembly/assembly-wsmaster-war/src/main/webapp/WEB-INF/classes/che/che.properties#L80
    And as result maven build fails with Out of memory
@sleshchenko sleshchenko added kind/bug Outline of a bug - must adhere to the bug report template. status/open-for-dev An issue has had its specification reviewed and confirmed. Waiting for an engineer to take it. labels May 15, 2019
@sleshchenko
Copy link
Member Author

sleshchenko commented May 15, 2019

It's related to #12679, #12728

@l0rd
Copy link
Contributor

l0rd commented Jun 14, 2019

@sleshchenko @skabashnyuk I missed this issue. I think it's an important one to fix during this sprint. Adding che7GA label.

@l0rd l0rd added target/che7GA severity/P1 Has a major impact to usage or development of the system. labels Jun 14, 2019
@l0rd
Copy link
Contributor

l0rd commented Jun 14, 2019

@sleshchenko I guess this is true for any type of devfile component, not only for kubernetes right?

@amisevsk
Copy link
Contributor

@ibuziuk This explains the issue you were having.

@skabashnyuk
Copy link
Contributor

skabashnyuk commented Jun 14, 2019

it depends on

Will be fixed by

@l0rd l0rd mentioned this issue Jun 27, 2019
85 tasks
@l0rd l0rd added severity/blocker Causes system to crash and be non-recoverable or prevents Che developers from working on Che code. target/che7GA and removed target/che7GA severity/P1 Has a major impact to usage or development of the system. status/open-for-dev An issue has had its specification reviewed and confirmed. Waiting for an engineer to take it. labels Jun 27, 2019
@l0rd l0rd added this to the 7.0.0 milestone Jun 27, 2019
@skabashnyuk
Copy link
Contributor

should be fixed by #13612

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Outline of a bug - must adhere to the bug report template. severity/blocker Causes system to crash and be non-recoverable or prevents Che developers from working on Che code.
Projects
None yet
Development

No branches or pull requests

4 participants