Skip to content

Commit

Permalink
backport of commit 07f1b68
Browse files Browse the repository at this point in the history
  • Loading branch information
nathancoleman committed Jul 11, 2023
1 parent ba189c1 commit 4200559
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions control-plane/api-gateway/gatekeeper/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,22 @@ func (g *Gatekeeper) deleteService(ctx context.Context, gwName types.NamespacedN
}

func (g *Gatekeeper) service(gateway gwv1beta1.Gateway, gcc v1alpha1.GatewayClassConfig) *corev1.Service {
seenPorts := map[gwv1beta1.PortNumber]struct{}{}
ports := []corev1.ServicePort{}
for _, listener := range gateway.Spec.Listeners {
if _, seen := seenPorts[listener.Port]; seen {
// We've already added this listener's port to the Service
continue
}

ports = append(ports, corev1.ServicePort{
Name: string(listener.Name),
// only TCP-based services are supported for now
Protocol: corev1.ProtocolTCP,
Port: int32(listener.Port),
})

seenPorts[listener.Port] = struct{}{}
}

// Copy annotations from the Gateway, filtered by those allowed by the GatewayClassConfig.
Expand Down

0 comments on commit 4200559

Please sign in to comment.