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

Consul name resolution ipv6 support #3074

Closed
Jhoysbou opened this issue Aug 11, 2023 · 4 comments · Fixed by #3075
Closed

Consul name resolution ipv6 support #3074

Jhoysbou opened this issue Aug 11, 2023 · 4 comments · Fixed by #3075
Assignees
Labels
kind/bug Something isn't working
Milestone

Comments

@Jhoysbou
Copy link
Contributor

Expected Behavior

Working service to service invocation on ipv6 network

Actual Behavior

When trying to use s2s invocation the following error occurs:

{
    "errorCode": "ERR_DIRECT_INVOKE",
    "message": "fail to invoke, id: api, err: failed to invoke target api after 3 retries. Error: rpc error: code = Unavailable desc = last connection error: connection error: desc = \"transport: Error while dialing: dial tcp: address 2001:db8:3333:4444:5555:6666:7777:8888:48186: too many colons in address\""
}

This code just adds the port regardless of the protocol version:

	if svc.Service.Address != "" {
		addr = svc.Service.Address + ":" + port
	} else if svc.Node.Address != "" {
		addr = svc.Node.Address + ":" + port
	} else {
		return "", fmt.Errorf("no healthy services found with AppID '%s'", req.ID)
	}

So for ipv6, it leads to an invalid ip.

The address should be [2001:db8:3333:4444:5555:6666:7777:8888]:48186

Steps to Reproduce the Problem

Run Consul server:

consul agent \
  -server \ 
  -data-dir=/tmp/consul \
  -bootstrap-expect=1 \
  -bind="<SERVER_IPV6_ADRESS>"

Run Consul client:

consul agent \
  -bind="<CLIENT_IPV6_ADDRESS>" \
  -data-dir=/tmp/consul \
  -retry-join="<SERVER_IPV6_ADRESS>"

Run the Consul client and the Dapr sidecar for both the caller and the called party.

The component config is as follows:

apiVersion: dapr.io/v1alpha1
kind: Configuration
metadata:
  name: appconfig
spec:
  nameResolution:
    component: "consul"
    configuration:
      selfRegister: true

Make a s2s invocation call
curl http://localhost:3500/v1.0/invoke/api/method/<SOME_METHOD_NAME>

Release Note

RELEASE NOTE: Fixed resolution of IPv6 addresses.

@Jhoysbou Jhoysbou added the kind/bug Something isn't working label Aug 11, 2023
@Jhoysbou
Copy link
Contributor Author

Created a fix proposal
#3075

@Jhoysbou
Copy link
Contributor Author

@MaxSchaefer

Hi! Could you please review this issue? I created a fix for it and checked with my network (it works fine).

I called you because I saw that you were doing something with this component before. If I'm wrong, please call someone else

@berndverst berndverst added this to the v1.12 milestone Sep 1, 2023
@berndverst
Copy link
Member

I'm merging your PR @Jhoysbou. If you think a PR is ready for review (tests pass etc) please don't keep it in draft mode. As a maintainer I generally ignore draft PRs.

@Jhoysbou
Copy link
Contributor Author

Jhoysbou commented Sep 2, 2023

Sure! Next time I do as you say

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants