@@ -3,6 +3,7 @@ package gateway
3
3
import (
4
4
"context"
5
5
"fmt"
6
+ "net"
6
7
"time"
7
8
8
9
clusterv3 "github.com/envoyproxy/go-control-plane/envoy/config/cluster/v3"
@@ -18,6 +19,7 @@ import (
18
19
"k8s.io/apimachinery/pkg/labels"
19
20
"k8s.io/client-go/tools/cache"
20
21
"k8s.io/klog/v2"
22
+ "k8s.io/utils/ptr"
21
23
22
24
"sigs.k8s.io/cloud-provider-kind/pkg/config"
23
25
"sigs.k8s.io/cloud-provider-kind/pkg/container"
@@ -79,9 +81,31 @@ func (c *Controller) syncGateway(key string) error {
79
81
return err
80
82
}
81
83
}
82
-
83
84
// Update configuration
84
85
newGw := gw .DeepCopy ()
86
+ ipv4 , ipv6 , err := container .IPs (containerName )
87
+ if err != nil {
88
+ if strings .Contains (err .Error (), "failed to get container details" ) {
89
+ return err
90
+ }
91
+ return err
92
+ }
93
+ newGw .Status .Addresses = []gatewayv1.GatewayStatusAddress {}
94
+ if net .ParseIP (ipv4 ) != nil {
95
+ newGw .Status .Addresses = append (newGw .Status .Addresses ,
96
+ gatewayv1.GatewayStatusAddress {
97
+ Type : ptr .To (gatewayv1 .IPAddressType ),
98
+ Value : ipv4 ,
99
+ })
100
+ }
101
+ if net .ParseIP (ipv6 ) != nil {
102
+ newGw .Status .Addresses = append (newGw .Status .Addresses ,
103
+ gatewayv1.GatewayStatusAddress {
104
+ Type : ptr .To (gatewayv1 .IPAddressType ),
105
+ Value : ipv6 ,
106
+ })
107
+ }
108
+
85
109
resources := map [resourcev3.Type ][]envoyproxytypes.Resource {}
86
110
newGw .Status .Conditions , _ = UpdateConditionIfChanged (newGw .Status .Conditions , metav1.Condition {
87
111
Type : string (gatewayv1 .GatewayConditionAccepted ),
0 commit comments