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

Associate port forward to a domain name #171

Closed
merlindorin opened this issue Mar 3, 2024 · 14 comments · Fixed by #184
Closed

Associate port forward to a domain name #171

merlindorin opened this issue Mar 3, 2024 · 14 comments · Fixed by #184
Assignees
Labels
enhancement New feature or request

Comments

@merlindorin
Copy link

Is your feature request related to a problem? Please describe.
I can have a lot of port-forward but naming them and having the ability to use them easily will be nice :).

Describe the solution you'd like
Add the ability to associate a domain to a forward. A local reverse proxy would be nice :) .

Describe alternatives you've considered
Nope, I am lazy

@hcavarsan
Copy link
Owner

hcavarsan commented Mar 3, 2024

quick thought on a solution - i'd have to change the /etc/hosts file on the machine, and that might mess things up on the user's local machine.

but i'll think on it and circle back with more info...

having the domain with the same alias would be a cool feature, thanks for the feedback!

@hcavarsan
Copy link
Owner

hcavarsan commented Mar 27, 2024

@merlindorin released ! https://github.com/hcavarsan/kftray/releases/tag/v0.9.0

when adding a new configuration, you can now choose to use an alias as a local domain name. If this option is enabled, when starting a new port forward in this configuration, kftray will add a new entry to the host file of the OS. This entry will add the alias and the local address. (this entry will be removed when port forwarding stops.)

image

can you check if it helps?

If you have any questions, please let me know

@merlindorin
Copy link
Author

This is awesome, gonna check that once I am back from vacation . Thx!

@merlindorin
Copy link
Author

merlindorin commented Mar 31, 2024

Hi @hcavarsan , checking the feature and it is not working. I also checked the host file and it is unmodified.

I have this configuration:

Screenshot 2024-03-31 at 16 34 22

Some check I've done:

I used the link to open it in the browser. Didn't work.
curl http://argocd.cluster:8090/
curl: (6) Could not resolve host: argocd.cluster
ping argocd.cluster

ping: cannot resolve argocd.cluster: Unknown host
cat /etc/hosts

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1	localhost
255.255.255.255	broadcasthost
::1             localhost
# Added by Docker Desktop
# To allow the same kube context to work on the host and the container:
127.0.0.1 kubernetes.docker.internal
# End of section

@hcavarsan
Copy link
Owner

hcavarsan commented Apr 1, 2024

hey @merlindorin , im reopening the issue to look into it... could you give me some more details:

  • what OS are you using?
  • did you try closing and reopening the app to see if the issue persists?
  • could you try installing the app via Homebrew to see if the same issue occurs?

ill see if i can simulate the issue on my end.

thx for the feedback!

@hcavarsan hcavarsan reopened this Apr 1, 2024
@hcavarsan
Copy link
Owner

hey, @merlindorin! are you still having the issue with the alias?

@merlindorin
Copy link
Author

merlindorin commented Apr 11, 2024

Re, sry for the delay.

  • what OS are you using? MacOS 14 Sonoma on M1.
  • did you try closing and reopening the app to see if the issue persists? Yes, and the issue is still there
  • could you try installing the app via Homebrew to see if the same issue occurs? Not working

btw, the brew installation method does not work on MacOS. The installer needs pnpm and even if it is installed it still need it...

brew install --HEAD kftray
==> Fetching hcavarsan/kftray/kftray
==> Cloning https://github.com/hcavarsan/kftray.git
Updating /Users/merlin/Library/Caches/Homebrew/kftray--git
==> Checking out branch main
Already on 'main'
Your branch is up to date with 'origin/main'.
HEAD is now at ebf28a3 fix: fix arrow position in windows OS
==> Installing kftray from hcavarsan/kftray
Warning: A newer Command Line Tools release is available.
Update them from Software Update in System Settings.

If that doesn't show you any updates, run:
  sudo rm -rf /Library/Developer/CommandLineTools
  sudo xcode-select --install

Alternatively, manually download them from:
  https://developer.apple.com/download/all/.
You should download the Command Line Tools for Xcode 15.1.

==> npm install -ddd --global --build-from-source --cache=/Users/merlin/Library/Caches/Homebrew/npm_cache --prefix=/opt/homebrew/Cellar/kftray/HEAD-ebf28a3/libexec /private/tmp/kftray-20240412-12011-v0uca2/kftray-0.9.6.tgz
==> npm install
==> npm run tauri build -- -b app
Last 15 lines from /Users/merlin/Library/Logs/Homebrew/kftray/03.npm:
npm
run
tauri
build
--
-b
app


> [email protected] tauri
> tauri build -b app

     Running beforeBuildCommand `pnpm build`
sh: pnpm: command not found
       Error beforeBuildCommand `pnpm build` failed with exit code 127

If reporting this issue please do so at (not Homebrew/brew or Homebrew/homebrew-core):
  https://github.com/hcavarsan/homebrew-kftray/issues


Error: A newer Command Line Tools release is available.
Update them from Software Update in System Settings.

If that doesn't show you any updates, run:
  sudo rm -rf /Library/Developer/CommandLineTools
  sudo xcode-select --install

Alternatively, manually download them from:
  https://developer.apple.com/download/all/.
You should download the Command Line Tools for Xcode 15.1.

kftray's formula was built from an unstable upstream --HEAD.
This build failure is expected behaviour.
Do not create issues about this on Homebrew's GitHub repositories.
Any opened issues will be immediately closed without response.
Do not ask for help from Homebrew or its maintainers on social media.
You may ask for help in Homebrew's discussions but are unlikely to receive a response.
Try to figure out the problem yourself and submit a fix as a pull request.
We will review it but may or may not accept it.

@hcavarsan
Copy link
Owner

@merlindorin got it! to install with brew, you need to install xcode first using xcode-select --install. I'll include this info in the readme. thanks!

also, could you run KFTray with enabled logs and check for errors in the logs? you can share the logs with me if you prefer.

io generate the logs, run this command in the terminal:

RUST_LOG="trace" KFTRAY_DEBUG="true" open /Applications/kftray.app

The logs file will be created in $HOME/.kftray/app.log.

@merlindorin
Copy link
Author

xcode is already installed. The issue is sh: pnpm: command not found (even installed locally, do not want to work :/ ).

About the issue by itself... well it is now clear enough:

[2024-04-14T06:50:21Z ERROR kubeforward::port_forward] Failed to write to the hostfile for argocd-server: Permission denied (os error 13)

@hcavarsan
Copy link
Owner

hcavarsan commented Apr 15, 2024

@merlindorin It looks like the problem is with the /etc/ directory being quite restricted. I'm going to look into a solution for this. In the meantime, there are two possible ways to address the issue and use the aliases:

  1. Run sudo chmod ugo+rw /etc/hosts to grant write permission to this file.
  2. Execute kftray with sudo by running sudo /Applications/kftray.app/Contents/MacOS/kftray.

These solutions are not the most secure since they grant write permission to the file itself, but they will resolve the issue for now. I'll keep this issue open to track the progress of the possible implementation to a more secure way (although it's unclear if that's feasible, as the app requires write permissions in the hosts file), is that okay with you?

Regarding the pnpm point, I've fixed it here: hcavarsan/homebrew-kftray@a6edaff. Now, if you run brew update and brew install, it should work :)

Thank you for the analysis and logs.

@merlindorin
Copy link
Author

Awesome! Thanks a lot. Each day is a better day ;)

@hcavarsan
Copy link
Owner

cool @merlindorin, i opened issue #230 to track and improve the local domain changes. thx for reporting these issues with kftray, it really makes the app better and more consistent :)

@mprimeaux
Copy link

Has this issue been addressed?

@hcavarsan
Copy link
Owner

not yet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants