Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion internal/gatewayapi/status/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,12 @@ func UpdateGatewayStatusProgrammedCondition(gw *gwapiv1.Gateway, svc *corev1.Ser
if len(svc.Spec.ExternalIPs) > 0 {
addresses = append(addresses, svc.Spec.ExternalIPs...)
} else if len(svc.Spec.ClusterIPs) > 0 {
addresses = append(addresses, svc.Spec.ClusterIPs...)
// Filter out "None" values which represent headless services
for _, ip := range svc.Spec.ClusterIPs {
if ip != "" && ip != "None" {
addresses = append(addresses, ip)
}
}
}
} else {
if svc.Spec.Type == corev1.ServiceTypeLoadBalancer {
Expand Down
15 changes: 15 additions & 0 deletions internal/gatewayapi/status/gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,21 @@ func TestUpdateGatewayStatusProgrammedCondition(t *testing.T) {
},
},
},
{
name: "Headless ClusterIP svc with None",
args: args{
gw: &gwapiv1.Gateway{},
svc: &corev1.Service{
TypeMeta: metav1.TypeMeta{},
ObjectMeta: metav1.ObjectMeta{},
Spec: corev1.ServiceSpec{
ClusterIPs: []string{"None"},
Type: corev1.ServiceTypeClusterIP,
},
},
},
wantAddresses: nil,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down
Loading