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

Config to disable hostname return from container #2395

Closed
papapumpnz opened this issue Apr 26, 2024 · 2 comments · Fixed by #2396
Closed

Config to disable hostname return from container #2395

papapumpnz opened this issue Apr 26, 2024 · 2 comments · Fixed by #2396
Labels
enhancement New feature or request

Comments

@papapumpnz
Copy link

When stealing traffic from a container, any requests to obtain the hostname will return the hostname of the container being stole.

Example (python 3.11):

from socket import gethostname

print (gethostname())

this will return the hostname of the container in the kubernetes cluster. It would be good to override this feature for times when you still want a call in your app to return the hostname of the workstation running the debug session, rather than the stolen container.

Example scenario:

Your application attempts to determine if it is running in a Kubernetes container or locally in your IDE to set some additional config depending on the outcome. If we always get the stolen containers hostname, we would have to introduce another way to determine if running locally in an IDE.

Other Options:

Dont use hostname as a variable to determine if running locally. Use something like checking for TTY, ie

import sys

if sys.stdout.isatty():
    print("Not running in an IDE")
else:
    print("Running in an IDE")

Not really ideal.

@papapumpnz papapumpnz added the enhancement New feature or request label Apr 26, 2024
@aviramha
Copy link
Member

aviramha commented Apr 26, 2024

Not sure if that'd be a suitable solution, but some people do

{
{"feature": {"env": {"override": {"MIRRORD_IN_USE": "True"}}}
}

then check in code if mirrord is used with that (key can be anything ofc, also value)

@aviramha
Copy link
Member

Implemented in #2396
It will be released on next minor version, probably Sunday.

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.

2 participants