Fix SSH into GCP instance always using external IP#35151
Conversation
|
i'm unfamiliar with how GCP VM discovery works - is it always the case that the discovery service will be on the same network as the VM and can access the internal IP? |
avatus
left a comment
There was a problem hiding this comment.
I'm not too savy with how GCP is used with teleport. My instinct is saying that because this is just now coming up, there are some customers/users that rely on this external address and it works for them. I feel like this is a large change that might have some repercussions?
|
With trying both external and internal IP - what happens when external IP isn't reachable, e.g. because of net security rules? Does it hang until timeout before trying with the internal IP? If it does hang, maybe we can try dialing both and use whichever one succeeds first? |
bcbe853 to
ee4301f
Compare
|
@GavinFrazar I think dialing both is going to get complicated, and running the installer isn't a super time-sensitive task. I've added a generous timeout to the dialer to keep it from hanging too long if the external IP isn't accessible. |
There was a problem hiding this comment.
If the message being logged doesn't use any formatting directives it's more efficient to avoid the f variants.
| logrus.Debugf(string(stdout)) | |
| logrus.Debugf(string(stderr)) | |
| logrus.Debug(string(stdout)) | |
| logrus.Debug(string(stderr)) |
There was a problem hiding this comment.
| logrus.WithError(err).Debugf("Command exited with error.") | |
| logrus.WithError(err).Debug("Command exited with error.") |
There was a problem hiding this comment.
Does this case also indicate that the command was successful?
There was a problem hiding this comment.
Yes (or at least that the installer exited with code 0)
There was a problem hiding this comment.
How come we only log the output in the if block below and not here too?
This change fixes a bug where the discovery service would always try to SSH into a GCP instance with its external IP address, which may not exist.
3b5b50c to
733945c
Compare
This change fixes a bug where the discovery service would always try to SSH into a GCP instance with its external IP address, which may not exist.
Changelog: Fixed GCP VM auto-discovery not using instances' internal IP address