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

Provision default dockerimage for command-line-terminal. #82

Merged
merged 2 commits into from
May 25, 2020

Conversation

sleshchenko
Copy link
Member

What does this PR do?

The main purpose of this PR is making controller provision default dockerimage for command-line-terminal.

As a second commit, it also makes endpoint health check compatible with OpenShift OAuth Routing:

  1. Do not check TLS.
  2. Consider 401 or 403 as successful response from endpoint.

What issues does this PR fix or reference?

N/A

Known limitations

  1. Default dockerimage won't be applied if command line terminal is configured with reference.
    I tried to provision default dockerimage in component_controller.go where all plugins info is fetched but and dockerimage is successfully provisioned in workspace pod but no component is created.
    BTW This issue could be handled separately and this PR should contains enough to get rid of dockerimage component configuration on OpenShift Console.

Is it tested? How?

  1. Create a command-line terminal workspace without dockerimage:
cat << EOF | oc apply -f - 
# It's just an example of workspace configuration OpenShift Console creates
# when user requests terminal
apiVersion: workspace.che.eclipse.org/v1alpha1
kind: Workspace
metadata:
  name: command-line-terminal
spec:
  started: true
  devfile:
    apiVersion: 1.0.0
    metadata:
      name: command-line-terminal
    components:
      - alias: command-line-terminal
        type: cheEditor
        id: che-incubator/command-line-terminal/4.5.0
EOF
  1. Check that dockerimage component is created and workspace pod contains default openshift-plugin container.
  2. Update default dockerimage used by controller
oc patch configmap che-workspace-controller --patch '{ "data": { "che.workspace.default_dockerimage.che-incubator.command-line-terminal": "alias: dev\nargs:\n- tail\n- -f\n- /dev/null\nenv:\n- name: PS1\n  value: \\[\\e[34m\\]>\\[\\e[m\\]\\[\\e[33m\\]>\\[\\e[m\\]\nimage: quay.io/eclipse/che-sidecar-openshift-connector:0.1.2-2601509\nmemoryLimit: 256Mi\ntype: dockerimage\n" } }' --type=merge
kc rollout restart deployment che-workspace-controller
  1. Check that workspace is reconciled and dockerimage component is updated along with workspace pod.
  2. Provision dockerimage into workspace spec
cat << EOF | oc apply -f - 
# It's just an example of workspace configuration OpenShift Console creates
# when user requests terminal
apiVersion: workspace.che.eclipse.org/v1alpha1
kind: Workspace
metadata:
  name: command-line-terminal
spec:
  started: true
  devfile:
    apiVersion: 1.0.0
    metadata:
      name: command-line-terminal
    components:
      - alias: command-line-terminal
        type: cheEditor
        id: che-incubator/command-line-terminal/4.5.0
      - type: dockerimage
        memoryLimit: 256Mi
        alias: dev
        image: 'quay.io/eclipse/che-sidecar-openshift-connector:0.1.2-2601509'
        args: ["tail", "-f", "/dev/null"]
        env:
          - value: 'hello'
            name: PS1
EOF
  1. Verify that new env var came to dockerimage component + workspace pod.

@sleshchenko sleshchenko self-assigned this May 25, 2020
Copy link
Collaborator

@amisevsk amisevsk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

pkg/controller/workspace/provision/components.go Outdated Show resolved Hide resolved
pkg/config/cmd_terminal.go Outdated Show resolved Hide resolved
pkg/controller/workspace/provision/components.go Outdated Show resolved Hide resolved
pkg/controller/workspace/provision/components.go Outdated Show resolved Hide resolved
…al (devfile#82)

Signed-off-by: Sergii Leshchenko <sleshche@redhat.com>
…ng (devfile#82)

Signed-off-by: Sergii Leshchenko <sleshche@redhat.com>
@sleshchenko sleshchenko merged commit 21d2cd6 into devfile:master May 25, 2020
sleshchenko added a commit that referenced this pull request May 25, 2020
…al (#82)

Signed-off-by: Sergii Leshchenko <sleshche@redhat.com>
@sleshchenko sleshchenko deleted the defaultTerminalDevContainer branch May 25, 2020 15:20
christianvogt added a commit to christianvogt/console that referenced this pull request May 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants