Skip to content

Commit

Permalink
fix vpc dns when ovn-default is dualstack (#2576)
Browse files Browse the repository at this point in the history
Co-authored-by: bobz965 <1220582684@qq.com>
  • Loading branch information
bobz965 and bobz965 committed Mar 30, 2023
1 parent 279717c commit a9d6622
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions pkg/controller/vpc_dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -449,11 +449,15 @@ func setVpcDnsRoute(dp *v1.Deployment, subnetGw string) {
}

var routeCmd string
routeCmd = fmt.Sprintf("ip route add %s via %s dev net1;", serviceHost, subnetGw)
for _, nameserver := range hostNameservers {
routeCmd += fmt.Sprintf("ip route add %s via %s dev net1;", nameserver, subnetGw)
}
v4Gw, _ := util.SplitStringIP(subnetGw)

if v4Gw != "" {
routeCmd = fmt.Sprintf("ip -4 route add %s via %s dev net1;", serviceHost, v4Gw)
for _, nameserver := range hostNameservers {
routeCmd += fmt.Sprintf("ip -4 route add %s via %s dev net1;", nameserver, v4Gw)
}
}
// TODO:// ipv6
privileged := true
allowPrivilegeEscalation := true
dp.Spec.Template.Spec.InitContainers = append(dp.Spec.Template.Spec.InitContainers, corev1.Container{
Expand Down

0 comments on commit a9d6622

Please sign in to comment.