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

Starter doesn’t work in an IPv6 cluster #171

Closed
yann-soubeyrand opened this issue Dec 5, 2022 · 4 comments · Fixed by #437
Closed

Starter doesn’t work in an IPv6 cluster #171

yann-soubeyrand opened this issue Dec 5, 2022 · 4 comments · Fixed by #437
Labels
enhancement New feature or request evaluation needed

Comments

@yann-soubeyrand
Copy link

Brief summary

In an IPv6 cluster, the starter pod logs this error:

curl: (3) IPv6 numerical address used in URL without brackets

k6-operator version or image

latest

K6 YAML

apiVersion: k6.io/v1alpha1
kind: K6
metadata:
  name: load-test
  namespace: load-testing
spec:
  parallelism: 100
  script:
    configMap:
      name: load-test
      file: load-test.js
  separate: true
  runner:
    resources:
      requests:
        cpu: 1
        memory: 4G

Other environment details (if applicable)

No response

Steps to reproduce the problem

Create an IPv6 cluster on AWS EKS, deploy the operator inside and start a test.

Expected behaviour

The test run as expected.

Actual behaviour

The test doesn’t start because the operator doesn’t seem to handle IPv6.

@yann-soubeyrand yann-soubeyrand added the bug Something isn't working label Dec 5, 2022
@yorugac
Copy link
Collaborator

yorugac commented Dec 14, 2022

Looks like it's a rather well-known issue for IPv6 in general and specifically for curl.

At first glance, seems like a quick fix with adding brackets to curl command. But curl doesn't seem to support brackets with IPv4 so we'll need to check first if it's IPv4 or IPv6; maybe before Job creation, in

for _, service := range sl.Items {
hostnames = append(hostnames, service.Spec.ClusterIP)
if !isServiceReady(log, &service) {
log.Info(fmt.Sprintf("%v service is not ready, aborting", service.ObjectMeta.Name))
return false, nil
}
}
starter := jobs.NewStarterJob(k6, hostnames)

Either way, thanks for opening this, @yann-soubeyrand!

@pasi-romo-idealo
Copy link

I have the same issue as described earlier i.e. I try to start a test on an ipv6-only EKS-cluster, but the k6-sample-starter-pod fails to start due to following error:

curl: (3) IPv6 numerical address used in URL without brackets

For now I was able to go around this issue by creating a custom-image by using following line:

parts = append(parts, fmt.Sprintf("curl -g --retry 3 -X PATCH -H 'Content-Type: application/json' http://[%s]:6565/v1/status -d '%s'", hostname, req))
in NewStartContainer and NewStopContainer-function (please note that I needed to provide also this -g globbing option)

If there is away to do this globally i.e. supporting both ipv4 and ipv6, I would be more than happy to try that out :)

@kahirokunn
Copy link

Let’s go ahead 🙆

@zzhao2010
Copy link
Contributor

@pasi-romo-idealo

If there is away to do this globally i.e. supporting both ipv4 and ipv6, I would be more than happy to try that out :)

I tested it by adding net package and then using net.JoinHostPort(), which wraps the hostname in square braces if it's a literal IPv6 address.

parts = append(parts, fmt.Sprintf("curl --retry 3 -X PATCH -H 'Content-Type: application/json' http://%s/v1/status -d '%s'", net.JoinHostPort(hostname, "6565"), req))
I tested it on my local and it supports both IPv4 and IPv6.

@yorugac yorugac added enhancement New feature or request evaluation needed and removed bug Something isn't working labels Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request evaluation needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants