kubefwd icon indicating copy to clipboard operation
kubefwd copied to clipboard

Exits immediately when watching an empty namespace

Open yuvipanda opened this issue 4 years ago • 4 comments

Awesome project, <3 it :)

When I run kubefwd svc -n new-namespace and new-namespace is empty, kubefwd exits immediately. However, I'm programmatically creating services there (via dask-kubernetes. So I'd like it to just stay and watch.

I can reproduce this with:

$ kubectl create ns test-empty-namespace
$ sudo kubefwd svc -n test-empty-namespace
INFO[12:26:30]  _          _           __             _
INFO[12:26:30] | | ___   _| |__   ___ / _|_      ____| |
INFO[12:26:30] | |/ / | | | '_ \ / _ \ |_\ \ /\ / / _  |
INFO[12:26:30] |   <| |_| | |_) |  __/  _|\ V  V / (_| |
INFO[12:26:30] |_|\_\\__,_|_.__/ \___|_|   \_/\_/ \__,_|
INFO[12:26:30]
INFO[12:26:30] Version 1.14.2
INFO[12:26:30] https://github.com/txn2/kubefwd
INFO[12:26:30]
INFO[12:26:30] Press [Ctrl-C] to stop forwarding.
INFO[12:26:30] 'cat /etc/hosts' to see all host entries.
INFO[12:26:30] Loaded hosts file /etc/hosts
INFO[12:26:30] Hostfile management: Original hosts backup already exists at /Users/yuvipanda/hosts.original
INFO[12:26:32] Succesfully connected context: gke_ucb-datahub-2018_us-central1_fall-2019
INFO[12:26:36] Done...

It works if there's already at least one ready service in the namespace - empty or headless services won't work.

I'm on MacOS, with kubefwd version 1.14.2

yuvipanda avatar Jun 27 '20 06:06 yuvipanda

@yuvipanda I think using kubefwd for empty namespaces is meaningless. Because, kubefwd should not introduce a waiting mechanism, try to have the correct service in your namespace in the future.

ndj888 avatar Sep 12 '21 14:09 ndj888

@ndj888 thank you for the reply. I agree it's meaningless for namespaces that will remain empty. However, in this case, the goal is to programmatically create them as the user performs actions with dask. If they create a big cluster for about 30 minutes, that will create services for that time duration only. So it isn't an 'empty namespace' as much as an 'intermittently empty' namespace. A --wait or similar flag would be very helpful here.

yuvipanda avatar Sep 13 '21 08:09 yuvipanda

@yuvipanda @cjimti Using --wait may not be the best solution. In subsequent versions, I think kubefwd can provide a set of programmable APIs to register those namespaces controlled by code. What do you think, we can do it with gin .

ndj888 avatar Sep 13 '21 11:09 ndj888

@cjimti In the next version, can we provide restful api using gin? This uses kubefwd in more usage scenarios, looking forward to yours. Yes, I have time to join the team and expand kubefwd for more opportunities.

ndj888 avatar Sep 15 '21 07:09 ndj888