apiVersion: workspace.devfile.io/v1alpha2
kind: DevWorkspaceTemplate
metadata:
  name: che-idea-quarkus-quickstart
spec:
  commands:
    - id: init-container-command
      apply:
        component: idea-rhel8-injector
  events:
    preStart:
      - init-container-command
  components:
    - name: idea-rhel8
      container:
        image: registry.redhat.io/devspaces/udi-rhel8:3.5
        command:
          - /projector/entrypoint-volume.sh
        env:
          - name: PROJECTOR_ASSEMBLY_DIR
            value: /projector
          - name: PROJECTOR_CONFIG_DIR
            value: /home/user/.jetbrains
        volumeMounts:
          - name: projector-volume
            path: /projector
          - name: projector-configuration
            path: /home/user/.jetbrains
          - name: projector-java-configuration
            path: /home/user/.java
        memoryLimit: 6144Mi
        memoryRequest: 2048Mi
        cpuLimit: 2000m
        cpuRequest: 1500m
        endpoints:
          - name: intellij
            attributes:
              type: main
              cookiesAuthEnabled: true
              discoverable: false
              urlRewriteSupported: true
              secure: false
            targetPort: 8887
            exposure: public
            path: /?backgroundColor=434343&wss
            protocol: http
          - name: intellij-redirect-1
            attributes:
              discoverable: false
              urlRewriteSupported: false
            targetPort: 13131
            exposure: public
            protocol: http
          - name: intellij-redirect-2
            attributes:
              discoverable: false
              urlRewriteSupported: false
            targetPort: 13132
            exposure: public
            protocol: http
          - name: intellij-redirect-3
            attributes:
              discoverable: false
              urlRewriteSupported: false
            targetPort: 13133
            exposure: public
            protocol: http
      attributes:
        app.kubernetes.io/component: idea-rhel8-injector
        app.kubernetes.io/part-of: idea-rhel8.eclipse.org
    - name: projector-volume
      volume: {}
    - name: projector-configuration
      volume: {}
    - name: projector-java-configuration
      volume: {}
    - name: idea-rhel8-injector
      container:
        image: registry.redhat.io/devspaces/idea-rhel8:3.5
        command:
          - /projector/entrypoint-init-container.sh
        env:
          - name: PROJECTOR_VOLUME_MOUNT
            value: /projector-volume
          - name: PROJECTOR_ASSEMBLY_DIR
            value: /projector
        volumeMounts:
          - name: projector-volume
            path: /projector-volume
        memoryLimit: 128Mi
        memoryRequest: 32Mi
        cpuLimit: 500m
        cpuRequest: 30m
---
apiVersion: workspace.devfile.io/v1alpha2
kind: DevWorkspace
metadata:
  name: quarkus-quickstart
spec:
  started: true
  template:
    components:
      - name: tools
        container:
          image: registry.redhat.io/devspaces/udi-rhel8:3.5
          env:
            - name: QUARKUS_HTTP_HOST
              value: 0.0.0.0
          endpoints:
            - exposure: none
              name: debug
              protocol: tcp
              targetPort: 5005
            - exposure: public
              name: hello-greeting-endpoint
              protocol: http
              targetPort: 8080
              path: /hello/greeting/devspaces-user
          volumeMounts:
            - name: m2
              path: /home/user/.m2
          memoryLimit: 4G
          mountSources: true
        attributes:
          controller.devfile.io/merge-contribution: true
      - name: m2
        volume:
          size: 1G
    commands:
      - id: 1-package
        exec:
          component: tools
          workingDir: ${PROJECTS_ROOT}/quarkus-quickstarts/getting-started
          commandLine: mvn package
          group:
            kind: build
            isDefault: true
      - id: 2-startdev
        exec:
          label: Start Development mode (Hot reload + debug)
          component: tools
          workingDir: ${PROJECTS_ROOT}/quarkus-quickstarts/getting-started
          commandLine: mvn compile quarkus:dev
          group:
            kind: run
            isDefault: true
    projects:
      - name: quarkus-quickstarts
        zip:
          location: '{{ INTERNAL_URL }}/resources/v2/quarkus-quickstarts.zip'
  contributions:
    - name: editor
      kubernetes:
        name: che-idea-quarkus-quickstart
