kind: DevWorkspace
apiVersion: workspace.devfile.io/v1alpha2
metadata:
  name: web-terminal-dev
  annotations:
    controller.devfile.io/restricted-access: "true"
  labels:
    # it's a label OpenShift console uses a flag to mark terminal's workspaces
    console.openshift.io/terminal: "true"
spec:
  started: true
  routingClass: 'basic'
  template:
    components:
      # TODO: Remove once defaulting for web terminal is implemented.
      - name: dev
        container:
          image: quay.io/wto/web-terminal-tooling:latest
          mountSources: false
          memoryLimit: 256Mi
          args: ["tail", "-f", "/dev/null"]
          env:
            - value: '\[\e[34m\]>\[\e[m\]\[\e[33m\]>\[\e[m\]'
              name: PS1
      - name: web-terminal
        container:
          image: quay.io/eclipse/che-machine-exec:nightly
          mountSources: false
          command: ["/go/bin/che-machine-exec",
                    "--authenticated-user-id", "$(DEVWORKSPACE_CREATOR)",
                    "--idle-timeout", "$(DEVWORKSPACE_IDLE_TIMEOUT)",
                    "--pod-selector", "controller.devfile.io/devworkspace_id=$(DEVWORKSPACE_ID)",
                    "--use-bearer-token"]
          endpoints:
            - name: web-terminal
              targetPort: 4444
              secure: true
              exposure: public
              protocol: http
              attributes:
                type: main
          env:
            - name: USE_BEARER_TOKEN
              value: "true"
