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

Move saving of hosts file to after all ports are forwarded #76

Merged
merged 1 commit into from
Aug 25, 2019
Merged

Move saving of hosts file to after all ports are forwarded #76

merged 1 commit into from
Aug 25, 2019

Conversation

rmja
Copy link
Contributor

@rmja rmja commented Aug 21, 2019

This fixes #74

@cjimti
Copy link
Member

cjimti commented Aug 23, 2019

@rmja Thank you for working on this. I can take a deeper look at it this coming weekend. I have some things to contemplate. Some people would like kubefwd to monitor connections and re-connect on pod failures, which would mean removing and adding new entries through the duration of the run. In other circumstances, some people on my team do not want to wait till all forwards have completed before they can start accessing services that have begun their forward (we have some namespaces with hundreds of services.) There is another ticket asking for a feature to monitor a namespace and forward any new services. These conditions all make the case for keeping isolated writes to /etc/hosts. I am hoping that I can think of a workable compromise.

@rmja
Copy link
Contributor Author

rmja commented Aug 23, 2019

Year, I can see the conflict. How about assigning IP's and writing the hosts file up front, and then actually map the services afterwards?

@cjimti
Copy link
Member

cjimti commented Aug 25, 2019

@rmja I am going to merge this and test a few adjustments. I need to work on #75 which is somewhat related in that kubefwd does not reload the state of /etc/hosts before removing entries and saving, therefore saving over any entries added by other processes while kubefwd is sunning.

@cjimti cjimti merged commit cf75499 into txn2:master Aug 25, 2019
@cjimti
Copy link
Member

cjimti commented Aug 25, 2019

In relase 1.9.1

I split the difference. The initial write to `/etc/hosts/' happens after all the forwards have completed (per your PR) however I need to reload and save when exiting each routine to fix #75.

Thank you for your contribution!

D3-LucaPiombino pushed a commit to CodeCoil/kubefwd that referenced this pull request Jun 13, 2024
Move saving of hosts file to after all ports are forwarded
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Race when updating hosts file?
2 participants