Skip to content

Commit

Permalink
fix: failed to create routing rules in ipv6 and ipv4 dual-stack envir…
Browse files Browse the repository at this point in the history
…onment (kubesphere#3577)

fix: failed to create routing rules in ipv6 environment

Signed-off-by: zhaohuihui <[email protected]>

Signed-off-by: zhaohuihui <[email protected]>
  • Loading branch information
zhaohuiweixiao authored Aug 24, 2022
1 parent 0709ab5 commit 9bd938e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/utils/object.mapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,10 @@ const GatewayMapper = item => {
''
)

// get the first ipv4 ingress's ip, because the k8s can't support ipv6's colon
const defaultIngressIPV4 = loadBalancerIngress.find(i => !i.ip.includes(':'))
?.ip

return {
...getBaseInfo(item),
namespace: get(item, 'metadata.namespace'), // it's not metadata.namespace
Expand All @@ -731,8 +735,7 @@ const GatewayMapper = item => {
ports: get(item, 'status.service', []),
loadBalancerIngress: loadBalancerIngress.map(lb => lb.ip || lb.hostname),
defaultIngress:
get(loadBalancerIngress, '[0].ip') ||
get(loadBalancerIngress, '[0].hostname'),
defaultIngressIPV4 || get(loadBalancerIngress, '[0].hostname'),
isHostName: !!get(loadBalancerIngress, '[0].hostname'),
serviceMeshEnable:
get(
Expand Down

0 comments on commit 9bd938e

Please sign in to comment.