Skip to content

Commit

Permalink
Merge pull request #148 from rabi/ipv6
Browse files Browse the repository at this point in the history
Make the local image url ipv6 compatible
  • Loading branch information
openshift-merge-bot[bot] authored Mar 15, 2024
2 parents 33d0a42 + c0b562d commit 16ed906
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions controllers/openstackprovisionserver_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package controllers
import (
"context"
"fmt"
"net"
"strconv"
"time"

Expand All @@ -32,6 +33,7 @@ import (
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/client-go/dynamic"
"k8s.io/client-go/kubernetes"
k8snet "k8s.io/utils/net"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/client/config"
Expand Down Expand Up @@ -606,5 +608,9 @@ func (r *OpenStackProvisionServerReconciler) getLocalImageURL(
//We're using hostNetwork for the provisionserver pod
host = provisionPods.Items[0].Status.HostIP
}

if k8snet.IsIPv6(net.ParseIP(host)) {
host = fmt.Sprintf("[%s]", host)
}
return fmt.Sprintf("http://%s:%d/%s", host, instance.Spec.Port, baseFilename), nil
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ require (
k8s.io/api v0.28.7
k8s.io/apimachinery v0.28.7
k8s.io/client-go v0.28.7
k8s.io/utils v0.0.0-20240310230437-4693a0247e57
sigs.k8s.io/controller-runtime v0.16.5
)

Expand Down Expand Up @@ -74,7 +75,6 @@ require (
k8s.io/component-base v0.28.7 // indirect
k8s.io/klog/v2 v2.110.1 // indirect
k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 // indirect
k8s.io/utils v0.0.0-20240310230437-4693a0247e57 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
Expand Down

0 comments on commit 16ed906

Please sign in to comment.