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

Add init container to inject remote binary. #233

Merged
merged 15 commits into from
Oct 25, 2019
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions v3/plugins/eclipse/che-theia/next/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,15 @@ spec:
- exposedPort: 13132
- exposedPort: 13133
memoryLimit: "512M"
initContainers:
- name: remote-runtime-injector
image: eclipse/che-theia-endpoint-runtime-binary:next
volumes:
- mountPath: "/remote-endpoint"
name: remote-endpoint
ephemeral: true
env:
- name: PLUGIN_REMOTE_ENDPOINT_EXECUTABLE
value: /remote-endpoint/plugin-remote-endpoint
- name: REMOTE_ENDPOINT_VOLUME_NAME
value: remote-endpoint
4 changes: 4 additions & 0 deletions v3/plugins/redhat/java/0.38.0/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ spec:
- image: "docker.io/eclipse/che-remote-plugin-runner-java8:next"
name: vscode-java
memoryLimit: "1500Mi"
command:
- sh
- -c
- /before-start.sh && ${PLUGIN_REMOTE_ENDPOINT_EXECUTABLE}
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't really like the idea of updating all our old versions of plugins, especially since it requires understanding how remote plugin runner starts up; I think the entrypoint update should either be done in the plugin runner image or by the plugin broker when it provisions a remote runtime injector.

Also, does overriding this remove the UID fixes in the generic remote runtime entrypoint?

Copy link
Contributor

Choose a reason for hiding this comment

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

Preferably the plugin runner images could be updated to automatically look for and execute the injected runtime executable.

Choose a reason for hiding this comment

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

I think the entrypoint update should either be done in the plugin runner image or by the plugin broker when it provisions a remote runtime injector

+1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Preferably the plugin runner images could be updated to automatically look for and execute the injected runtime executable.

@amisevsk @davidfestal one of our goal for remote binary is ability to reuse existed rhel, ubi images without patching and rebuilding this images for CodeReady workspaces. And there a lot of VsCode extension which could work without UID fixes. But to improve this flow we really can use alternative solution. In the image with remote binary we can provide one more file - some script entrypoint.sh. Instead of running remote-binary in a straight way we will start it using this script. And this script could do some additional work: on start take a look if in the root '/' located entrypoint.sh - than start it and detach, if we don't have this file script could try to do uid fix and the end execute remote binary.
Proposed draft content:

entrypoint.sh for remote binary

#!/bin/sh


fixUID() {
        # Ensure $HOME exists when starting
        if [ ! -d "${HOME}" ]; then
          mkdir -p "${HOME}"
        fi
        
        # Setup $PS1 for a consistent and reasonable prompt
        if [ -w "${HOME}" ] && [ ! -f "${HOME}"/.bashrc ]; then
          echo "PS1='\s-\v \w \$ '" > "${HOME}"/.bashrc
        fi
        
        # Add current (arbitrary) user to /etc/passwd
        if ! whoami 2>&1 /dev/null; then
          if [ -w /etc/passwd ]; then
            echo "${USER_NAME:-user}:x:$(id -u):0:${USER_NAME:-user} user:${HOME}:/bin/bash" >> /etc/passwd
          fi
        fi
}


if [ -f "/entrypoint.sh" ]; then
        /entrypoint.sh &
else 
        fixUID
fi

${PLUGIN_REMOTE_ENDPOINT_EXECUTABLE}

@amisevsk @davidfestal This solution is OK for you?

Copy link
Contributor

Choose a reason for hiding this comment

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

@AndrienkoAleksandr +1 to that suggestion; I'd prefer to not have to override entrypoint on plugin runner -- ideally we could add this functionality without changing meta.yamls in the plugin registry.

extensions:
- https://github.com/microsoft/vscode-java-debug/releases/download/0.16.0/vscode-java-debug-0.16.0.vsix
- http://download.jboss.org/jbosstools/static/jdt.ls/stable/java-0.38.0-1373.vsix
4 changes: 4 additions & 0 deletions v3/plugins/redhat/java/0.43.0/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ spec:
- image: "docker.io/eclipse/che-remote-plugin-runner-java8:next"
name: vscode-java
memoryLimit: "1500Mi"
command:
- sh
- -c
- /before-start.sh && ${PLUGIN_REMOTE_ENDPOINT_EXECUTABLE}
extensions:
- https://github.com/microsoft/vscode-java-debug/releases/download/0.16.0/vscode-java-debug-0.16.0.vsix
- http://download.jboss.org/jbosstools/static/jdt.ls/stable/java-0.43.0-1473.vsix
4 changes: 4 additions & 0 deletions v3/plugins/redhat/java/0.45.0/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ spec:
- image: "docker.io/eclipse/che-remote-plugin-runner-java8:next"
name: vscode-java
memoryLimit: "1500Mi"
command:
- sh
- -c
- /before-start.sh && ${PLUGIN_REMOTE_ENDPOINT_EXECUTABLE}
extensions:
- https://github.com/microsoft/vscode-java-debug/releases/download/0.16.0/vscode-java-debug-0.16.0.vsix
- http://download.jboss.org/jbosstools/static/jdt.ls/stable/java-0.45.0-1523.vsix
4 changes: 4 additions & 0 deletions v3/plugins/redhat/java/0.46.0/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ spec:
- image: "docker.io/eclipse/che-remote-plugin-runner-java8:next"
name: vscode-java
memoryLimit: "1500Mi"
command:
- sh
- -c
- /before-start.sh && ${PLUGIN_REMOTE_ENDPOINT_EXECUTABLE}
extensions:
- https://github.com/microsoft/vscode-java-debug/releases/download/0.19.0/vscode-java-debug-0.19.0.vsix
- https://download.jboss.org/jbosstools/static/jdt.ls/stable/java-0.46.0-1549.vsix
4 changes: 4 additions & 0 deletions v3/plugins/redhat/java/latest/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ spec:
- image: "docker.io/eclipse/che-remote-plugin-runner-java8:next"
name: vscode-java
memoryLimit: "1500Mi"
command:
- sh
- -c
- /before-start.sh && ${PLUGIN_REMOTE_ENDPOINT_EXECUTABLE}
extensions:
- https://github.com/microsoft/vscode-java-debug/releases/download/0.19.0/vscode-java-debug-0.19.0.vsix
- https://download.jboss.org/jbosstools/static/jdt.ls/stable/java-0.46.0-1549.vsix
4 changes: 4 additions & 0 deletions v3/plugins/redhat/java11/0.46.0/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ spec:
- image: "docker.io/eclipse/che-remote-plugin-runner-java11:next"
name: vscode-java
memoryLimit: "1500Mi"
command:
- sh
- -c
- /before-start.sh && ${PLUGIN_REMOTE_ENDPOINT_EXECUTABLE}
extensions:
- https://github.com/microsoft/vscode-java-debug/releases/download/0.19.0/vscode-java-debug-0.19.0.vsix
- https://download.jboss.org/jbosstools/static/jdt.ls/stable/java-0.46.0-1549.vsix
4 changes: 4 additions & 0 deletions v3/plugins/redhat/java11/latest/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ spec:
- image: "docker.io/eclipse/che-remote-plugin-runner-java11:next"
name: vscode-java
memoryLimit: "1500Mi"
command:
- sh
- -c
- /before-start.sh && ${PLUGIN_REMOTE_ENDPOINT_EXECUTABLE}
extensions:
- https://github.com/microsoft/vscode-java-debug/releases/download/0.19.0/vscode-java-debug-0.19.0.vsix
- https://download.jboss.org/jbosstools/static/jdt.ls/stable/java-0.46.0-1549.vsix
4 changes: 4 additions & 0 deletions v3/plugins/redhat/java8/0.46.0/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ spec:
- image: "docker.io/eclipse/che-remote-plugin-runner-java8:next"
name: vscode-java
memoryLimit: "1500Mi"
command:
- sh
- -c
- /before-start.sh && ${PLUGIN_REMOTE_ENDPOINT_EXECUTABLE}
extensions:
- https://github.com/microsoft/vscode-java-debug/releases/download/0.19.0/vscode-java-debug-0.19.0.vsix
- https://download.jboss.org/jbosstools/static/jdt.ls/stable/java-0.46.0-1549.vsix
4 changes: 4 additions & 0 deletions v3/plugins/redhat/java8/latest/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ spec:
- image: "docker.io/eclipse/che-remote-plugin-runner-java8:next"
name: vscode-java
memoryLimit: "1500Mi"
command:
- sh
- -c
- /before-start.sh && ${PLUGIN_REMOTE_ENDPOINT_EXECUTABLE}
extensions:
- https://github.com/microsoft/vscode-java-debug/releases/download/0.19.0/vscode-java-debug-0.19.0.vsix
- https://download.jboss.org/jbosstools/static/jdt.ls/stable/java-0.46.0-1549.vsix