sharingio / coder

Remote development environments on your infrastructure provisioned with Terraform
https://coder.com
GNU Affero General Public License v3.0
0 stars 1 forks source link

Use coder_{metadata, app} to expose kubeconfig #11

Closed hh closed 1 year ago

hh commented 1 year ago
hh commented 1 year ago

Try this, it's a single go binary, run it within the pod: https://github.com/tsl0922/ttyd

hh commented 1 year ago

` sudo apt-get install build-essential cmake git libjson-c-dev libwebsockets-dev git clone https://github.com/tsl0922/ttyd.git cd ttyd && mkdir build && cd build cmake .. make && sudo make install

hh commented 1 year ago
hh commented 1 year ago

Three ways to connect:

BobyMCbobs commented 1 year ago

GoTTY appears to be five years unmaintained

image image image
hh commented 1 year ago

ttyd looks pretty active: https://github.com/tsl0922/ttyd/graphs/contributors

BobyMCbobs commented 1 year ago

Can't seem to find ttyd x86_64 / amd64 prebuilds https://github.com/tsl0922/ttyd/releases/tag/1.7.2

hh commented 1 year ago

On pair:

curl -LO https://github.com/tsl0922/ttyd/releases/download/1.7.2/ttyd.x86_64
chmod +x ttyd.x86_64
./ttyd.x86_64 --version
ttyd version 1.7.2-020e2f3 
BobyMCbobs commented 1 year ago

On pair:

curl -LO https://github.com/tsl0922/ttyd/releases/download/1.7.2/ttyd.x86_64
chmod +x ttyd.x86_64
./ttyd.x86_64 --version
ttyd version 1.7.2-020e2f3 

Seems it was the last in the list. Missed that one. Thank you!

sbdtu5498 commented 1 year ago

@BobyMCbobs please do not bother yourself with this issue. I am working on it.

hh commented 1 year ago

ttyd is working now. Let's swing back around to coder_app "kubeconfig"

hh commented 1 year ago

https://jamesdefabia.github.io/docs/user-guide/kubectl/kubectl_config_set-cluster/

--insecure-skip-tls-verify=true

hh commented 1 year ago

The kubeconfig itself should be able to be populated via coder_metadata:

https://coder.com/docs/coder-oss/latest/secrets#displaying-secrets

BobyMCbobs commented 1 year ago

The kubeconfig itself should be able to be populated via coder_metadata:

https://coder.com/docs/coder-oss/latest/secrets#displaying-secrets

The problem we have been having to prevent this from being easy is due to how Terraform works. data will fetch the resource at the start and will not wait for the target resource to be created. This means that we will need to jump through hoops if to expose the kubeconfig at all.

Currently winding up with the following error

  data.kubernetes_secret_v1.kubeconfig: Refreshing...
  data.kubernetes_secret_v1.kubeconfig: Refresh complete after 0s
  Error: Attempt to get attribute from null value
  This value is null, so it does not have any attributes.
BobyMCbobs commented 1 year ago

Managed to get it working through a sleep in https://github.com/sharingio/coder/commit/48a5757e8c327b28764a817623693aa0049db999 and it shows up in the UI under namespace

The success should be taken lightly though, considering that sleep can make things flakey.

github-actions[bot] commented 1 year ago

This issue is becoming stale. In order to keep the tracker readable and actionable, I'm going close to this issue in 7 days if there isn't more activity.