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

Can not use integrated terminal when running locally #2

Open
vlgermanov opened this issue Oct 15, 2023 · 4 comments
Open

Can not use integrated terminal when running locally #2

vlgermanov opened this issue Oct 15, 2023 · 4 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@vlgermanov
Copy link

Hello Ivan,

Running kexp locally I am not able to use the integrated terminal.

kexp version:

$ kexp --version
kexp version 0.0.4 (build: 2023-10-13T10:27:27Z commit: 9d3786b51993927c6c9f657464fa7e8f227b2ffd)

Steps to reproduce:

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 22.04.3 LTS
Release:	22.04
Codename:	jammy

$ kind version
kind v0.20.0 go1.20.4 linux/amd64

$ kind create cluster
Creating cluster "kind" ...
 ✓ Ensuring node image (kindest/node:v1.27.3) 🖼
 ✓ Preparing nodes 📦  
 ✓ Writing configuration 📜 
 ✓ Starting control-plane 🕹️ 
 ✓ Installing CNI 🔌 
 ✓ Installing StorageClass 💾 
Set kubectl context to "kind-kind"
You can now use your cluster with:

kubectl cluster-info --context kind-kind

Have a nice day! 👋

$ kubectl version --short
Flag --short has been deprecated, and will be removed in the future. The --short output will become the default.
Client Version: v1.27.2
Kustomize Version: v5.0.1
Server Version: v1.27.3

$ kubectl get pods -A
NAMESPACE            NAME                                         READY   STATUS    RESTARTS        AGE
kube-system          coredns-5d78c9869d-fnw28                     1/1     Running   0               106s
kube-system          coredns-5d78c9869d-xrsj5                     1/1     Running   0               106s
kube-system          etcd-kind-control-plane                      1/1     Running   0               2m48s
kube-system          kindnet-9nfc7                                1/1     Running   0               106s
kube-system          kube-apiserver-kind-control-plane            1/1     Running   0               2m52s
kube-system          kube-controller-manager-kind-control-plane   1/1     Running   1 (2m28s ago)   2m48s
kube-system          kube-proxy-gsrlq                             1/1     Running   0               106s
kube-system          kube-scheduler-kind-control-plane            1/1     Running   1 (2m24s ago)   2m48s
local-path-storage   local-path-provisioner-6bc4bddd6b-dbsjc      1/1     Running   1 (67s ago)     106s

$ kexp --version
kexp version 0.0.4 (build: 2023-10-13T10:27:27Z commit: 9d3786b51993927c6c9f657464fa7e8f227b2ffd)

$ kexp 
{"contexts":[{}],"level":"debug","msg":"Kube context discovery finished","time":"2023-10-15T04:09:24+02:00"}
{"level":"info","msg":"Starting server on 127.0.0.1:5173","time":"2023-10-15T04:09:24+02:00"}
[GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.
 - using env:	export GIN_MODE=release
 - using code:	gin.SetMode(gin.ReleaseMode)

[GIN-debug] GET    /api/kube/v1/contexts/    --> github.com/iximiuz/kexp/api/rest/kube/contexts.(*Handler).List-fm (3 handlers)
[GIN-debug] GET    /api/kube/v1/contexts/:ctx/resources/ --> github.com/iximiuz/kexp/api/rest/kube/resources.(*Handler).List-fm (3 handlers)
[GIN-debug] GET    /api/kube/v1/contexts/:ctx/resources/:group/:version/:resource/ --> github.com/iximiuz/kexp/api/rest/kube/objects.(*Handler).List-fm (3 handlers)
[GIN-debug] GET    /api/kube/v1/contexts/:ctx/resources/:group/:version/namespaces/:namespace/:resource/ --> github.com/iximiuz/kexp/api/rest/kube/objects.(*Handler).List-fm (3 handlers)
[GIN-debug] GET    /api/kube/v1/contexts/:ctx/resources/:group/:version/:resource/:name/ --> github.com/iximiuz/kexp/api/rest/kube/objects.(*Handler).Get-fm (3 handlers)
[GIN-debug] GET    /api/kube/v1/contexts/:ctx/resources/:group/:version/namespaces/:namespace/:resource/:name/ --> github.com/iximiuz/kexp/api/rest/kube/objects.(*Handler).Get-fm (3 handlers)
[GIN-debug] PUT    /api/kube/v1/contexts/:ctx/resources/:group/:version/:resource/:name/ --> github.com/iximiuz/kexp/api/rest/kube/objects.(*Handler).Update-fm (3 handlers)
[GIN-debug] PUT    /api/kube/v1/contexts/:ctx/resources/:group/:version/namespaces/:namespace/:resource/:name/ --> github.com/iximiuz/kexp/api/rest/kube/objects.(*Handler).Update-fm (3 handlers)
[GIN-debug] DELETE /api/kube/v1/contexts/:ctx/resources/:group/:version/:resource/:name/ --> github.com/iximiuz/kexp/api/rest/kube/objects.(*Handler).Delete-fm (3 handlers)
[GIN-debug] DELETE /api/kube/v1/contexts/:ctx/resources/:group/:version/namespaces/:namespace/:resource/:name/ --> github.com/iximiuz/kexp/api/rest/kube/objects.(*Handler).Delete-fm (3 handlers)
[GIN-debug] GET    /api/stream/v1/           --> github.com/iximiuz/kexp/api/stream.(*Handler).Connect-fm (3 handlers)
[GIN-debug] GET    /ui/*filepath             --> github.com/gin-gonic/gin.(*RouterGroup).createStaticHandler.func1 (3 handlers)
[GIN-debug] HEAD   /ui/*filepath             --> github.com/gin-gonic/gin.(*RouterGroup).createStaticHandler.func1 (3 handlers)
[GIN-debug] GET    /                         --> main.run.func1.1 (3 handlers)
[GIN-debug] [WARNING] You trusted all proxies, this is NOT safe. We recommend you to set a value.
Please check https://pkg.go.dev/github.com/gin-gonic/gin#readme-don-t-trust-all-proxies for details.
[GIN-debug] Listening and serving HTTP on 127.0.0.1:5173
[GIN] 2023/10/15 - 04:10:14 | 301 |      47.803µs |       127.0.0.1 | GET      "/"
[GIN-debug] redirecting request 301: /ui/ --> /ui/
[GIN] 2023/10/15 - 04:10:14 | 200 |    3.444919ms |       127.0.0.1 | GET      "/ui/"
[GIN] 2023/10/15 - 04:10:14 | 200 |       72.75µs |       127.0.0.1 | GET      "/ui/fonts/inter/inter.css"
[GIN] 2023/10/15 - 04:10:14 | 200 |     397.437µs |       127.0.0.1 | GET      "/ui/assets/index-bc11076a.js"
[GIN] 2023/10/15 - 04:10:14 | 200 |     154.111µs |       127.0.0.1 | GET      "/ui/assets/index-1d5c257f.css"
[GIN] 2023/10/15 - 04:10:14 | 200 |      81.783µs |       127.0.0.1 | GET      "/api/kube/v1/contexts/"
[GIN] 2023/10/15 - 04:10:14 | 200 |     102.147µs |       127.0.0.1 | GET      "/ui/favicon.ico"
[GIN] 2023/10/15 - 04:10:14 | 200 |    3.725723ms |       127.0.0.1 | GET      "/api/kube/v1/contexts/kind-kind/resources/"
[GIN] 2023/10/15 - 04:10:14 | 200 |      64.526µs |       127.0.0.1 | GET      "/ui/logos/github.png"
[GIN] 2023/10/15 - 04:10:14 | 200 |     189.231µs |       127.0.0.1 | GET      "/ui/fonts/inter/Inter-roman.var.woff2?v=3.19"
[GIN] 2023/10/15 - 04:13:19 | 301 |      45.704µs |       127.0.0.1 | GET      "/"
[GIN-debug] redirecting request 301: /ui/ --> /ui/
[GIN] 2023/10/15 - 04:13:19 | 200 |      40.252µs |       127.0.0.1 | GET      "/ui/"
[GIN] 2023/10/15 - 04:13:19 | 200 |      81.454µs |       127.0.0.1 | GET      "/ui/fonts/inter/inter.css"
[GIN] 2023/10/15 - 04:13:19 | 200 |     240.904µs |       127.0.0.1 | GET      "/ui/assets/index-1d5c257f.css"
[GIN] 2023/10/15 - 04:13:19 | 200 |     595.604µs |       127.0.0.1 | GET      "/ui/assets/index-bc11076a.js"
[GIN] 2023/10/15 - 04:13:19 | 200 |      28.716µs |       127.0.0.1 | GET      "/api/kube/v1/contexts/"
[GIN] 2023/10/15 - 04:13:19 | 200 |     100.288µs |       127.0.0.1 | GET      "/ui/favicon.ico"
[GIN] 2023/10/15 - 04:13:19 | 200 |    8.701133ms |       127.0.0.1 | GET      "/api/kube/v1/contexts/kind-kind/resources/"
[GIN] 2023/10/15 - 04:13:19 | 200 |      72.513µs |       127.0.0.1 | GET      "/ui/logos/github.png"
[GIN] 2023/10/15 - 04:13:20 | 200 |     147.648µs |       127.0.0.1 | GET      "/ui/fonts/inter/Inter-roman.var.woff2?v=3.19"
[GIN] 2023/10/15 - 04:13:45 | 200 |      85.755µs |       127.0.0.1 | GET      "/ui/fonts/inter/inter.css"
[GIN] 2023/10/15 - 04:13:45 | 200 |     131.744µs |       127.0.0.1 | GET      "/ui/assets/index-1d5c257f.css"

When I click on the Terminal button - it opens just a black block without any prompt. Tried with Google Chrome and Firefox:

kexp-terminal-issue-chrome

Thanks,
Vladimir

@iximiuz
Copy link
Owner

iximiuz commented Oct 15, 2023

Hi @vlgermanov! Yes, I'm afraid it's not supported yet. The primary use case for kexp so far has been labs.iximiuz.com, where one can easily get a link for a web terminal session of the playground via an API call. kexp leverages the iximiuz Labs API and simply embeds an iframe with the link it gets in the response. When I use kexp outside of the Labs, I often pair it with github.com/yudai/gotty. With gotty, it's also easy to get a link for a web term session, but some hardcoding is required then to make kexp use it.

A "plug-in" web term implementation may solve the problem. On different environments, different means can be used to obtain a session URL (the native iximiuz Labs API, manually obtained gotty link, and even built-in web term implementation). Contributions are always welcome!

@iximiuz iximiuz added help wanted Extra attention is needed good first issue Good for newcomers labels Oct 15, 2023
@ayoub-tl
Copy link

ayoub-tl commented Nov 1, 2023

Hello, @iximiuz is there any way to pass the URL of the Iframe, when running kexp locally ? can it get passed down as parameter or is there any config param where i can set the terminal URL to be embedded inside the UI ??
Thank you

@ayoub-tl
Copy link

ayoub-tl commented Nov 2, 2023

Never mind i found it, i replaced the URL WebTerm.vue Line 31 with as static Webterminal url
image

@iximiuz
Copy link
Owner

iximiuz commented Nov 2, 2023

Hey @ayoub-tl - yes, that's pretty much what I do when I test kexp locally. Usually, I start a separate https://github.com/yudai/gotty process and then just hardcode the URL that it produces. Ideally, of course, it should be "out-of-the-box" behavior. Hopefully, I'll find time to implement it soon, or someone could open a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants