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

fix: improve NAT handling in kubernetes environments" #30962

Closed
wants to merge 2 commits into from

Conversation

crStiv
Copy link

@crStiv crStiv commented Dec 27, 2024

Description

This PR fixes issue #30945 by improving NAT handling in Kubernetes environments. When running in K8s, the node should trust the externally provided IP address since container networking and service mesh handle NAT traversal.

Changes

  • Added detection of Kubernetes environment
  • Modified ExtIP.ExternalIP() to handle K8s case explicitly
  • Added unit tests for the new functionality

Testing

  • Added unit tests for Kubernetes environment detection
  • Tested manually in Kubernetes cluster

Related Issues

Fixes #30945

Backwards Compatibility

This change is fully backwards compatible as it only affects behavior in Kubernetes environments.

func (n ExtIP) ExternalIP() (net.IP, error) { return net.IP(n), nil }
func (n ExtIP) ExternalIP() (net.IP, error) {
if IsKubernetesEnvironment() {
return net.IP(n), nil
Copy link
Contributor

@ucwong ucwong Dec 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

en .. I think it is the same of return, whetherIsKubernetesEnvironment or not in this PR

@crStiv crStiv closed this Dec 27, 2024
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.

Advertised enode information is seen differently by peers
2 participants