Skip to content

Commit

Permalink
Fix IPv6 compatibility issue with starter pod
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhang Zhao committed Aug 7, 2024
1 parent f75facb commit 85ad4ae
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion pkg/resources/containers/curl_start.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package containers
import (
"encoding/json"
"fmt"
"net"
"strings"

"github.com/grafana/k6-operator/pkg/types"
Expand All @@ -26,7 +27,7 @@ func NewStartContainer(hostnames []string, image string, imagePullPolicy corev1.

var parts []string
for _, hostname := range hostnames {
parts = append(parts, fmt.Sprintf("curl --retry 3 -X PATCH -H 'Content-Type: application/json' http://%s:6565/v1/status -d '%s'", hostname, req))
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))
}

return corev1.Container{
Expand Down
3 changes: 2 additions & 1 deletion pkg/resources/containers/curl_stop.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package containers
import (
"encoding/json"
"fmt"
"net"
"strings"

"github.com/grafana/k6-operator/pkg/types"
Expand All @@ -26,7 +27,7 @@ func NewStopContainer(hostnames []string, image string, imagePullPolicy corev1.P

var parts []string
for _, hostname := range hostnames {
parts = append(parts, fmt.Sprintf("curl --retry 3 -X PATCH -H 'Content-Type: application/json' http://%s:6565/v1/status -d '%s'", hostname, req))
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))
}

return corev1.Container{
Expand Down

0 comments on commit 85ad4ae

Please sign in to comment.