Merge current branch v2.4 into master

This commit is contained in:
Jean-Baptiste Doumenjou 2021-03-31 09:43:04 +02:00
commit cb4fb973b2
41 changed files with 1857 additions and 1424 deletions

View file

@ -25,7 +25,7 @@ import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"sigs.k8s.io/service-apis/apis/v1alpha1"
"sigs.k8s.io/gateway-api/apis/v1alpha1"
)
const (
@ -809,12 +809,12 @@ func loadServices(client Client, namespace string, targets []v1alpha1.HTTPRouteF
return nil, nil, errors.New("service not found")
}
if len(service.Spec.Ports) > 1 && forwardTo.Port == 0 {
if len(service.Spec.Ports) > 1 && forwardTo.Port == nil {
// If the port is unspecified and the backend is a Service
// object consisting of multiple port definitions, the route
// must be dropped from the Gateway. The controller should
// raise the "ResolvedRefs" condition on the Gateway with the
// "DroppedRoutes" reason. The gateway status for this route
// "DroppedRoutes" reason. The gateway status for this route
// should be updated with a condition that describes the error
// more specifically.
log.WithoutContext().Errorf("A multiple ports Kubernetes Service cannot be used if unspecified forwardTo.Port")
@ -826,7 +826,7 @@ func loadServices(client Client, namespace string, targets []v1alpha1.HTTPRouteF
var match bool
for _, p := range service.Spec.Ports {
if forwardTo.Port == 0 || p.Port == int32(forwardTo.Port) {
if forwardTo.Port == nil || p.Port == int32(*forwardTo.Port) {
portName = p.Name
portSpec = p
match = true