Giter VIP home page Giter VIP logo

container-terminal's People

Contributors

benjaminapetersen avatar jwforres avatar markdemaria avatar martinpitt avatar rhamilto avatar spadgett avatar stefwalter avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

container-terminal's Issues

using java websocket open container shell successfully but no response with following command

this is the websocket between font end and back end:

File configFile = new File("config/kubeconfig");
final String configYAML;
configYAML = String.join("\n",Files.readAllLines(configFile.toPath()));
Config kubernetesConfig = Config.fromKubeconfig(configYAML);
kubernetesConfig.setTrustCerts(true);

String urlStr = "https://127.0.0.1/api/v1/namespaces/namespace1/pods/pod1/exec?container=container1&stdin=true&stdout=true&stderr=true&tty=true&command=sh&pretty=true&follow=true";
URL url = new URL(urlStr);
clientWebSocketListener = initServerWebSocket(url, kubernetesConfig);
clientWebSocketListener.setSession(session);

@OnMessage
public void onMessage(Session session, byte[] messages) throws UnsupportedEncodingException {
    if (Objects.isNull(session)) {
            return;
        }
        String sessionId = session.getId();
        WebsocketMapping websocketMapping = clients.get(sessionId);
        ClientWebSocketListener listener = websocketMapping.getListener();
        try {
            // 向apiServer发送消息
            listener.waitUntilReady(1);
            listener.send(message.getBytes(), message.length);
        } catch (IOException | InterruptedException ie) {
            // 通知发送方
            session.getAsyncRemote().sendText("向apiServer发送消息失败!失败消息内容: " + message);
        }
}

private static ClientWebSocketListener initServerWebSocket(URL url, Config  config) {
        OkHttpClient client = HttpClientUtils.createHttpClient(config);
        final ClientWebSocketListener serverWebSocketListener = new ClientWebSocketListener();
        final Request.Builder request = new Request.Builder().url(url).get();
        final OkHttpClient clone = client.newBuilder().readTimeout(0, TimeUnit.MILLISECONDS).build();
        clone.newWebSocket(request.build(), serverWebSocketListener);
        return serverWebSocketListener;

    }

here is the onmessage in websocket between apiserver and back end

@Override
    public void onMessage(WebSocket webSocket, ByteString bytes) {
        readyLatch.countDown();
        this.getSession().getAsyncRemote().sendBinary(ByteBuffer.wrap(bytes.toByteArray()));
    }

    @Override
    public void onMessage(WebSocket webSocket, String text) {
        readyLatch.countDown();
        this.getSession().getAsyncRemote().sendText(text);

    }

the problem is this url open container shell successfully but have no response in the following command like ls, or cd bin/. is there are some format conver I miss or some step I miss?

this question confuse me for a long time

Could I use it in a Vue project?

Hi, it's a great project which may help a lot. and I am not good at front end programming, so I got a question.

I noticed that you used angular module method in the base example, and it could be used in a normal HTML file, so could I use it in a vue project?

thanks.

wss with access_token cannot work for k8s web socket

It seems "wss" protocol cannot work for k8s web socket.

I tried url "wss://:8080/api/v1/namespaces/kube-system/pods/kube-dns-v11-6l18b/exec?stdout=1&stdin=1&stderr=1&tty=1&container=etcd&command=%2Fbin%2Fsh&command=-i&access_token=". The error message is "OSStatus error -9847".

If I replace "wss" with "ws",it works fine!

Is there anything need to be configured on k8s to make "wss" connection work?

Access token in query is working?

Seems likely access_token in the query of url is not working with the newer versions of k8s.
Is there any other way to authenticate the request?
Regards.

The problem of terminal operation under ordinary users

We need to use normal users instead of root users to enter the container terminal,
so change the value of "command" in line 180 of the file 'container-terminal.js' to ["/bin/sh", "-c","useradd ser > /dev/null 2>&1; su - ser "];However, we found many problems in the use of terminals under ordinary users:

  1. Chinese cannot be inserted between double quotation marks;
  2. Vim log file cursor cannot be moved;
  3. Slow terminal response;

amd bug

//row21 to row24

if (typeof(define) === 'function' && define.amd)
    define(["base1/angular", "base1/term" ], factory);
  else
    factory(root.angular, root.Terminal);

When define is defined, it trys to load base1/angular and base1/term,but the problem comes out:
there's no base1/angular and base1/term !
ps: I install the module by bower install

Publish out 'status' attribute

It seems something like this would be helpful:

<kubernetes-container-terminal 
  status="status"></kubernetes-container-terminal>

It would be nice to have at least a connected="true||false published out, but perhaps a status="some-string-status" would be more useful?

For 'disconnected', I imagine we can update this in line 197 via the socket.on('close'), or line 154 in the fatal() func, or line 207 in the disconnect() function.

Thinking a bit about the best option, may PR it. The initial goal is to be able to track when the terminal crashes/died unexpectedly & hook into this for other UI.

Changelog

Quick suggestion since we are using the container terminal in the openshift web console as well now. I see the "subject to change" disclaimer on the README.md file. It is much easier to keep up with these changes if the releases lists feature, bug, breaking change, so wanted to toss that suggestion out there.

Thanks!

Provide attributes on directive for configuring rows, cols

This would allow the user of the directive to detect screen size and adjust the terminal accordingly.

Will submit a PR shortly, with an update something like:

var term = new Terminal({
    cols: scope.cols || 80,
    rows: scope.rows || 24,
    screenKeys: scope.screenKeys || true
}); 

Could not connect to the container. Do you have sufficient privileges?

I'm getting the following error. Hitting the correct IP server and URI. If I load it via GET request I get the following

{
  "kind": "Status",
  "apiVersion": "v1",
  "metadata": {},
  "status": "Failure",
  "message": "Upgrade request required",
  "reason": "BadRequest",
  "code": 400
}

I can issue commands just fine from kubectl exec. I'm not using any auth (that I know of) or ssl. I can access exec remotely from my laptop into a cluster in AWS

./kubectl --server="10.122.0.20:8080" exec api-ext-blue-1swdd --namespace=api-ext date
Sun Oct 11 14:42:56 UTC 2015

Not sure what is going on

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.