K6-operator issue with ipv6

Hi,
I am testing the k6-operator using EKS on AWS. I was following the official instruction. However the executor pod kept failing apart due to the issue with ipv6. Does k6-operator support ipv6?


The error msg shows " curl: (3) URL rejected: Port number was not a decimal number between 0 and 65535" in the pod.

I see the curl command uses ipv6 when I describe the pod. I think this is the root cause of the pod failure.

curl --retry 3 -X PATCH -H 'Content-Type: application/json' http://fdfe:d15b:965c::905a:6565/v1/status -d '{"data":{"attributes":{"paused":false,"stopped ││ ":false},"id":"default","type":"status"}}'

Below is my conf.yaml file

apiVersion: k6.io/v1alpha1
kind: TestRun
metadata:
  name: run-k6-with-realtime
spec:
  parallelism: 1
  # cleanup: post
  arguments: -o experimental-prometheus-rw --tag testid=test
  script:
    configMap:
      name: my-test
      file: test.js
  runner:
    env:
      - name: K6_PROMETHEUS_RW_SERVER_URL
        value: "http://prometheus-kube-prometheus-prometheus.monitor.svc.cluster.local:9090/api/v1/write"
      - name: K6_PROMETHEUS_RW_TREND_AS_NATIVE_HISTOGRAM
        value: "true"

Looks like it’s a known issue as the status of this issue is still “Open”. It’s been over 2 years since the issue was open. Wondering if there is any update or workaround.

btw, there was a workaround provided in the issue and it does work. However it only works with IPv6.

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)

I am looking for a solution that supports both IPv4 and IPv6. What I tried was to introduce the net package and then use net.JoinHostPort to wrap 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))

The above change is made At k6-operator/pkg/resources/containers/curl_start.go at main · grafana/k6-operator · GitHub and k6-operator/pkg/resources/containers/curl_stop.go at main · grafana/k6-operator · GitHub

However it doesn’t seem to work when I tested it. The initializer pod stuck there.

@vicentevincenzo Yes. I just made a PR for my fix.