Repository: kiali/kiali
Pull request #8012 (2024-12-19 14:52:53)

bump go x/net dependency to 0.33.0

nrfox: Actually looking at this we can remove `golang.org/x/net` as a direct dependency simply by importing context from the right place in this test: https://github.com/kiali/kiali/blob/master/tests/integration/tests/graph_badges_test.go#L9. We should import from `context` and not from `golang.org/x/net/context`. IMO you can keep the backports the way they are now but can you update the `master` branch?
jmazzitelli: > Actually looking at this we can remove `golang.org/x/net` as a direct dependency simply by importing context from the right place in this test: https://github.com/kiali/kiali/blob/master/tests/integration/tests/graph_badges_test.go#L9. We should import from `context` and not from `golang.org/x/net/context`. IMO you can keep the backports the way they are now but can you update the `master` branch?

Are you saying import `context` versus `golang.org/x/net/context` ?? I tried that, and "go mod tidy" adds x/net as an indirect dependency in go.sum, but it doesn't give us 0.33.0; it goes back to 0.28.0.

```diff
diff --git a/go.mod b/go.mod
index becab04e1..d325d6c13 100644
--- a/go.mod
+++ b/go.mod
@@ -28,7 +28,6 @@ require (
        go.opentelemetry.io/otel/trace v1.28.0
        go.uber.org/automaxprocs v1.5.3
        golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f
-       golang.org/x/net v0.33.0
        golang.org/x/oauth2 v0.21.0
        golang.org/x/sync v0.10.0
        google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117
@@ -90,6 +89,7 @@ require (
        go.uber.org/multierr v1.11.0 // indirect
        go.uber.org/zap v1.26.0 // indirect
        golang.org/x/crypto v0.31.0 // indirect
+       golang.org/x/net v0.28.0 // indirect
        golang.org/x/sys v0.28.0 // indirect
        golang.org/x/term v0.27.0 // indirect
        golang.org/x/text v0.21.0 // indirect
diff --git a/go.sum b/go.sum
index a1ba3743f..512123fd0 100644
--- a/go.sum
+++ b/go.sum
@@ -182,8 +182,8 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn
 golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
 golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
 golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
-golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I=
-golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
+golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE=
+golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg=
 golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs=
 golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
 golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
diff --git a/tests/integration/tests/graph_badges_test.go b/tests/integration/tests/graph_badges_test.go
index 7b512e390..5521f7e29 100644
--- a/tests/integration/tests/graph_badges_test.go
+++ b/tests/integration/tests/graph_badges_test.go
@@ -1,12 +1,12 @@
 package tests
 
 import (
+       "context"
        "path"
        "testing"
        "time"
 
        "github.com/stretchr/testify/require"
-       "golang.org/x/net/context"
        "k8s.io/apimachinery/pkg/util/wait"
 
        "github.com/kiali/kiali/log"
```

Patch:
diff --git a/frontend/src/pages/ServiceDetails/ServiceNetwork.tsx b/frontend/src/pages/ServiceDetails/ServiceNetwork.tsx
index 2604e0a0a..1e41ce87e 100644
--- a/frontend/src/pages/ServiceDetails/ServiceNetwork.tsx
+++ b/frontend/src/pages/ServiceDetails/ServiceNetwork.tsx
@@ -77,6 +77,8 @@ export const ServiceNetwork: React.FC<ServiceNetworkProps> = (props: ServiceNetw
     return hostnames;
   };
 
+  const service = props.serviceDetails.service;
+  let ips = service.type !== 'External' ? (service.ips ? service.ips : [service.ip]) : [];
   return (
     <Card isCompact={true} id="ServiceNetworkCard">
       <CardHeader>
@@ -89,21 +91,19 @@ export const ServiceNetwork: React.FC<ServiceNetworkProps> = (props: ServiceNetw
           <ul style={{ listStyleType: 'none' }}>
             <li>
               <span>Type</span>
-              {props.serviceDetails.service.type}
+              {service.type}
             </li>
 
-            {props.serviceDetails.service.type !== 'External' && (
+            {ips.map((ip, i) => (
               <li>
-                <span>{props.serviceDetails.service.type !== 'ExternalName' ? 'Service IP' : 'ExternalName'}</span>
-                {props.serviceDetails.service.type !== 'ExternalName'
-                  ? props.serviceDetails.service.ip
-                    ? props.serviceDetails.service.ip
-                    : ''
-                  : props.serviceDetails.service.externalName
-                  ? props.serviceDetails.service.externalName
-                  : ''}
+                <span>
+                  {service.type !== 'ExternalName'
+                    ? `Service ${service.ipFamilies ? service.ipFamilies[i] : 'IP'}`
+                    : 'ExternalName'}
+                </span>
+                {service.type !== 'ExternalName' ? ip : service.externalName ? service.externalName : ''}
               </li>
-            )}
+            ))}
 
             {props.serviceDetails.endpoints && props.serviceDetails.endpoints.length > 0 && (
               <li>
@@ -135,11 +135,11 @@ export const ServiceNetwork: React.FC<ServiceNetworkProps> = (props: ServiceNetw
               </li>
             )}
 
-            {props.serviceDetails.service.ports && props.serviceDetails.service.ports.length > 0 && (
+            {service.ports && service.ports.length > 0 && (
               <li>
                 <span>Ports</span>
                 <div style={{ display: 'inline-block' }}>
-                  {(props.serviceDetails.service.ports ?? []).map((port, i) => {
+                  {(service.ports ?? []).map((port, i) => {
                     return (
                       <div key={`port_${i}`}>
                         <div>
diff --git a/frontend/src/types/ServiceInfo.ts b/frontend/src/types/ServiceInfo.ts
index 4a08a0f70..394a4e325 100644
--- a/frontend/src/types/ServiceInfo.ts
+++ b/frontend/src/types/ServiceInfo.ts
@@ -58,6 +58,7 @@ export interface WorkloadOverview {
   type: string;
 }
 
+export type IPFamily = 'IPv4' | 'IPv6';
 export interface Service {
   additionalDetails: AdditionalItem[];
   annotations: { [key: string]: string };
@@ -65,6 +66,8 @@ export interface Service {
   createdAt: string;
   externalName: string;
   ip: string;
+  ips?: string[]; // present in dual stack. ip === ips[0]
+  ipFamilies?: IPFamily[]; // ipFamilies[0] represents ip, ipFamilies[i] represents ips[i]
   labels?: { [key: string]: string };
   name: string;
   namespace: string;
diff --git a/frontend/src/utils/IstioConfigUtils.ts b/frontend/src/utils/IstioConfigUtils.ts
index 21cdf75e6..fbc55bb95 100644
--- a/frontend/src/utils/IstioConfigUtils.ts
+++ b/frontend/src/utils/IstioConfigUtils.ts
@@ -48,7 +48,7 @@ export const isK8sGatewayHostValid = (k8sGatewayHost: string): boolean => {
     return false;
   }
 
-  // K8s gateway host must be fqdn but not ip address
+  // K8s gateway host must be fqdn but not ip address (ipv4 or ipv6)
   if (k8sGatewayHost.split('.').length < 2 || k8sGatewayHost.search(ipRegexp) === 0) {
     return false;
   }
diff --git a/go.mod b/go.mod
index 597da0035..48c62a882 100644
--- a/go.mod
+++ b/go.mod
@@ -28,9 +28,8 @@ require (
 	go.opentelemetry.io/otel/trace v1.28.0
 	go.uber.org/automaxprocs v1.5.3
 	golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f
-	golang.org/x/net v0.28.0
 	golang.org/x/oauth2 v0.21.0
-	golang.org/x/sync v0.8.0
+	golang.org/x/sync v0.10.0
 	google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117
 	google.golang.org/grpc v1.66.2
 	google.golang.org/protobuf v1.34.2
@@ -89,10 +88,11 @@ require (
 	go.opentelemetry.io/proto/otlp v1.3.1 // indirect
 	go.uber.org/multierr v1.11.0 // indirect
 	go.uber.org/zap v1.26.0 // indirect
-	golang.org/x/crypto v0.26.0 // indirect
-	golang.org/x/sys v0.24.0 // indirect
-	golang.org/x/term v0.23.0 // indirect
-	golang.org/x/text v0.17.0 // indirect
+	golang.org/x/crypto v0.31.0 // indirect
+	golang.org/x/net v0.33.0 // indirect
+	golang.org/x/sys v0.28.0 // indirect
+	golang.org/x/term v0.27.0 // indirect
+	golang.org/x/text v0.21.0 // indirect
 	golang.org/x/time v0.5.0 // indirect
 	golang.org/x/tools v0.24.0 // indirect
 	gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
diff --git a/go.sum b/go.sum
index 8ebc200cb..a1ba3743f 100644
--- a/go.sum
+++ b/go.sum
@@ -172,8 +172,8 @@ go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so=
 golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
 golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
 golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
-golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw=
-golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54=
+golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U=
+golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
 golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f h1:99ci1mjWVBWwJiEKYY6jWa4d2nTQVIEhZIptnrVb1XY=
 golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f/go.mod h1:/lliqkxwWAhPjf5oSOIJup2XcqJaw8RGS6k3TGEc7GI=
 golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
@@ -182,26 +182,26 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn
 golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
 golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
 golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
-golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE=
-golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg=
+golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I=
+golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
 golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs=
 golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
 golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
 golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
 golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
-golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
-golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
+golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ=
+golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
 golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
 golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg=
-golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
-golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU=
-golang.org/x/term v0.23.0/go.mod h1:DgV24QBUrK6jhZXl+20l6UWznPlwAHm1Q1mGHtydmSk=
+golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
+golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
+golang.org/x/term v0.27.0 h1:WP60Sv1nlK1T6SupCHbXzSaN0b9wUmsPoRS9b61A23Q=
+golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM=
 golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
 golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
-golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc=
-golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
+golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
+golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
 golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk=
 golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
 golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
diff --git a/kubernetes/cache/kube_cache.go b/kubernetes/cache/kube_cache.go
index 2255ff7fa..23b55e6e2 100644
--- a/kubernetes/cache/kube_cache.go
+++ b/kubernetes/cache/kube_cache.go
@@ -532,6 +532,8 @@ func (c *kubeCache) createKubernetesInformers(namespace string) informers.Shared
 						Type:         obj.Spec.Type,
 						ExternalName: obj.Spec.ExternalName,
 						ClusterIP:    obj.Spec.ClusterIP,
+						ClusterIPs:   obj.Spec.ClusterIPs,
+						IPFamilies:   obj.Spec.IPFamilies,
 					},
 				}
 				return trimmedService, nil
diff --git a/models/service.go b/models/service.go
index 0fcdf4292..2e344bf91 100644
--- a/models/service.go
+++ b/models/service.go
@@ -106,20 +106,22 @@ type ServiceDetails struct {
 type (
 	Services []*Service
 	Service  struct {
-		AdditionalDetails []AdditionalItem  `json:"additionalDetails"`
-		Annotations       map[string]string `json:"annotations"`
-		Cluster           string            `json:"cluster"`
-		CreatedAt         string            `json:"createdAt"`
-		ExternalName      string            `json:"externalName"`
-		HealthAnnotations map[string]string `json:"healthAnnotations"`
-		Ip                string            `json:"ip"`
-		Labels            map[string]string `json:"labels"`
-		Name              string            `json:"name"`
-		Namespace         string            `json:"namespace"`
-		Ports             Ports             `json:"ports"`
-		ResourceVersion   string            `json:"resourceVersion"`
-		Selectors         map[string]string `json:"selectors"`
-		Type              string            `json:"type"`
+		AdditionalDetails []AdditionalItem   `json:"additionalDetails"`
+		Annotations       map[string]string  `json:"annotations"`
+		Cluster           string             `json:"cluster"`
+		CreatedAt         string             `json:"createdAt"`
+		ExternalName      string             `json:"externalName"`
+		HealthAnnotations map[string]string  `json:"healthAnnotations"`
+		Ip                string             `json:"ip"`
+		Ips               []string           `json:"ips,omitempty"`
+		IpFamilies        []core_v1.IPFamily `json:"ipFamilies,omitempty"`
+		Labels            map[string]string  `json:"labels"`
+		Name              string             `json:"name"`
+		Namespace         string             `json:"namespace"`
+		Ports             Ports              `json:"ports"`
+		ResourceVersion   string             `json:"resourceVersion"`
+		Selectors         map[string]string  `json:"selectors"`
+		Type              string             `json:"type"`
 	}
 )
 
@@ -157,6 +159,8 @@ func (s *Service) Parse(cluster string, service *core_v1.Service) {
 		s.ExternalName = service.Spec.ExternalName
 		s.HealthAnnotations = GetHealthAnnotation(service.Annotations, GetHealthConfigAnnotation())
 		s.Ip = service.Spec.ClusterIP
+		s.Ips = service.Spec.ClusterIPs
+		s.IpFamilies = service.Spec.IPFamilies
 		s.Labels = service.Labels
 		s.Name = service.Name
 		s.Namespace = service.Namespace


Test patch:
diff --git a/tests/integration/tests/graph_badges_test.go b/tests/integration/tests/graph_badges_test.go
index 7b512e390..5521f7e29 100644
--- a/tests/integration/tests/graph_badges_test.go
+++ b/tests/integration/tests/graph_badges_test.go
@@ -1,12 +1,12 @@
 package tests
 
 import (
+	"context"
 	"path"
 	"testing"
 	"time"
 
 	"github.com/stretchr/testify/require"
-	"golang.org/x/net/context"
 	"k8s.io/apimachinery/pkg/util/wait"
 
 	"github.com/kiali/kiali/log"