From 8df2474ac38a435233458a8303b1bcfcf2f4706c Mon Sep 17 00:00:00 2001 From: sh2 Date: Thu, 22 Jun 2023 08:40:29 +0800 Subject: [PATCH 01/16] refactor: dedup the route context code using reflection (#1502) * dedup the context via reflect Signed-off-by: Shawnh2 * clean up code Signed-off-by: Shawnh2 * fix lint Signed-off-by: Shawnh2 * get route type info from Kind by FieldByName Signed-off-by: Shawnh2 * replacing string contains with the constants that already defined Signed-off-by: Shawnh2 --------- Signed-off-by: Shawnh2 --- .../translate/out/default-resources.all.yaml | 15 +- .../out/echo-gateway-api.cluster.yaml | 3 +- .../translate/out/echo-gateway-api.route.json | 1 + .../translate/out/invalid-envoyproxy.all.yaml | 15 +- .../out/rejected-http-route.route.yaml | 3 +- .../translate/out/valid-envoyproxy.all.yaml | 15 +- internal/cmd/egctl/translate.go | 15 + internal/gatewayapi/contexts.go | 478 ++++-------------- internal/gatewayapi/route.go | 44 +- 9 files changed, 181 insertions(+), 408 deletions(-) diff --git a/internal/cmd/egctl/testdata/translate/out/default-resources.all.yaml b/internal/cmd/egctl/testdata/translate/out/default-resources.all.yaml index 9311770b86d..9faa39854a8 100644 --- a/internal/cmd/egctl/testdata/translate/out/default-resources.all.yaml +++ b/internal/cmd/egctl/testdata/translate/out/default-resources.all.yaml @@ -214,7 +214,8 @@ gateways: - group: gateway.networking.k8s.io kind: GRPCRoute grpcRoutes: -- metadata: +- kind: GRPCRoute + metadata: creationTimestamp: null name: backend namespace: default @@ -253,7 +254,8 @@ grpcRoutes: name: eg sectionName: grpc httpRoutes: -- metadata: +- kind: HTTPRoute + metadata: creationTimestamp: null name: backend namespace: default @@ -290,7 +292,8 @@ httpRoutes: parentRef: name: eg tcpRoutes: -- metadata: +- kind: TCPRoute + metadata: creationTimestamp: null name: backend namespace: default @@ -323,7 +326,8 @@ tcpRoutes: name: eg sectionName: tcp tlsRoutes: -- metadata: +- kind: TLSRoute + metadata: creationTimestamp: null name: backend namespace: default @@ -356,7 +360,8 @@ tlsRoutes: name: eg sectionName: tls-passthrough udpRoutes: -- metadata: +- kind: UDPRoute + metadata: creationTimestamp: null name: backend namespace: default diff --git a/internal/cmd/egctl/testdata/translate/out/echo-gateway-api.cluster.yaml b/internal/cmd/egctl/testdata/translate/out/echo-gateway-api.cluster.yaml index a7a68d7371e..ad6c527850c 100644 --- a/internal/cmd/egctl/testdata/translate/out/echo-gateway-api.cluster.yaml +++ b/internal/cmd/egctl/testdata/translate/out/echo-gateway-api.cluster.yaml @@ -44,7 +44,8 @@ gateways: - group: gateway.networking.k8s.io kind: GRPCRoute httpRoutes: -- metadata: +- kind: HTTPRoute + metadata: creationTimestamp: null name: backend namespace: envoy-gateway-system diff --git a/internal/cmd/egctl/testdata/translate/out/echo-gateway-api.route.json b/internal/cmd/egctl/testdata/translate/out/echo-gateway-api.route.json index 70d788b371a..107fd59c39f 100644 --- a/internal/cmd/egctl/testdata/translate/out/echo-gateway-api.route.json +++ b/internal/cmd/egctl/testdata/translate/out/echo-gateway-api.route.json @@ -75,6 +75,7 @@ ], "httpRoutes": [ { + "kind": "HTTPRoute", "metadata": { "name": "backend", "namespace": "envoy-gateway-system", diff --git a/internal/cmd/egctl/testdata/translate/out/invalid-envoyproxy.all.yaml b/internal/cmd/egctl/testdata/translate/out/invalid-envoyproxy.all.yaml index 840507913a1..79dd8776795 100644 --- a/internal/cmd/egctl/testdata/translate/out/invalid-envoyproxy.all.yaml +++ b/internal/cmd/egctl/testdata/translate/out/invalid-envoyproxy.all.yaml @@ -154,7 +154,8 @@ gateways: - group: gateway.networking.k8s.io kind: GRPCRoute grpcRoutes: -- metadata: +- kind: GRPCRoute + metadata: creationTimestamp: null name: backend namespace: default @@ -193,7 +194,8 @@ grpcRoutes: name: eg sectionName: grpc httpRoutes: -- metadata: +- kind: HTTPRoute + metadata: creationTimestamp: null name: backend namespace: default @@ -230,7 +232,8 @@ httpRoutes: parentRef: name: eg tcpRoutes: -- metadata: +- kind: TCPRoute + metadata: creationTimestamp: null name: backend namespace: default @@ -263,7 +266,8 @@ tcpRoutes: name: eg sectionName: tcp tlsRoutes: -- metadata: +- kind: TLSRoute + metadata: creationTimestamp: null name: backend namespace: default @@ -296,7 +300,8 @@ tlsRoutes: name: eg sectionName: tls-passthrough udpRoutes: -- metadata: +- kind: UDPRoute + metadata: creationTimestamp: null name: backend namespace: default diff --git a/internal/cmd/egctl/testdata/translate/out/rejected-http-route.route.yaml b/internal/cmd/egctl/testdata/translate/out/rejected-http-route.route.yaml index bacffdd4d8b..d893e890140 100644 --- a/internal/cmd/egctl/testdata/translate/out/rejected-http-route.route.yaml +++ b/internal/cmd/egctl/testdata/translate/out/rejected-http-route.route.yaml @@ -39,7 +39,8 @@ gateways: - group: gateway.networking.k8s.io kind: TLSRoute httpRoutes: -- metadata: +- kind: "HTTPRoute" + metadata: creationTimestamp: null name: backend namespace: envoy-gateway-system diff --git a/internal/cmd/egctl/testdata/translate/out/valid-envoyproxy.all.yaml b/internal/cmd/egctl/testdata/translate/out/valid-envoyproxy.all.yaml index 751223cf300..c2b8205de25 100644 --- a/internal/cmd/egctl/testdata/translate/out/valid-envoyproxy.all.yaml +++ b/internal/cmd/egctl/testdata/translate/out/valid-envoyproxy.all.yaml @@ -149,7 +149,8 @@ gateways: - group: gateway.networking.k8s.io kind: GRPCRoute grpcRoutes: -- metadata: +- kind: GRPCRoute + metadata: creationTimestamp: null name: backend namespace: default @@ -188,7 +189,8 @@ grpcRoutes: name: eg sectionName: grpc httpRoutes: -- metadata: +- kind: HTTPRoute + metadata: creationTimestamp: null name: backend namespace: default @@ -225,7 +227,8 @@ httpRoutes: parentRef: name: eg tcpRoutes: -- metadata: +- kind: TCPRoute + metadata: creationTimestamp: null name: backend namespace: default @@ -258,7 +261,8 @@ tcpRoutes: name: eg sectionName: tcp tlsRoutes: -- metadata: +- kind: TLSRoute + metadata: creationTimestamp: null name: backend namespace: default @@ -291,7 +295,8 @@ tlsRoutes: name: eg sectionName: tls-passthrough udpRoutes: -- metadata: +- kind: UDPRoute + metadata: creationTimestamp: null name: backend namespace: default diff --git a/internal/cmd/egctl/translate.go b/internal/cmd/egctl/translate.go index 102cd18b936..3285f9c0f70 100644 --- a/internal/cmd/egctl/translate.go +++ b/internal/cmd/egctl/translate.go @@ -641,6 +641,9 @@ func kubernetesYAMLToResources(str string, addMissingResources bool) (*gatewayap case gatewayapi.KindTCPRoute: typedSpec := spec.Interface() tcpRoute := &v1alpha2.TCPRoute{ + TypeMeta: metav1.TypeMeta{ + Kind: gatewayapi.KindTCPRoute, + }, ObjectMeta: metav1.ObjectMeta{ Name: name, Namespace: namespace, @@ -651,6 +654,9 @@ func kubernetesYAMLToResources(str string, addMissingResources bool) (*gatewayap case gatewayapi.KindUDPRoute: typedSpec := spec.Interface() udpRoute := &v1alpha2.UDPRoute{ + TypeMeta: metav1.TypeMeta{ + Kind: gatewayapi.KindUDPRoute, + }, ObjectMeta: metav1.ObjectMeta{ Name: name, Namespace: namespace, @@ -661,6 +667,9 @@ func kubernetesYAMLToResources(str string, addMissingResources bool) (*gatewayap case gatewayapi.KindTLSRoute: typedSpec := spec.Interface() tlsRoute := &v1alpha2.TLSRoute{ + TypeMeta: metav1.TypeMeta{ + Kind: gatewayapi.KindTLSRoute, + }, ObjectMeta: metav1.ObjectMeta{ Name: name, Namespace: namespace, @@ -671,6 +680,9 @@ func kubernetesYAMLToResources(str string, addMissingResources bool) (*gatewayap case gatewayapi.KindHTTPRoute: typedSpec := spec.Interface() httpRoute := &v1beta1.HTTPRoute{ + TypeMeta: metav1.TypeMeta{ + Kind: gatewayapi.KindHTTPRoute, + }, ObjectMeta: metav1.ObjectMeta{ Name: name, Namespace: namespace, @@ -681,6 +693,9 @@ func kubernetesYAMLToResources(str string, addMissingResources bool) (*gatewayap case gatewayapi.KindGRPCRoute: typedSpec := spec.Interface() grpcRoute := &v1alpha2.GRPCRoute{ + TypeMeta: metav1.TypeMeta{ + Kind: gatewayapi.KindGRPCRoute, + }, ObjectMeta: metav1.ObjectMeta{ Name: name, Namespace: namespace, diff --git a/internal/gatewayapi/contexts.go b/internal/gatewayapi/contexts.go index aad24bf2f67..03823dc6642 100644 --- a/internal/gatewayapi/contexts.go +++ b/internal/gatewayapi/contexts.go @@ -154,27 +154,6 @@ func (l *ListenerContext) SetTLSSecrets(tlsSecrets []*v1.Secret) { // that can reference Gateway objects. type RouteContext interface { client.Object - - // GetRouteType returns the Kind of the Route object, HTTPRoute, - // TLSRoute, TCPRoute, UDPRoute etc. - GetRouteType() v1beta1.Kind - - // GetRouteStatus returns the RouteStatus object associated with the Route. - GetRouteStatus() *v1beta1.RouteStatus - - // TODO: [v1alpha2-v1beta1] This should not be required once all Route - // objects being implemented are of type v1beta1. - // GetParentReferences returns the ParentReference of the Route object. - GetParentReferences() []v1beta1.ParentReference - - // GetRouteParentContext returns RouteParentContext by using the Route - // objects' ParentReference. - GetRouteParentContext(forParentRef v1beta1.ParentReference) *RouteParentContext - - // TODO: [v1alpha2-v1beta1] This should not be required once all Route - // objects being implemented are of type v1beta1. - // GetHostnames returns the hosts targeted by the Route object. - GetHostnames() []string } // HTTPRouteContext wraps an HTTPRoute and provides helper methods for @@ -185,73 +164,7 @@ type HTTPRouteContext struct { *v1beta1.HTTPRoute - parentRefs map[v1beta1.ParentReference]*RouteParentContext -} - -func (h *HTTPRouteContext) GetRouteType() v1beta1.Kind { - return KindHTTPRoute -} - -func (h *HTTPRouteContext) GetHostnames() []string { - hostnames := make([]string, len(h.Spec.Hostnames)) - for idx, s := range h.Spec.Hostnames { - hostnames[idx] = string(s) - } - return hostnames -} - -func (h *HTTPRouteContext) GetParentReferences() []v1beta1.ParentReference { - return h.Spec.ParentRefs -} - -func (h *HTTPRouteContext) GetRouteStatus() *v1beta1.RouteStatus { - return &h.Status.RouteStatus -} - -func (h *HTTPRouteContext) GetRouteParentContext(forParentRef v1beta1.ParentReference) *RouteParentContext { - if h.parentRefs == nil { - h.parentRefs = make(map[v1beta1.ParentReference]*RouteParentContext) - } - - if ctx := h.parentRefs[forParentRef]; ctx != nil { - return ctx - } - - var parentRef *v1beta1.ParentReference - for i, p := range h.Spec.ParentRefs { - if reflect.DeepEqual(p, forParentRef) { - parentRef = &h.Spec.ParentRefs[i] - break - } - } - if parentRef == nil { - panic("parentRef not found") - } - - routeParentStatusIdx := -1 - for i := range h.Status.Parents { - if reflect.DeepEqual(h.Status.Parents[i].ParentRef, forParentRef) { - routeParentStatusIdx = i - break - } - } - if routeParentStatusIdx == -1 { - rParentStatus := v1beta1.RouteParentStatus{ - ControllerName: v1beta1.GatewayController(h.GatewayControllerName), - ParentRef: forParentRef, - } - h.Status.Parents = append(h.Status.Parents, rParentStatus) - routeParentStatusIdx = len(h.Status.Parents) - 1 - } - - ctx := &RouteParentContext{ - ParentReference: parentRef, - - httpRoute: h.HTTPRoute, - routeParentStatusIdx: routeParentStatusIdx, - } - h.parentRefs[forParentRef] = ctx - return ctx + ParentRefs map[v1beta1.ParentReference]*RouteParentContext } // GRPCRouteContext wraps a GRPCRoute and provides helper methods for @@ -262,83 +175,7 @@ type GRPCRouteContext struct { *v1alpha2.GRPCRoute - parentRefs map[v1beta1.ParentReference]*RouteParentContext -} - -func (g *GRPCRouteContext) GetRouteType() v1beta1.Kind { - return KindGRPCRoute -} - -func (g *GRPCRouteContext) GetHostnames() []string { - hostnames := make([]string, len(g.Spec.Hostnames)) - for idx, s := range g.Spec.Hostnames { - hostnames[idx] = string(s) - } - return hostnames -} - -func (g *GRPCRouteContext) GetParentReferences() []v1beta1.ParentReference { - return g.Spec.ParentRefs -} - -func (g *GRPCRouteContext) GetRouteStatus() *v1beta1.RouteStatus { - return &g.Status.RouteStatus -} - -func (g *GRPCRouteContext) GetRouteParentContext(forParentRef v1beta1.ParentReference) *RouteParentContext { - if g.parentRefs == nil { - g.parentRefs = make(map[v1beta1.ParentReference]*RouteParentContext) - } - - if ctx := g.parentRefs[forParentRef]; ctx != nil { - return ctx - } - - var parentRef *v1beta1.ParentReference - for i, p := range g.Spec.ParentRefs { - p := UpgradeParentReference(p) - if reflect.DeepEqual(p, forParentRef) { - upgraded := UpgradeParentReference(g.Spec.ParentRefs[i]) - parentRef = &upgraded - break - } - } - if parentRef == nil { - panic("parentRef not found") - } - - routeParentStatusIdx := -1 - for i := range g.Status.Parents { - p := UpgradeParentReference(g.Status.Parents[i].ParentRef) - defaultNamespace := v1beta1.Namespace(metav1.NamespaceDefault) - if forParentRef.Namespace == nil { - forParentRef.Namespace = &defaultNamespace - } - if p.Namespace == nil { - p.Namespace = &defaultNamespace - } - if reflect.DeepEqual(p, forParentRef) { - routeParentStatusIdx = i - break - } - } - if routeParentStatusIdx == -1 { - rParentStatus := v1alpha2.RouteParentStatus{ - ControllerName: v1alpha2.GatewayController(g.GatewayControllerName), - ParentRef: DowngradeParentReference(forParentRef), - } - g.Status.Parents = append(g.Status.Parents, rParentStatus) - routeParentStatusIdx = len(g.Status.Parents) - 1 - } - - ctx := &RouteParentContext{ - ParentReference: parentRef, - - grpcRoute: g.GRPCRoute, - routeParentStatusIdx: routeParentStatusIdx, - } - g.parentRefs[forParentRef] = ctx - return ctx + ParentRefs map[v1beta1.ParentReference]*RouteParentContext } // TLSRouteContext wraps a TLSRoute and provides helper methods for @@ -349,87 +186,7 @@ type TLSRouteContext struct { *v1alpha2.TLSRoute - parentRefs map[v1beta1.ParentReference]*RouteParentContext -} - -func (t *TLSRouteContext) GetRouteType() v1beta1.Kind { - return KindTLSRoute -} - -func (t *TLSRouteContext) GetHostnames() []string { - hostnames := make([]string, len(t.Spec.Hostnames)) - for idx, s := range t.Spec.Hostnames { - hostnames[idx] = string(s) - } - return hostnames -} - -func (t *TLSRouteContext) GetRouteStatus() *v1beta1.RouteStatus { - return &t.Status.RouteStatus -} - -func (t *TLSRouteContext) GetParentReferences() []v1beta1.ParentReference { - parentReferences := make([]v1beta1.ParentReference, len(t.Spec.ParentRefs)) - for idx, p := range t.Spec.ParentRefs { - parentReferences[idx] = UpgradeParentReference(p) - } - return parentReferences -} - -func (t *TLSRouteContext) GetRouteParentContext(forParentRef v1beta1.ParentReference) *RouteParentContext { - if t.parentRefs == nil { - t.parentRefs = make(map[v1beta1.ParentReference]*RouteParentContext) - } - - if ctx := t.parentRefs[forParentRef]; ctx != nil { - return ctx - } - - var parentRef *v1beta1.ParentReference - for i, p := range t.Spec.ParentRefs { - p := UpgradeParentReference(p) - if reflect.DeepEqual(p, forParentRef) { - upgraded := UpgradeParentReference(t.Spec.ParentRefs[i]) - parentRef = &upgraded - break - } - } - if parentRef == nil { - panic("parentRef not found") - } - - routeParentStatusIdx := -1 - for i := range t.Status.Parents { - p := UpgradeParentReference(t.Status.Parents[i].ParentRef) - defaultNamespace := v1beta1.Namespace(metav1.NamespaceDefault) - if forParentRef.Namespace == nil { - forParentRef.Namespace = &defaultNamespace - } - if p.Namespace == nil { - p.Namespace = &defaultNamespace - } - if reflect.DeepEqual(p, forParentRef) { - routeParentStatusIdx = i - break - } - } - if routeParentStatusIdx == -1 { - rParentStatus := v1alpha2.RouteParentStatus{ - ControllerName: v1alpha2.GatewayController(t.GatewayControllerName), - ParentRef: DowngradeParentReference(forParentRef), - } - t.Status.Parents = append(t.Status.Parents, rParentStatus) - routeParentStatusIdx = len(t.Status.Parents) - 1 - } - - ctx := &RouteParentContext{ - ParentReference: parentRef, - - tlsRoute: t.TLSRoute, - routeParentStatusIdx: routeParentStatusIdx, - } - t.parentRefs[forParentRef] = ctx - return ctx + ParentRefs map[v1beta1.ParentReference]*RouteParentContext } // UDPRouteContext wraps a UDPRoute and provides helper methods for @@ -440,83 +197,7 @@ type UDPRouteContext struct { *v1alpha2.UDPRoute - parentRefs map[v1beta1.ParentReference]*RouteParentContext -} - -func (u *UDPRouteContext) GetRouteType() v1beta1.Kind { - return KindUDPRoute -} - -func (u *UDPRouteContext) GetParentReferences() []v1beta1.ParentReference { - parentReferences := make([]v1beta1.ParentReference, len(u.Spec.ParentRefs)) - for idx, p := range u.Spec.ParentRefs { - parentReferences[idx] = UpgradeParentReference(p) - } - return parentReferences -} - -func (u *UDPRouteContext) GetRouteStatus() *v1beta1.RouteStatus { - return &u.Status.RouteStatus -} - -func (u *UDPRouteContext) GetRouteParentContext(forParentRef v1beta1.ParentReference) *RouteParentContext { - if u.parentRefs == nil { - u.parentRefs = make(map[v1beta1.ParentReference]*RouteParentContext) - } - - if ctx := u.parentRefs[forParentRef]; ctx != nil { - return ctx - } - - var parentRef *v1beta1.ParentReference - for i, p := range u.Spec.ParentRefs { - p := UpgradeParentReference(p) - if reflect.DeepEqual(p, forParentRef) { - upgraded := UpgradeParentReference(u.Spec.ParentRefs[i]) - parentRef = &upgraded - break - } - } - if parentRef == nil { - panic("parentRef not found") - } - - routeParentStatusIdx := -1 - for i := range u.Status.Parents { - p := UpgradeParentReference(u.Status.Parents[i].ParentRef) - defaultNamespace := v1beta1.Namespace(metav1.NamespaceDefault) - if forParentRef.Namespace == nil { - forParentRef.Namespace = &defaultNamespace - } - if p.Namespace == nil { - p.Namespace = &defaultNamespace - } - if reflect.DeepEqual(p, forParentRef) { - routeParentStatusIdx = i - break - } - } - if routeParentStatusIdx == -1 { - rParentStatus := v1alpha2.RouteParentStatus{ - ControllerName: v1alpha2.GatewayController(u.GatewayControllerName), - ParentRef: DowngradeParentReference(forParentRef), - } - u.Status.Parents = append(u.Status.Parents, rParentStatus) - routeParentStatusIdx = len(u.Status.Parents) - 1 - } - - ctx := &RouteParentContext{ - ParentReference: parentRef, - - udpRoute: u.UDPRoute, - routeParentStatusIdx: routeParentStatusIdx, - } - u.parentRefs[forParentRef] = ctx - return ctx -} - -func (u *UDPRouteContext) GetHostnames() []string { - return nil + ParentRefs map[v1beta1.ParentReference]*RouteParentContext } // TCPRouteContext wraps a TCPRoute and provides helper methods for @@ -527,40 +208,95 @@ type TCPRouteContext struct { *v1alpha2.TCPRoute - parentRefs map[v1beta1.ParentReference]*RouteParentContext + ParentRefs map[v1beta1.ParentReference]*RouteParentContext +} + +// GetRouteType returns the Kind of the Route object, HTTPRoute, +// TLSRoute, TCPRoute, UDPRoute etc. +func GetRouteType(route RouteContext) v1beta1.Kind { + rv := reflect.ValueOf(route).Elem() + return v1beta1.Kind(rv.FieldByName("Kind").String()) } -func (t *TCPRouteContext) GetRouteType() v1beta1.Kind { - return KindTCPRoute +// TODO: [v1alpha2-v1beta1] This should not be required once all Route +// objects being implemented are of type v1beta1. +// GetHostnames returns the hosts targeted by the Route object. +func GetHostnames(route RouteContext) []string { + rv := reflect.ValueOf(route).Elem() + kind := rv.FieldByName("Kind").String() + if kind == KindTCPRoute || kind == KindUDPRoute { + return nil + } + + hs := rv.FieldByName("Spec").FieldByName("Hostnames") + hostnames := make([]string, hs.Len()) + for i := 0; i < len(hostnames); i++ { + hostnames[i] = hs.Index(i).String() + } + return hostnames } -func (t *TCPRouteContext) GetParentReferences() []v1beta1.ParentReference { - parentReferences := make([]v1beta1.ParentReference, len(t.Spec.ParentRefs)) - for idx, p := range t.Spec.ParentRefs { - parentReferences[idx] = UpgradeParentReference(p) +// TODO: [v1alpha2-v1beta1] This should not be required once all Route +// objects being implemented are of type v1beta1. +// GetParentReferences returns the ParentReference of the Route object. +func GetParentReferences(route RouteContext) []v1beta1.ParentReference { + rv := reflect.ValueOf(route).Elem() + kind := rv.FieldByName("Kind").String() + pr := rv.FieldByName("Spec").FieldByName("ParentRefs") + if kind == KindHTTPRoute || kind == KindGRPCRoute { + return pr.Interface().([]v1beta1.ParentReference) + } + + parentReferences := make([]v1beta1.ParentReference, pr.Len()) + for i := 0; i < len(parentReferences); i++ { + p := pr.Index(i).Interface().(v1beta1.ParentReference) + parentReferences[i] = UpgradeParentReference(p) } return parentReferences } -func (t *TCPRouteContext) GetRouteStatus() *v1beta1.RouteStatus { - return &t.Status.RouteStatus +// GetRouteStatus returns the RouteStatus object associated with the Route. +func GetRouteStatus(route RouteContext) *v1beta1.RouteStatus { + rv := reflect.ValueOf(route).Elem() + rs := rv.FieldByName("Status").FieldByName("RouteStatus").Interface().(v1beta1.RouteStatus) + return &rs } -func (t *TCPRouteContext) GetRouteParentContext(forParentRef v1beta1.ParentReference) *RouteParentContext { - if t.parentRefs == nil { - t.parentRefs = make(map[v1beta1.ParentReference]*RouteParentContext) +// GetRouteParentContext returns RouteParentContext by using the Route +// objects' ParentReference. +func GetRouteParentContext(route RouteContext, forParentRef v1beta1.ParentReference) *RouteParentContext { + rv := reflect.ValueOf(route).Elem() + pr := rv.FieldByName("ParentRefs") + if pr.IsNil() { + mm := reflect.MakeMap(reflect.TypeOf(map[v1beta1.ParentReference]*RouteParentContext{})) + pr.Set(mm) } - if ctx := t.parentRefs[forParentRef]; ctx != nil { + if p := pr.MapIndex(reflect.ValueOf(forParentRef)); p.IsValid() && !p.IsZero() { + ctx := p.Interface().(*RouteParentContext) return ctx } + isHTTPRoute := false + if rv.FieldByName("Kind").String() == KindHTTPRoute { + isHTTPRoute = true + } + var parentRef *v1beta1.ParentReference - for i, p := range t.Spec.ParentRefs { - p := UpgradeParentReference(p) - if reflect.DeepEqual(p, forParentRef) { - upgraded := UpgradeParentReference(t.Spec.ParentRefs[i]) - parentRef = &upgraded + specParentRefs := rv.FieldByName("Spec").FieldByName("ParentRefs") + for i := 0; i < specParentRefs.Len(); i++ { + p := specParentRefs.Index(i).Interface().(v1beta1.ParentReference) + up := p + if !isHTTPRoute { + up = UpgradeParentReference(p) + } + if reflect.DeepEqual(up, forParentRef) { + if isHTTPRoute { + parentRef = &p + } else { + upgraded := UpgradeParentReference(p) + parentRef = &upgraded + } break } } @@ -569,14 +305,18 @@ func (t *TCPRouteContext) GetRouteParentContext(forParentRef v1beta1.ParentRefer } routeParentStatusIdx := -1 - for i := range t.Status.Parents { - p := UpgradeParentReference(t.Status.Parents[i].ParentRef) - defaultNamespace := v1beta1.Namespace(metav1.NamespaceDefault) - if forParentRef.Namespace == nil { - forParentRef.Namespace = &defaultNamespace - } - if p.Namespace == nil { - p.Namespace = &defaultNamespace + statusParents := rv.FieldByName("Status").FieldByName("Parents") + for i := 0; i < statusParents.Len(); i++ { + p := statusParents.Index(i).FieldByName("ParentRef").Interface().(v1beta1.ParentReference) + if !isHTTPRoute { + p = UpgradeParentReference(p) + defaultNamespace := v1beta1.Namespace(metav1.NamespaceDefault) + if forParentRef.Namespace == nil { + forParentRef.Namespace = &defaultNamespace + } + if p.Namespace == nil { + p.Namespace = &defaultNamespace + } } if reflect.DeepEqual(p, forParentRef) { routeParentStatusIdx = i @@ -584,28 +324,28 @@ func (t *TCPRouteContext) GetRouteParentContext(forParentRef v1beta1.ParentRefer } } if routeParentStatusIdx == -1 { + tmpPR := forParentRef + if !isHTTPRoute { + tmpPR = DowngradeParentReference(tmpPR) + } rParentStatus := v1alpha2.RouteParentStatus{ - ControllerName: v1alpha2.GatewayController(t.GatewayControllerName), - ParentRef: DowngradeParentReference(forParentRef), + ControllerName: v1alpha2.GatewayController(rv.FieldByName("GatewayControllerName").String()), + ParentRef: tmpPR, } - t.Status.Parents = append(t.Status.Parents, rParentStatus) - routeParentStatusIdx = len(t.Status.Parents) - 1 + statusParents.Set(reflect.Append(statusParents, reflect.ValueOf(rParentStatus))) + routeParentStatusIdx = statusParents.Len() - 1 } ctx := &RouteParentContext{ - ParentReference: parentRef, - - tcpRoute: t.TCPRoute, + ParentReference: parentRef, routeParentStatusIdx: routeParentStatusIdx, } - t.parentRefs[forParentRef] = ctx + rctx := reflect.ValueOf(ctx) + rctx.Elem().FieldByName(string(GetRouteType(route))).Set(rv.Field(1)) + pr.SetMapIndex(reflect.ValueOf(forParentRef), rctx) return ctx } -func (t *TCPRouteContext) GetHostnames() []string { - return nil -} - // RouteParentContext wraps a ParentReference and provides helper methods for // setting conditions and other status information on the associated // HTTPRoute, TLSRoute etc. @@ -614,11 +354,11 @@ type RouteParentContext struct { // TODO: [v1alpha2-v1beta1] This can probably be replaced with // a single field pointing to *v1beta1.RouteStatus. - httpRoute *v1beta1.HTTPRoute - grpcRoute *v1alpha2.GRPCRoute - tlsRoute *v1alpha2.TLSRoute - tcpRoute *v1alpha2.TCPRoute - udpRoute *v1alpha2.UDPRoute + HTTPRoute *v1beta1.HTTPRoute + GRPCRoute *v1alpha2.GRPCRoute + TLSRoute *v1alpha2.TLSRoute + TCPRoute *v1alpha2.TCPRoute + UDPRoute *v1alpha2.UDPRoute routeParentStatusIdx int listeners []*ListenerContext @@ -639,7 +379,7 @@ func (r *RouteParentContext) SetCondition(route RouteContext, conditionType v1be } idx := -1 - routeStatus := route.GetRouteStatus() + routeStatus := GetRouteStatus(route) for i, existing := range routeStatus.Parents[r.routeParentStatusIdx].Conditions { if existing.Type == cond.Type { // return early if the condition is unchanged @@ -662,13 +402,13 @@ func (r *RouteParentContext) SetCondition(route RouteContext, conditionType v1be } func (r *RouteParentContext) ResetConditions(route RouteContext) { - routeStatus := route.GetRouteStatus() + routeStatus := GetRouteStatus(route) routeStatus.Parents[r.routeParentStatusIdx].Conditions = make([]metav1.Condition, 0) } func (r *RouteParentContext) HasCondition(route RouteContext, condType v1beta1.RouteConditionType, status metav1.ConditionStatus) bool { var conditions []metav1.Condition - routeStatus := route.GetRouteStatus() + routeStatus := GetRouteStatus(route) conditions = routeStatus.Parents[r.routeParentStatusIdx].Conditions for _, c := range conditions { if c.Type == string(condType) && c.Status == status { diff --git a/internal/gatewayapi/route.go b/internal/gatewayapi/route.go index 835315d4c15..85e92660b98 100644 --- a/internal/gatewayapi/route.go +++ b/internal/gatewayapi/route.go @@ -87,7 +87,7 @@ func (t *Translator) ProcessGRPCRoutes(grpcRoutes []*v1alpha2.GRPCRoute, gateway } func (t *Translator) processHTTPRouteParentRefs(httpRoute *HTTPRouteContext, resources *Resources, xdsIR XdsIRMap) { - for _, parentRef := range httpRoute.parentRefs { + for _, parentRef := range httpRoute.ParentRefs { // Need to compute Route rules within the parentRef loop because // any conditions that come out of it have to go on each RouteParentStatus, // not on the Route as a whole. @@ -119,8 +119,8 @@ func (t *Translator) processHTTPRouteParentRefs(httpRoute *HTTPRouteContext, res } // If no negative conditions have been set, the route is considered "Accepted=True". - if parentRef.httpRoute != nil && - len(parentRef.httpRoute.Status.Parents[parentRef.routeParentStatusIdx].Conditions) == 0 { + if parentRef.HTTPRoute != nil && + len(parentRef.HTTPRoute.Status.Parents[parentRef.routeParentStatusIdx].Conditions) == 0 { parentRef.SetCondition(httpRoute, v1beta1.RouteConditionAccepted, metav1.ConditionTrue, @@ -297,7 +297,7 @@ func applyHTTPFiltersContextToIRRoute(httpFiltersContext *HTTPFiltersContext, ir } func (t *Translator) processGRPCRouteParentRefs(grpcRoute *GRPCRouteContext, resources *Resources, xdsIR XdsIRMap) { - for _, parentRef := range grpcRoute.parentRefs { + for _, parentRef := range grpcRoute.ParentRefs { // Need to compute Route rules within the parentRef loop because // any conditions that come out of it have to go on each RouteParentStatus, @@ -328,8 +328,8 @@ func (t *Translator) processGRPCRouteParentRefs(grpcRoute *GRPCRouteContext, res } // If no negative conditions have been set, the route is considered "Accepted=True". - if parentRef.grpcRoute != nil && - len(parentRef.grpcRoute.Status.Parents[parentRef.routeParentStatusIdx].Conditions) == 0 { + if parentRef.GRPCRoute != nil && + len(parentRef.GRPCRoute.Status.Parents[parentRef.routeParentStatusIdx].Conditions) == 0 { parentRef.SetCondition(grpcRoute, v1beta1.RouteConditionAccepted, metav1.ConditionTrue, @@ -480,7 +480,7 @@ func (t *Translator) processHTTPRouteParentRefListener(route RouteContext, route var hasHostnameIntersection bool for _, listener := range parentRef.listeners { - hosts := computeHosts(route.GetHostnames(), listener.Hostname) + hosts := computeHosts(GetHostnames(route), listener.Hostname) if len(hosts) == 0 { continue } @@ -538,7 +538,7 @@ func (t *Translator) processHTTPRouteParentRefListener(route RouteContext, route irKey := irStringKey(listener.gateway) irListener := xdsIR[irKey].GetHTTPListener(irHTTPListenerName(listener)) if irListener != nil { - if route.GetRouteType() == KindGRPCRoute { + if GetRouteType(route) == KindGRPCRoute { irListener.IsHTTP2 = true } irListener.Routes = append(irListener.Routes, perHostRoutes...) @@ -583,7 +583,7 @@ func (t *Translator) ProcessTLSRoutes(tlsRoutes []*v1alpha2.TLSRoute, gateways [ } func (t *Translator) processTLSRouteParentRefs(tlsRoute *TLSRouteContext, resources *Resources, xdsIR XdsIRMap) { - for _, parentRef := range tlsRoute.parentRefs { + for _, parentRef := range tlsRoute.ParentRefs { // Need to compute Route rules within the parentRef loop because // any conditions that come out of it have to go on each RouteParentStatus, @@ -622,7 +622,7 @@ func (t *Translator) processTLSRouteParentRefs(tlsRoute *TLSRouteContext, resour var hasHostnameIntersection bool for _, listener := range parentRef.listeners { - hosts := computeHosts(tlsRoute.GetHostnames(), listener.Hostname) + hosts := computeHosts(GetHostnames(tlsRoute), listener.Hostname) if len(hosts) == 0 { continue } @@ -663,8 +663,8 @@ func (t *Translator) processTLSRouteParentRefs(tlsRoute *TLSRouteContext, resour } // If no negative conditions have been set, the route is considered "Accepted=True". - if parentRef.tlsRoute != nil && - len(parentRef.tlsRoute.Status.Parents[parentRef.routeParentStatusIdx].Conditions) == 0 { + if parentRef.TLSRoute != nil && + len(parentRef.TLSRoute.Status.Parents[parentRef.routeParentStatusIdx].Conditions) == 0 { parentRef.SetCondition(tlsRoute, v1beta1.RouteConditionAccepted, metav1.ConditionTrue, @@ -705,7 +705,7 @@ func (t *Translator) ProcessUDPRoutes(udpRoutes []*v1alpha2.UDPRoute, gateways [ } func (t *Translator) processUDPRouteParentRefs(udpRoute *UDPRouteContext, resources *Resources, xdsIR XdsIRMap) { - for _, parentRef := range udpRoute.parentRefs { + for _, parentRef := range udpRoute.ParentRefs { // Need to compute Route rules within the parentRef loop because // any conditions that come out of it have to go on each RouteParentStatus, // not on the Route as a whole. @@ -786,8 +786,8 @@ func (t *Translator) processUDPRouteParentRefs(udpRoute *UDPRouteContext, resour } // If no negative conditions have been set, the route is considered "Accepted=True". - if accepted && parentRef.udpRoute != nil && - len(parentRef.udpRoute.Status.Parents[parentRef.routeParentStatusIdx].Conditions) == 0 { + if accepted && parentRef.UDPRoute != nil && + len(parentRef.UDPRoute.Status.Parents[parentRef.routeParentStatusIdx].Conditions) == 0 { parentRef.SetCondition(udpRoute, v1beta1.RouteConditionAccepted, metav1.ConditionTrue, @@ -837,7 +837,7 @@ func (t *Translator) ProcessTCPRoutes(tcpRoutes []*v1alpha2.TCPRoute, gateways [ } func (t *Translator) processTCPRouteParentRefs(tcpRoute *TCPRouteContext, resources *Resources, xdsIR XdsIRMap) { - for _, parentRef := range tcpRoute.parentRefs { + for _, parentRef := range tcpRoute.ParentRefs { // Need to compute Route rules within the parentRef loop because // any conditions that come out of it have to go on each RouteParentStatus, @@ -919,8 +919,8 @@ func (t *Translator) processTCPRouteParentRefs(tcpRoute *TCPRouteContext, resour } // If no negative conditions have been set, the route is considered "Accepted=True". - if accepted && parentRef.tcpRoute != nil && - len(parentRef.tcpRoute.Status.Parents[parentRef.routeParentStatusIdx].Conditions) == 0 { + if accepted && parentRef.TCPRoute != nil && + len(parentRef.TCPRoute.Status.Parents[parentRef.routeParentStatusIdx].Conditions) == 0 { parentRef.SetCondition(tcpRoute, v1beta1.RouteConditionAccepted, metav1.ConditionTrue, @@ -956,7 +956,7 @@ func (t *Translator) processRouteDestinations(backendRef v1beta1.BackendRef, serviceNamespace := NamespaceDerefOr(backendRef.Namespace, route.GetNamespace()) service := resources.GetService(serviceNamespace, string(backendRef.Name)) - routeType := route.GetRouteType() + routeType := GetRouteType(route) if !t.validateBackendRef(&backendRef, parentRef, route, resources, serviceNamespace, routeType) { return nil, weight } @@ -983,7 +983,7 @@ func (t *Translator) processRouteDestinations(backendRef v1beta1.BackendRef, func (t *Translator) processAllowedListenersForParentRefs(routeContext RouteContext, gateways []*GatewayContext, resources *Resources) bool { var relevantRoute bool - for _, parentRef := range routeContext.GetParentReferences() { + for _, parentRef := range GetParentReferences(routeContext) { isRelevantParentRef, selectedListeners := GetReferencedListeners(parentRef, gateways) // Parent ref is not to a Gateway that we control: skip it @@ -992,7 +992,7 @@ func (t *Translator) processAllowedListenersForParentRefs(routeContext RouteCont } relevantRoute = true - parentRefCtx := routeContext.GetRouteParentContext(parentRef) + parentRefCtx := GetRouteParentContext(routeContext, parentRef) // Reset conditions since they will be recomputed during translation parentRefCtx.ResetConditions(routeContext) @@ -1018,7 +1018,7 @@ func (t *Translator) processAllowedListenersForParentRefs(routeContext RouteCont var allowedListeners []*ListenerContext for _, listener := range selectedListeners { - acceptedKind := routeContext.GetRouteType() + acceptedKind := GetRouteType(routeContext) if listener.AllowsKind(v1beta1.RouteGroupKind{Group: GroupPtr(v1beta1.GroupName), Kind: acceptedKind}) && listener.AllowsNamespace(resources.GetNamespace(routeContext.GetNamespace())) { allowedListeners = append(allowedListeners, listener) From b6f37ab04f6914e9fe953a6120c19c560793f75b Mon Sep 17 00:00:00 2001 From: Arko Dasgupta Date: Fri, 23 Jun 2023 16:35:08 -0700 Subject: [PATCH 02/16] Fix proto tooling (#1579) * Fix proto tooling * Add `protoc-gen-go-grpc` & `protoc-gen-go` dep to `make protos` * init go mod for `protoc-gen-go` Signed-off-by: Arko Dasgupta * update buf.gen.yaml Signed-off-by: Arko Dasgupta --------- Signed-off-by: Arko Dasgupta --- buf.gen.yaml | 1 + proto/extension/context.pb.go | 2 +- proto/extension/service.pb.go | 2 +- proto/extension/service_grpc.pb.go | 25 ++++++++++++++++--------- tools/make/proto.mk | 2 +- tools/src/protoc-gen-go/go.mod | 5 +++++ tools/src/protoc-gen-go/go.sum | 8 ++++++++ 7 files changed, 33 insertions(+), 12 deletions(-) create mode 100644 tools/src/protoc-gen-go/go.mod create mode 100644 tools/src/protoc-gen-go/go.sum diff --git a/buf.gen.yaml b/buf.gen.yaml index 3a414dd723e..b08a2d53086 100644 --- a/buf.gen.yaml +++ b/buf.gen.yaml @@ -3,6 +3,7 @@ plugins: - plugin: go out: ./ path: tools/bin/protoc-gen-go + opt: paths=source_relative - plugin: go-grpc out: ./ path: tools/bin/protoc-gen-go-grpc diff --git a/proto/extension/context.pb.go b/proto/extension/context.pb.go index 1436e68a7e9..8c8b2512f62 100644 --- a/proto/extension/context.pb.go +++ b/proto/extension/context.pb.go @@ -5,7 +5,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 +// protoc-gen-go v1.30.0 // protoc (unknown) // source: proto/extension/context.proto diff --git a/proto/extension/service.pb.go b/proto/extension/service.pb.go index 56e76e5e2b1..8e89b80788e 100644 --- a/proto/extension/service.pb.go +++ b/proto/extension/service.pb.go @@ -5,7 +5,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 +// protoc-gen-go v1.30.0 // protoc (unknown) // source: proto/extension/service.proto diff --git a/proto/extension/service_grpc.pb.go b/proto/extension/service_grpc.pb.go index cde92be392f..2d01d54b8a2 100644 --- a/proto/extension/service_grpc.pb.go +++ b/proto/extension/service_grpc.pb.go @@ -5,7 +5,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.2.0 +// - protoc-gen-go-grpc v1.3.0 // - protoc (unknown) // source: proto/extension/service.proto @@ -23,6 +23,13 @@ import ( // Requires gRPC-Go v1.32.0 or later. const _ = grpc.SupportPackageIsVersion7 +const ( + EnvoyGatewayExtension_PostRouteModify_FullMethodName = "/envoygateway.extension.EnvoyGatewayExtension/PostRouteModify" + EnvoyGatewayExtension_PostVirtualHostModify_FullMethodName = "/envoygateway.extension.EnvoyGatewayExtension/PostVirtualHostModify" + EnvoyGatewayExtension_PostHTTPListenerModify_FullMethodName = "/envoygateway.extension.EnvoyGatewayExtension/PostHTTPListenerModify" + EnvoyGatewayExtension_PostTranslateModify_FullMethodName = "/envoygateway.extension.EnvoyGatewayExtension/PostTranslateModify" +) + // EnvoyGatewayExtensionClient is the client API for EnvoyGatewayExtension service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. @@ -64,7 +71,7 @@ func NewEnvoyGatewayExtensionClient(cc grpc.ClientConnInterface) EnvoyGatewayExt func (c *envoyGatewayExtensionClient) PostRouteModify(ctx context.Context, in *PostRouteModifyRequest, opts ...grpc.CallOption) (*PostRouteModifyResponse, error) { out := new(PostRouteModifyResponse) - err := c.cc.Invoke(ctx, "/envoygateway.extension.EnvoyGatewayExtension/PostRouteModify", in, out, opts...) + err := c.cc.Invoke(ctx, EnvoyGatewayExtension_PostRouteModify_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -73,7 +80,7 @@ func (c *envoyGatewayExtensionClient) PostRouteModify(ctx context.Context, in *P func (c *envoyGatewayExtensionClient) PostVirtualHostModify(ctx context.Context, in *PostVirtualHostModifyRequest, opts ...grpc.CallOption) (*PostVirtualHostModifyResponse, error) { out := new(PostVirtualHostModifyResponse) - err := c.cc.Invoke(ctx, "/envoygateway.extension.EnvoyGatewayExtension/PostVirtualHostModify", in, out, opts...) + err := c.cc.Invoke(ctx, EnvoyGatewayExtension_PostVirtualHostModify_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -82,7 +89,7 @@ func (c *envoyGatewayExtensionClient) PostVirtualHostModify(ctx context.Context, func (c *envoyGatewayExtensionClient) PostHTTPListenerModify(ctx context.Context, in *PostHTTPListenerModifyRequest, opts ...grpc.CallOption) (*PostHTTPListenerModifyResponse, error) { out := new(PostHTTPListenerModifyResponse) - err := c.cc.Invoke(ctx, "/envoygateway.extension.EnvoyGatewayExtension/PostHTTPListenerModify", in, out, opts...) + err := c.cc.Invoke(ctx, EnvoyGatewayExtension_PostHTTPListenerModify_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -91,7 +98,7 @@ func (c *envoyGatewayExtensionClient) PostHTTPListenerModify(ctx context.Context func (c *envoyGatewayExtensionClient) PostTranslateModify(ctx context.Context, in *PostTranslateModifyRequest, opts ...grpc.CallOption) (*PostTranslateModifyResponse, error) { out := new(PostTranslateModifyResponse) - err := c.cc.Invoke(ctx, "/envoygateway.extension.EnvoyGatewayExtension/PostTranslateModify", in, out, opts...) + err := c.cc.Invoke(ctx, EnvoyGatewayExtension_PostTranslateModify_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -169,7 +176,7 @@ func _EnvoyGatewayExtension_PostRouteModify_Handler(srv interface{}, ctx context } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/envoygateway.extension.EnvoyGatewayExtension/PostRouteModify", + FullMethod: EnvoyGatewayExtension_PostRouteModify_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(EnvoyGatewayExtensionServer).PostRouteModify(ctx, req.(*PostRouteModifyRequest)) @@ -187,7 +194,7 @@ func _EnvoyGatewayExtension_PostVirtualHostModify_Handler(srv interface{}, ctx c } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/envoygateway.extension.EnvoyGatewayExtension/PostVirtualHostModify", + FullMethod: EnvoyGatewayExtension_PostVirtualHostModify_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(EnvoyGatewayExtensionServer).PostVirtualHostModify(ctx, req.(*PostVirtualHostModifyRequest)) @@ -205,7 +212,7 @@ func _EnvoyGatewayExtension_PostHTTPListenerModify_Handler(srv interface{}, ctx } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/envoygateway.extension.EnvoyGatewayExtension/PostHTTPListenerModify", + FullMethod: EnvoyGatewayExtension_PostHTTPListenerModify_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(EnvoyGatewayExtensionServer).PostHTTPListenerModify(ctx, req.(*PostHTTPListenerModifyRequest)) @@ -223,7 +230,7 @@ func _EnvoyGatewayExtension_PostTranslateModify_Handler(srv interface{}, ctx con } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/envoygateway.extension.EnvoyGatewayExtension/PostTranslateModify", + FullMethod: EnvoyGatewayExtension_PostTranslateModify_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(EnvoyGatewayExtensionServer).PostTranslateModify(ctx, req.(*PostTranslateModifyRequest)) diff --git a/tools/make/proto.mk b/tools/make/proto.mk index a7f1bb010c5..9517a748543 100644 --- a/tools/make/proto.mk +++ b/tools/make/proto.mk @@ -1,7 +1,7 @@ ##@ Protobufs .PHONY: protos -protos: $(tools/buf) ## Compile all protobufs +protos: $(tools/protoc-gen-go) $(tools/protoc-gen-go-grpc) $(tools/buf) ## Compile all protobufs $(tools/buf) generate .PHONY: buf-mod-update diff --git a/tools/src/protoc-gen-go/go.mod b/tools/src/protoc-gen-go/go.mod new file mode 100644 index 00000000000..112de585840 --- /dev/null +++ b/tools/src/protoc-gen-go/go.mod @@ -0,0 +1,5 @@ +module github.com/envoyproxy/gateway/tools/src/protoc-gen-go + +go 1.20 + +require google.golang.org/protobuf v1.30.0 diff --git a/tools/src/protoc-gen-go/go.sum b/tools/src/protoc-gen-go/go.sum new file mode 100644 index 00000000000..1838366909d --- /dev/null +++ b/tools/src/protoc-gen-go/go.sum @@ -0,0 +1,8 @@ +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= +google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= From ad3331d2801a0a351f7a3254d912652080b54a6d Mon Sep 17 00:00:00 2001 From: Arko Dasgupta Date: Fri, 23 Jun 2023 16:52:45 -0700 Subject: [PATCH 03/16] chore: rm .golangci.yml file in root dir (#1576) * chore: rm .golangci.yml file in root dir `tools/linter/golangci-lint/.golangci.yml` is used as the config file for `golangci-lint` ``` ===========> Running lint.golint ... tools/bin/golangci-lint run --build-tags=e2e --config=tools/linter/golangci-lint/.golangci.yml ``` Signed-off-by: Arko Dasgupta --- .golangci.yml | 74 --------------------------------------- docs/latest/dev/README.md | 1 + 2 files changed, 1 insertion(+), 74 deletions(-) delete mode 100644 .golangci.yml diff --git a/.golangci.yml b/.golangci.yml deleted file mode 100644 index 0e097034fa1..00000000000 --- a/.golangci.yml +++ /dev/null @@ -1,74 +0,0 @@ -run: - deadline: 10m - -linters: - enable: - - bodyclose - - depguard - - exportloopref - - gofmt - - goimports - - goheader - - gocritic - - gosec - - misspell - - revive - - unconvert - - unparam - -linters-settings: - depguard: - rules: - Main: - deny: - - pkg: github.com/gogo/protobuf - desc: "gogo/protobuf is deprecated, use golang/protobuf" - - pkg: gopkg.in/yaml.v2 - desc: "use sigs.k8s.io/yaml instead" - - pkg: gopkg.in/yaml.v3 - desc: "use sigs.k8s.io/yaml instead" - gci: - sections: - # Captures all standard packages if they do not match another section. - - standard - # Contains all imports that could not be matched to another section type. - - default - # Groups all imports with the specified Prefix. - - prefix(github.com/envoyproxy/gateway/) - goimports: - # put imports beginning with prefix after 3rd-party packages; - # it's a comma-separated list of prefixes - local-prefixes: github.com/envoyproxy/gateway/ - gofmt: - simplify: true - unparam: - check-exported: false - revive: - rules: - # TODO: enable if-return check - - name: if-return - disabled: true - goheader: - # Note that because the format is different (this needs no comment markers), - # updating this text means also updating /tools/boilerplate.txt so that - # `make generate` will update the generated files correctly. - template: |- - Copyright Envoy Gateway Authors - SPDX-License-Identifier: Apache-2.0 - The full text of the Apache license is available in the LICENSE file at - the root of the repo. - -issues: - exclude-rules: - - path: zz_generated - linters: - - goimports - - linters: - - staticcheck - text: "SA1019:" - - path: test/e2e - linters: - - bodyclose - # Show the complete output - max-issues-per-linter: 0 - max-same-issues: 0 diff --git a/docs/latest/dev/README.md b/docs/latest/dev/README.md index d4267f264c4..5b40e7d71ba 100644 --- a/docs/latest/dev/README.md +++ b/docs/latest/dev/README.md @@ -47,6 +47,7 @@ __Note:__ The binaries get generated in the `bin/$OS/$ARCH` directory, for examp ### Running Linters * Run `make lint` to make sure your code passes all the linter checks. +__Note:__ The `golangci-lint` configuration resides [here](https://github.com/envoyproxy/gateway/blob/main/tools/linter/golangci-lint/.golangci.yml). ### Building and Pushing the Image From c3557bcd4ef867cdf290964ff2227af0a8154e4d Mon Sep 17 00:00:00 2001 From: Pratyush Singhal Date: Mon, 26 Jun 2023 12:26:45 +0530 Subject: [PATCH 04/16] feat(infrastructure/proxy): add readiness probes in envoy proxy deployments (#1568) * feat: add readiness probes in envoy proxy deployments This commit adds readiness probes in envoy proxy deployments to prevent pods in not ready state to receive traffic. This allows envoy proxy configurations and in-place upgrades without traffic drops using the configured rollout strategy. Signed-off-by: Pratyush Singhal * refactor: add a separate healthcheck listener for readinessProbe in bootstrap config Signed-off-by: Pratyush Singhal * test: fix translate and infra/proxy tests Signed-off-by: Pratyush Singhal --------- Signed-off-by: Pratyush Singhal Co-authored-by: Xunzhuo --- .../translate/out/default-resources.all.yaml | 53 +++++++++++++++++++ .../out/from-gateway-api-to-xds.all.json | 50 +++++++++++++++++ .../out/from-gateway-api-to-xds.all.yaml | 26 +++++++++ .../from-gateway-api-to-xds.bootstrap.yaml | 26 +++++++++ .../kubernetes/proxy/resource.go | 9 ++++ .../proxy/testdata/deployments/bootstrap.yaml | 4 ++ .../testdata/deployments/component-level.yaml | 4 ++ .../proxy/testdata/deployments/custom.yaml | 31 +++++++++++ .../testdata/deployments/default-env.yaml | 31 +++++++++++ .../proxy/testdata/deployments/default.yaml | 31 +++++++++++ .../testdata/deployments/extension-env.yaml | 31 +++++++++++ .../proxy/testdata/deployments/volumes.yaml | 31 +++++++++++ internal/xds/bootstrap/bootstrap.go | 20 +++++++ internal/xds/bootstrap/bootstrap.yaml.tpl | 27 ++++++++++ 14 files changed, 374 insertions(+) diff --git a/internal/cmd/egctl/testdata/translate/out/default-resources.all.yaml b/internal/cmd/egctl/testdata/translate/out/default-resources.all.yaml index 9faa39854a8..72267a69a2c 100644 --- a/internal/cmd/egctl/testdata/translate/out/default-resources.all.yaml +++ b/internal/cmd/egctl/testdata/translate/out/default-resources.all.yaml @@ -30,6 +30,33 @@ envoyProxy: ads: {} resource_api_version: V3 static_resources: + listeners: + - name: envoy-gateway-proxy-ready-0.0.0.0-19001 + address: + socket_address: + address: 0.0.0.0 + port_value: 19001 + protocol: TCP + filter_chains: + - filters: + - name: envoy.filters.network.http_connection_manager + typed_config: + "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager + stat_prefix: eg-ready-http + route_config: + name: local_route + http_filters: + - name: envoy.filters.http.health_check + typed_config: + "@type": type.googleapis.com/envoy.extensions.filters.http.health_check.v3.HealthCheck + pass_through_mode: false + headers: + - name: ":path" + string_match: + exact: /ready + - name: envoy.filters.http.router + typed_config: + "@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router clusters: - connect_timeout: 10s load_assignment: @@ -431,6 +458,32 @@ xds: ads: {} resourceApiVersion: V3 staticResources: + listeners: + - name: envoy-gateway-proxy-ready-0.0.0.0-19001 + address: + socketAddress: + address: 0.0.0.0 + portValue: 19001 + filterChains: + - filters: + - name: envoy.filters.network.http_connection_manager + typedConfig: + "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager + statPrefix: eg-ready-http + routeConfig: + name: local_route + httpFilters: + - name: envoy.filters.http.health_check + typedConfig: + "@type": type.googleapis.com/envoy.extensions.filters.http.health_check.v3.HealthCheck + passThroughMode: false + headers: + - name: ":path" + stringMatch: + exact: /ready + - name: envoy.filters.http.router + typedConfig: + "@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router clusters: - connectTimeout: 10s loadAssignment: diff --git a/internal/cmd/egctl/testdata/translate/out/from-gateway-api-to-xds.all.json b/internal/cmd/egctl/testdata/translate/out/from-gateway-api-to-xds.all.json index 5ca7d75850f..726ecdd8a6e 100644 --- a/internal/cmd/egctl/testdata/translate/out/from-gateway-api-to-xds.all.json +++ b/internal/cmd/egctl/testdata/translate/out/from-gateway-api-to-xds.all.json @@ -59,6 +59,56 @@ ] }, "staticResources": { + "listeners": [ + { + "name": "envoy-gateway-proxy-ready-0.0.0.0-19001", + "address": { + "socketAddress": { + "address": "0.0.0.0", + "portValue": 19001, + } + }, + "filterChains": [ + { + "filters": [ + { + "name": "envoy.filters.network.http_connection_manager", + "typedConfig": { + "@type": "type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager", + "statPrefix": "eg-ready-http", + "routeConfig": { + "name": "local_route" + }, + "httpFilters": [ + { + "name": "envoy.filters.http.health_check", + "typedConfig": { + "@type": "type.googleapis.com/envoy.extensions.filters.http.health_check.v3.HealthCheck", + "passThroughMode": false, + "headers": [ + { + "name": ":path", + "stringMatch": { + "exact": "/ready" + } + } + ] + } + }, + { + "name": "envoy.filters.http.router", + "typedConfig": { + "@type": "type.googleapis.com/envoy.extensions.filters.http.router.v3.Router" + } + } + ] + } + } + ] + } + ] + } + ], "clusters": [ { "connectTimeout": "10s", diff --git a/internal/cmd/egctl/testdata/translate/out/from-gateway-api-to-xds.all.yaml b/internal/cmd/egctl/testdata/translate/out/from-gateway-api-to-xds.all.yaml index 398c0242dc0..efa43263d87 100644 --- a/internal/cmd/egctl/testdata/translate/out/from-gateway-api-to-xds.all.yaml +++ b/internal/cmd/egctl/testdata/translate/out/from-gateway-api-to-xds.all.yaml @@ -36,6 +36,32 @@ xds: ads: {} resourceApiVersion: V3 staticResources: + listeners: + - name: envoy-gateway-proxy-ready-0.0.0.0-19001 + address: + socketAddress: + address: 0.0.0.0 + portValue: 19001 + filterChains: + - filters: + - name: envoy.filters.network.http_connection_manager + typedConfig: + "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager + statPrefix: eg-ready-http + routeConfig: + name: local_route + httpFilters: + - name: envoy.filters.http.health_check + typedConfig: + "@type": type.googleapis.com/envoy.extensions.filters.http.health_check.v3.HealthCheck + passThroughMode: false + headers: + - name: ":path" + stringMatch: + exact: /ready + - name: envoy.filters.http.router + typedConfig: + "@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router clusters: - connectTimeout: 10s loadAssignment: diff --git a/internal/cmd/egctl/testdata/translate/out/from-gateway-api-to-xds.bootstrap.yaml b/internal/cmd/egctl/testdata/translate/out/from-gateway-api-to-xds.bootstrap.yaml index 07aac9314c3..c96fca5787e 100644 --- a/internal/cmd/egctl/testdata/translate/out/from-gateway-api-to-xds.bootstrap.yaml +++ b/internal/cmd/egctl/testdata/translate/out/from-gateway-api-to-xds.bootstrap.yaml @@ -35,6 +35,32 @@ xds: ads: {} resourceApiVersion: V3 staticResources: + listeners: + - name: envoy-gateway-proxy-ready-0.0.0.0-19001 + address: + socketAddress: + address: 0.0.0.0 + portValue: 19001 + filterChains: + - filters: + - name: envoy.filters.network.http_connection_manager + typedConfig: + "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager + statPrefix: eg-ready-http + routeConfig: + name: local_route + httpFilters: + - name: envoy.filters.http.health_check + typedConfig: + "@type": type.googleapis.com/envoy.extensions.filters.http.health_check.v3.HealthCheck + passThroughMode: false + headers: + - name: ":path" + stringMatch: + exact: /ready + - name: envoy.filters.http.router + typedConfig: + "@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router clusters: - connectTimeout: 10s loadAssignment: diff --git a/internal/infrastructure/kubernetes/proxy/resource.go b/internal/infrastructure/kubernetes/proxy/resource.go index 686f891981b..7e6574eb75a 100644 --- a/internal/infrastructure/kubernetes/proxy/resource.go +++ b/internal/infrastructure/kubernetes/proxy/resource.go @@ -11,6 +11,7 @@ import ( "strings" corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/util/intstr" "k8s.io/utils/pointer" egcfgv1a1 "github.com/envoyproxy/gateway/api/config/v1alpha1" @@ -154,6 +155,14 @@ func expectedProxyContainers(infra *ir.ProxyInfra, deploymentConfig *egcfgv1a1.K VolumeMounts: expectedContainerVolumeMounts(deploymentConfig), TerminationMessagePolicy: corev1.TerminationMessageReadFile, TerminationMessagePath: "/dev/termination-log", + ReadinessProbe: &corev1.Probe{ + ProbeHandler: corev1.ProbeHandler{ + HTTPGet: &corev1.HTTPGetAction{ + Path: bootstrap.EnvoyReadinessPath, + Port: intstr.IntOrString{Type: intstr.Int, IntVal: bootstrap.EnvoyReadinessPort}, + }, + }, + }, }, } diff --git a/internal/infrastructure/kubernetes/proxy/testdata/deployments/bootstrap.yaml b/internal/infrastructure/kubernetes/proxy/testdata/deployments/bootstrap.yaml index c7c66041ea0..73e86a058ab 100644 --- a/internal/infrastructure/kubernetes/proxy/testdata/deployments/bootstrap.yaml +++ b/internal/infrastructure/kubernetes/proxy/testdata/deployments/bootstrap.yaml @@ -63,6 +63,10 @@ spec: requests: cpu: 100m memory: 512Mi + readinessProbe: + httpGet: + path: /ready + port: 19001 terminationMessagePath: /dev/termination-log terminationMessagePolicy: File volumeMounts: diff --git a/internal/infrastructure/kubernetes/proxy/testdata/deployments/component-level.yaml b/internal/infrastructure/kubernetes/proxy/testdata/deployments/component-level.yaml index c08f96fd560..b5a5d5cd482 100644 --- a/internal/infrastructure/kubernetes/proxy/testdata/deployments/component-level.yaml +++ b/internal/infrastructure/kubernetes/proxy/testdata/deployments/component-level.yaml @@ -64,6 +64,10 @@ spec: requests: cpu: 100m memory: 512Mi + readinessProbe: + httpGet: + path: /ready + port: 19001 terminationMessagePath: /dev/termination-log terminationMessagePolicy: File volumeMounts: diff --git a/internal/infrastructure/kubernetes/proxy/testdata/deployments/custom.yaml b/internal/infrastructure/kubernetes/proxy/testdata/deployments/custom.yaml index be59fee9f35..f9fa2b7fb7d 100644 --- a/internal/infrastructure/kubernetes/proxy/testdata/deployments/custom.yaml +++ b/internal/infrastructure/kubernetes/proxy/testdata/deployments/custom.yaml @@ -62,6 +62,33 @@ spec: ads: {} resource_api_version: V3 static_resources: + listeners: + - name: envoy-gateway-proxy-ready-0.0.0.0-19001 + address: + socket_address: + address: 0.0.0.0 + port_value: 19001 + protocol: TCP + filter_chains: + - filters: + - name: envoy.filters.network.http_connection_manager + typed_config: + "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager + stat_prefix: eg-ready-http + route_config: + name: local_route + http_filters: + - name: envoy.filters.http.health_check + typed_config: + "@type": type.googleapis.com/envoy.extensions.filters.http.health_check.v3.HealthCheck + pass_through_mode: false + headers: + - name: ":path" + string_match: + exact: /ready + - name: envoy.filters.http.router + typed_config: + "@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router clusters: - connect_timeout: 10s load_assignment: @@ -138,6 +165,10 @@ spec: requests: cpu: 200m memory: 1Gi + readinessProbe: + httpGet: + path: /ready + port: 19001 terminationMessagePath: /dev/termination-log terminationMessagePolicy: File securityContext: diff --git a/internal/infrastructure/kubernetes/proxy/testdata/deployments/default-env.yaml b/internal/infrastructure/kubernetes/proxy/testdata/deployments/default-env.yaml index be59fee9f35..f9fa2b7fb7d 100644 --- a/internal/infrastructure/kubernetes/proxy/testdata/deployments/default-env.yaml +++ b/internal/infrastructure/kubernetes/proxy/testdata/deployments/default-env.yaml @@ -62,6 +62,33 @@ spec: ads: {} resource_api_version: V3 static_resources: + listeners: + - name: envoy-gateway-proxy-ready-0.0.0.0-19001 + address: + socket_address: + address: 0.0.0.0 + port_value: 19001 + protocol: TCP + filter_chains: + - filters: + - name: envoy.filters.network.http_connection_manager + typed_config: + "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager + stat_prefix: eg-ready-http + route_config: + name: local_route + http_filters: + - name: envoy.filters.http.health_check + typed_config: + "@type": type.googleapis.com/envoy.extensions.filters.http.health_check.v3.HealthCheck + pass_through_mode: false + headers: + - name: ":path" + string_match: + exact: /ready + - name: envoy.filters.http.router + typed_config: + "@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router clusters: - connect_timeout: 10s load_assignment: @@ -138,6 +165,10 @@ spec: requests: cpu: 200m memory: 1Gi + readinessProbe: + httpGet: + path: /ready + port: 19001 terminationMessagePath: /dev/termination-log terminationMessagePolicy: File securityContext: diff --git a/internal/infrastructure/kubernetes/proxy/testdata/deployments/default.yaml b/internal/infrastructure/kubernetes/proxy/testdata/deployments/default.yaml index ac943e9d3a8..f9ece0c355e 100644 --- a/internal/infrastructure/kubernetes/proxy/testdata/deployments/default.yaml +++ b/internal/infrastructure/kubernetes/proxy/testdata/deployments/default.yaml @@ -60,6 +60,33 @@ spec: ads: {} resource_api_version: V3 static_resources: + listeners: + - name: envoy-gateway-proxy-ready-0.0.0.0-19001 + address: + socket_address: + address: 0.0.0.0 + port_value: 19001 + protocol: TCP + filter_chains: + - filters: + - name: envoy.filters.network.http_connection_manager + typed_config: + "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager + stat_prefix: eg-ready-http + route_config: + name: local_route + http_filters: + - name: envoy.filters.http.health_check + typed_config: + "@type": type.googleapis.com/envoy.extensions.filters.http.health_check.v3.HealthCheck + pass_through_mode: false + headers: + - name: ":path" + string_match: + exact: /ready + - name: envoy.filters.http.router + typed_config: + "@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router clusters: - connect_timeout: 10s load_assignment: @@ -133,6 +160,10 @@ spec: requests: cpu: 100m memory: 512Mi + readinessProbe: + httpGet: + path: /ready + port: 19001 terminationMessagePath: /dev/termination-log terminationMessagePolicy: File volumeMounts: diff --git a/internal/infrastructure/kubernetes/proxy/testdata/deployments/extension-env.yaml b/internal/infrastructure/kubernetes/proxy/testdata/deployments/extension-env.yaml index e5f6c3a5165..c74059582b9 100644 --- a/internal/infrastructure/kubernetes/proxy/testdata/deployments/extension-env.yaml +++ b/internal/infrastructure/kubernetes/proxy/testdata/deployments/extension-env.yaml @@ -62,6 +62,33 @@ spec: ads: {} resource_api_version: V3 static_resources: + listeners: + - name: envoy-gateway-proxy-ready-0.0.0.0-19001 + address: + socket_address: + address: 0.0.0.0 + port_value: 19001 + protocol: TCP + filter_chains: + - filters: + - name: envoy.filters.network.http_connection_manager + typed_config: + "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager + stat_prefix: eg-ready-http + route_config: + name: local_route + http_filters: + - name: envoy.filters.http.health_check + typed_config: + "@type": type.googleapis.com/envoy.extensions.filters.http.health_check.v3.HealthCheck + pass_through_mode: false + headers: + - name: ":path" + string_match: + exact: /ready + - name: envoy.filters.http.router + typed_config: + "@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router clusters: - connect_timeout: 10s load_assignment: @@ -142,6 +169,10 @@ spec: requests: cpu: 200m memory: 1Gi + readinessProbe: + httpGet: + path: /ready + port: 19001 terminationMessagePath: /dev/termination-log terminationMessagePolicy: File securityContext: diff --git a/internal/infrastructure/kubernetes/proxy/testdata/deployments/volumes.yaml b/internal/infrastructure/kubernetes/proxy/testdata/deployments/volumes.yaml index a8d7a68922d..56ec3c19b0f 100644 --- a/internal/infrastructure/kubernetes/proxy/testdata/deployments/volumes.yaml +++ b/internal/infrastructure/kubernetes/proxy/testdata/deployments/volumes.yaml @@ -62,6 +62,33 @@ spec: ads: {} resource_api_version: V3 static_resources: + listeners: + - name: envoy-gateway-proxy-ready-0.0.0.0-19001 + address: + socket_address: + address: 0.0.0.0 + port_value: 19001 + protocol: TCP + filter_chains: + - filters: + - name: envoy.filters.network.http_connection_manager + typed_config: + "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager + stat_prefix: eg-ready-http + route_config: + name: local_route + http_filters: + - name: envoy.filters.http.health_check + typed_config: + "@type": type.googleapis.com/envoy.extensions.filters.http.health_check.v3.HealthCheck + pass_through_mode: false + headers: + - name: ":path" + string_match: + exact: /ready + - name: envoy.filters.http.router + typed_config: + "@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router clusters: - connect_timeout: 10s load_assignment: @@ -142,6 +169,10 @@ spec: requests: cpu: 200m memory: 1Gi + readinessProbe: + httpGet: + path: /ready + port: 19001 terminationMessagePath: /dev/termination-log terminationMessagePolicy: File securityContext: diff --git a/internal/xds/bootstrap/bootstrap.go b/internal/xds/bootstrap/bootstrap.go index 4823d3fec2b..6a7da391c35 100644 --- a/internal/xds/bootstrap/bootstrap.go +++ b/internal/xds/bootstrap/bootstrap.go @@ -28,6 +28,10 @@ const ( // DefaultXdsServerPort is the default listening port of the xds-server. DefaultXdsServerPort = 18000 + + envoyReadinessAddress = "0.0.0.0" + EnvoyReadinessPort = 19001 + EnvoyReadinessPath = "/ready" ) //go:embed bootstrap.yaml.tpl @@ -49,6 +53,8 @@ type bootstrapParameters struct { XdsServer xdsServerParameters // AdminServer defines the configuration of the Envoy admin interface. AdminServer adminServerParameters + // ReadyServer defines the configuration for health check ready listener + ReadyServer readyServerParameters } type xdsServerParameters struct { @@ -67,6 +73,15 @@ type adminServerParameters struct { AccessLogPath string } +type readyServerParameters struct { + // Address is the address of the Envoy readiness probe + Address string + // Port is the port of envoy readiness probe + Port int32 + // ReadinessPath is the path for the envoy readiness probe + ReadinessPath string +} + // render the stringified bootstrap config in yaml format. func (b *bootstrapConfig) render() error { buf := new(strings.Builder) @@ -92,6 +107,11 @@ func GetRenderedBootstrapConfig() (string, error) { Port: envoyAdminPort, AccessLogPath: envoyAdminAccessLogPath, }, + ReadyServer: readyServerParameters{ + Address: envoyReadinessAddress, + Port: EnvoyReadinessPort, + ReadinessPath: EnvoyReadinessPath, + }, }, } diff --git a/internal/xds/bootstrap/bootstrap.yaml.tpl b/internal/xds/bootstrap/bootstrap.yaml.tpl index 4366e3f9fcc..d89f156eb6a 100644 --- a/internal/xds/bootstrap/bootstrap.yaml.tpl +++ b/internal/xds/bootstrap/bootstrap.yaml.tpl @@ -23,6 +23,33 @@ dynamic_resources: ads: {} resource_api_version: V3 static_resources: + listeners: + - name: envoy-gateway-proxy-ready-{{ .ReadyServer.Address }}-{{ .ReadyServer.Port }} + address: + socket_address: + address: {{ .ReadyServer.Address }} + port_value: {{ .ReadyServer.Port }} + protocol: TCP + filter_chains: + - filters: + - name: envoy.filters.network.http_connection_manager + typed_config: + "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager + stat_prefix: eg-ready-http + route_config: + name: local_route + http_filters: + - name: envoy.filters.http.health_check + typed_config: + "@type": type.googleapis.com/envoy.extensions.filters.http.health_check.v3.HealthCheck + pass_through_mode: false + headers: + - name: ":path" + string_match: + exact: {{ .ReadyServer.ReadinessPath }} + - name: envoy.filters.http.router + typed_config: + "@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router clusters: - connect_timeout: 10s load_assignment: From a551d8f3c3e100773ac4a9e3e994d6c0a42c2e0f Mon Sep 17 00:00:00 2001 From: Xunzhuo Date: Mon, 26 Jun 2023 15:38:42 +0800 Subject: [PATCH 05/16] chore: fix ci publish order (#1584) fix: publish order Signed-off-by: bitliu --- .github/workflows/build_and_test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_and_test.yaml b/.github/workflows/build_and_test.yaml index e35093912c5..7669b5ff075 100644 --- a/.github/workflows/build_and_test.yaml +++ b/.github/workflows/build_and_test.yaml @@ -129,7 +129,7 @@ jobs: publish: runs-on: ubuntu-latest - needs: [conformance-test] + needs: [conformance-test, e2e-test] steps: - uses: actions/checkout@v3 - uses: ./tools/github-actions/setup-deps From 5554b8c4721e0a905ce8123bb21f26fb48aa0e30 Mon Sep 17 00:00:00 2001 From: zirain Date: Mon, 26 Jun 2023 16:21:40 +0800 Subject: [PATCH 06/16] e2e: fix OpenTelemetryAccessLog flaky (#1585) Signed-off-by: hejianpeng --- test/e2e/tests/accesslog.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/e2e/tests/accesslog.go b/test/e2e/tests/accesslog.go index 13e6ade35e3..4e51cd48b25 100644 --- a/test/e2e/tests/accesslog.go +++ b/test/e2e/tests/accesslog.go @@ -141,6 +141,17 @@ var OpenTelemetryTest = suite.ConformanceTest{ gwNN := types.NamespacedName{Name: "same-namespace", Namespace: ns} gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), routeNN) + // make sure listener is ready + httputils.MakeRequestAndExpectEventuallyConsistentResponse(t, suite.RoundTripper, suite.TimeoutConfig, gwAddr, httputils.ExpectedResponse{ + Request: httputils.Request{ + Path: "/", + }, + Response: httputils.Response{ + StatusCode: 200, + }, + Namespace: ns, + }) + labels := map[string]string{ "k8s_namespace_name": "envoy-gateway-system", "exporter": "OTLP", From 09210be7cf27b0f02ac8b75aeb743bac7aa6ca8b Mon Sep 17 00:00:00 2001 From: tmsnan Date: Mon, 26 Jun 2023 16:32:56 +0800 Subject: [PATCH 07/16] chore: fix gateway cm garbled characters (#1588) Signed-off-by: zhaonan Co-authored-by: Xunzhuo --- charts/gateway-helm/templates/envoy-gateway-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/gateway-helm/templates/envoy-gateway-config.yaml b/charts/gateway-helm/templates/envoy-gateway-config.yaml index 999b09c84a5..343b4170a39 100644 --- a/charts/gateway-helm/templates/envoy-gateway-config.yaml +++ b/charts/gateway-helm/templates/envoy-gateway-config.yaml @@ -15,5 +15,5 @@ data: provider: type: {{ .Values.config.envoyGateway.provider.type | quote }} logging: - level: + level: default: info From 9b02e83aa49be28c0fbde449bbcfe3f786565294 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Jun 2023 16:33:25 +0800 Subject: [PATCH 08/16] build(deps): bump google.golang.org/grpc from 1.56.0 to 1.56.1 (#1586) Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.56.0 to 1.56.1. - [Release notes](https://github.com/grpc/grpc-go/releases) - [Commits](https://github.com/grpc/grpc-go/compare/v1.56.0...v1.56.1) --- updated-dependencies: - dependency-name: google.golang.org/grpc dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Xunzhuo --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 9733728d054..555058ca9f3 100644 --- a/go.mod +++ b/go.mod @@ -21,7 +21,7 @@ require ( go.opentelemetry.io/proto/otlp v0.20.0 go.uber.org/zap v1.24.0 golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e - google.golang.org/grpc v1.56.0 + google.golang.org/grpc v1.56.1 google.golang.org/protobuf v1.30.0 gopkg.in/yaml.v3 v3.0.1 k8s.io/api v0.27.3 diff --git a/go.sum b/go.sum index 409dade2749..de98a58563a 100644 --- a/go.sum +++ b/go.sum @@ -311,8 +311,8 @@ google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZi google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.56.0 h1:+y7Bs8rtMd07LeXmL3NxcTLn7mUkbKZqEpPhMNkwJEE= -google.golang.org/grpc v1.56.0/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= +google.golang.org/grpc v1.56.1 h1:z0dNfjIl0VpaZ9iSVjA6daGatAYwPGstTjt5vkRMFkQ= +google.golang.org/grpc v1.56.1/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= From 374bbd55658e7cee26914afe3c8c902fd44bd489 Mon Sep 17 00:00:00 2001 From: qi Date: Mon, 26 Jun 2023 16:34:56 +0800 Subject: [PATCH 09/16] fix: fixes update k8s resource bug. (#1542) * fix: fixes update k8s resource bug. Signed-off-by: qicz * using errors.wrap Signed-off-by: qicz --------- Signed-off-by: qicz Co-authored-by: Xunzhuo --- .../infrastructure/kubernetes/infra_client.go | 35 ++++++++++--------- internal/status/status.go | 2 +- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/internal/infrastructure/kubernetes/infra_client.go b/internal/infrastructure/kubernetes/infra_client.go index 76425f1ce88..3c77fc34b8b 100644 --- a/internal/infrastructure/kubernetes/infra_client.go +++ b/internal/infrastructure/kubernetes/infra_client.go @@ -8,7 +8,9 @@ package kubernetes import ( "context" + "github.com/pkg/errors" kerrors "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/client-go/util/retry" "sigs.k8s.io/controller-runtime/pkg/client" ) @@ -23,26 +25,27 @@ func New(cli client.Client) *InfraClient { } func (cli *InfraClient) CreateOrUpdate(ctx context.Context, key client.ObjectKey, current client.Object, specific client.Object, updateChecker func() bool) error { - if err := cli.Client.Get(ctx, key, current); err != nil { - if kerrors.IsNotFound(err) { - // Create if it does not exist. - if err := cli.Client.Create(ctx, specific); err != nil { - return err + return retry.RetryOnConflict(retry.DefaultBackoff, func() error { + if err := cli.Client.Get(ctx, key, current); err != nil { + if kerrors.IsNotFound(err) { + // Create if it does not exist. + if err := cli.Client.Create(ctx, specific); err != nil { + return errors.Wrap(err, "for Create") + } } - } - } else { - // Since the client.Object does not have a specific Spec field to compare - // just perform an update for now. - if updateChecker() { - specific.SetResourceVersion(current.GetResourceVersion()) - specific.SetUID(current.GetUID()) - if err := cli.Client.Update(ctx, specific); err != nil { - return err + } else { + // Since the client.Object does not have a specific Spec field to compare + // just perform an update for now. + if updateChecker() { + specific.SetUID(current.GetUID()) + if err := cli.Client.Update(ctx, specific); err != nil { + return errors.Wrap(err, "for Update") + } } } - } - return nil + return nil + }) } func (cli *InfraClient) Delete(ctx context.Context, object client.Object) error { diff --git a/internal/status/status.go b/internal/status/status.go index 9f7aae30c6f..904a4eed21c 100644 --- a/internal/status/status.go +++ b/internal/status/status.go @@ -91,8 +91,8 @@ func (u *UpdateHandler) apply(update Update) { return nil } - newObj.SetResourceVersion(obj.GetResourceVersion()) newObj.SetUID(obj.GetUID()) + return u.client.Status().Update(context.Background(), newObj) }); err != nil { u.log.Error(err, "unable to update status", "name", update.NamespacedName.Name, From 4d20828ee7db6e47563ca6c64e277d5c7b2a1104 Mon Sep 17 00:00:00 2001 From: Xunzhuo Date: Mon, 26 Jun 2023 22:46:30 +0800 Subject: [PATCH 10/16] fix: incorrect comma in translate testdata (#1591) --- .../testdata/translate/out/from-gateway-api-to-xds.all.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/cmd/egctl/testdata/translate/out/from-gateway-api-to-xds.all.json b/internal/cmd/egctl/testdata/translate/out/from-gateway-api-to-xds.all.json index 726ecdd8a6e..46e567087e9 100644 --- a/internal/cmd/egctl/testdata/translate/out/from-gateway-api-to-xds.all.json +++ b/internal/cmd/egctl/testdata/translate/out/from-gateway-api-to-xds.all.json @@ -65,7 +65,7 @@ "address": { "socketAddress": { "address": "0.0.0.0", - "portValue": 19001, + "portValue": 19001 } }, "filterChains": [ From 4e6786a5dc9103fc155ad24b340ba43bc5fdb537 Mon Sep 17 00:00:00 2001 From: zirain Date: Tue, 27 Jun 2023 04:14:13 +0800 Subject: [PATCH 11/16] provider: fix store race (#1589) * add race test Signed-off-by: hejianpeng * fix race Signed-off-by: hejianpeng --- internal/provider/kubernetes/store.go | 9 +++++++++ internal/provider/kubernetes/store_test.go | 15 +++++++++++++++ tools/make/golang.mk | 2 +- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/internal/provider/kubernetes/store.go b/internal/provider/kubernetes/store.go index fd60ff1c79e..eeb63a1da4c 100644 --- a/internal/provider/kubernetes/store.go +++ b/internal/provider/kubernetes/store.go @@ -6,6 +6,8 @@ package kubernetes import ( + "sync" + corev1 "k8s.io/api/core/v1" ) @@ -20,6 +22,7 @@ type kubernetesProviderStore struct { // addresses, in case the Gateway is exposed on every Node of the cluster, using // Service of type NodePort. nodes map[string]nodeDetails + mu sync.Mutex } func newProviderStore() *kubernetesProviderStore { @@ -49,15 +52,21 @@ func (p *kubernetesProviderStore) addNode(n *corev1.Node) { } else if internalIP != "" { details.address = internalIP } + p.mu.Lock() + defer p.mu.Unlock() p.nodes[n.Name] = details } func (p *kubernetesProviderStore) removeNode(n *corev1.Node) { + p.mu.Lock() + defer p.mu.Unlock() delete(p.nodes, n.Name) } func (p *kubernetesProviderStore) listNodeAddresses() []string { addrs := []string{} + p.mu.Lock() + defer p.mu.Unlock() for _, n := range p.nodes { if n.address != "" { addrs = append(addrs, n.address) diff --git a/internal/provider/kubernetes/store_test.go b/internal/provider/kubernetes/store_test.go index ef461bf714b..d2082100083 100644 --- a/internal/provider/kubernetes/store_test.go +++ b/internal/provider/kubernetes/store_test.go @@ -77,3 +77,18 @@ func TestNodeDetailsAddressStore(t *testing.T) { }) } } + +func TestRace(t *testing.T) { + s := newProviderStore() + + go func() { + for { + s.addNode(&corev1.Node{ + ObjectMeta: v1.ObjectMeta{Name: "node1"}, + Status: corev1.NodeStatus{Addresses: []corev1.NodeAddress{{}}}, + }) + } + }() + + _ = s.listNodeAddresses() +} diff --git a/tools/make/golang.mk b/tools/make/golang.mk index 82d5d9c43f8..c5d5f8ac21e 100644 --- a/tools/make/golang.mk +++ b/tools/make/golang.mk @@ -42,7 +42,7 @@ go.build.multiarch: $(foreach p,$(PLATFORMS),$(addprefix go.build., $(addprefix .PHONY: go.test.unit go.test.unit: ## Run go unit tests - go test ./... + go test -race ./... .PHONY: go.testdata.complete go.testdata.complete: ## Override test ouputdata From 155f75fe4278ead0ddd18153c41d315544efd55c Mon Sep 17 00:00:00 2001 From: Karol Szwaj Date: Tue, 27 Jun 2023 02:44:59 +0200 Subject: [PATCH 12/16] ratelimit: Change rate limit service type to cluster (#1578) * Allow other service types in the rate limit service Signed-off-by: Karol Szwaj * make gen-check Signed-off-by: Karol Szwaj * Revert "make gen-check" This reverts commit 55538c44a22f7f7ef81a2c06df0c57fb55a6bc05. Signed-off-by: Karol Szwaj * Change default service type to Cluster Signed-off-by: Karol Szwaj * restore default func Signed-off-by: Karol Szwaj * update test Signed-off-by: Karol Szwaj --------- Signed-off-by: Karol Szwaj --- .../infrastructure/kubernetes/ratelimit/resource_provider.go | 2 +- .../kubernetes/ratelimit/testdata/envoy-ratelimit-service.yaml | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/internal/infrastructure/kubernetes/ratelimit/resource_provider.go b/internal/infrastructure/kubernetes/ratelimit/resource_provider.go index 4b9d29a3dfd..83363c22bef 100644 --- a/internal/infrastructure/kubernetes/ratelimit/resource_provider.go +++ b/internal/infrastructure/kubernetes/ratelimit/resource_provider.go @@ -55,7 +55,7 @@ func (r *ResourceRender) Service() (*corev1.Service, error) { labels := rateLimitLabels() - serviceSpec := resource.ExpectedServiceSpec(egcfgv1a1.DefaultKubernetesServiceType()) + serviceSpec := resource.ExpectedServiceSpec(egcfgv1a1.GetKubernetesServiceType(egcfgv1a1.ServiceTypeClusterIP)) serviceSpec.Ports = ports serviceSpec.Selector = resource.GetSelector(labels).MatchLabels diff --git a/internal/infrastructure/kubernetes/ratelimit/testdata/envoy-ratelimit-service.yaml b/internal/infrastructure/kubernetes/ratelimit/testdata/envoy-ratelimit-service.yaml index 7e4caa5323b..16ea8f61b2b 100644 --- a/internal/infrastructure/kubernetes/ratelimit/testdata/envoy-ratelimit-service.yaml +++ b/internal/infrastructure/kubernetes/ratelimit/testdata/envoy-ratelimit-service.yaml @@ -8,9 +8,8 @@ metadata: name: envoy-ratelimit namespace: envoy-gateway-system spec: - type: LoadBalancer + type: ClusterIP sessionAffinity: None - ExternalTrafficPolicy: Local ports: - name: http port: 8081 From 278e02fe486760c4f77bef5413a750fc890a34bf Mon Sep 17 00:00:00 2001 From: tmsnan Date: Tue, 27 Jun 2023 08:50:19 +0800 Subject: [PATCH 13/16] linter: Check for trailing spaces at the end of lines in yaml (#1595) Signed-off-by: zhaonan --- .github/workflows/build_and_test.yaml | 10 +++++----- .github/workflows/docs.yaml | 2 +- .github/workflows/latest_release.yaml | 6 +++--- .github/workflows/release.yaml | 2 +- .github/workflows/retest.yaml | 4 ++-- examples/kubernetes/grpc-routing.yaml | 6 +++--- examples/loki/loki.yaml | 2 +- examples/otel-collector/helm-values.yaml | 2 +- .../egctl/testdata/translate/in/default-resources.yaml | 2 +- .../testdata/translate/in/invalid-envoyproxy.yaml | 4 ++-- .../egctl/testdata/translate/in/valid-envoyproxy.yaml | 6 +++--- ...proute-with-extension-filter-invalid-group.out.yaml | 4 ++-- ...tproute-with-non-matching-extension-filter.out.yaml | 4 ++-- ...ttproute-with-unsupported-extension-filter.out.yaml | 4 ++-- .../httproute-with-valid-extension-filter.out.yaml | 2 +- ...s-same-namespace-with-disallowed-httproute.out.yaml | 6 +++--- ...ner-with-invalid-multiple-tls-configuration.in.yaml | 2 +- ...h-http-and-tlsroute-same-hostname-and-port.out.yaml | 10 +++++----- ...ith-two-listeners-with-multiple-httproutes.out.yaml | 4 ++-- ...-two-listeners-with-same-port-and-hostname.out.yaml | 8 ++++---- ...listeners-with-same-port-http-udp-protocol.out.yaml | 2 +- .../testdata/grpcroute-with-header-match.in.yaml | 6 +++--- .../testdata/grpcroute-with-header-match.out.yaml | 8 ++++---- .../grpcroute-with-request-header-modifier.in.yaml | 6 +++--- .../grpcroute-with-request-header-modifier.out.yaml | 8 ++++---- .../testdata/httproute-with-empty-matches.out.yaml | 2 +- ...ader-filter-duplicate-add-multiple-filters.out.yaml | 2 +- ...httproute-with-header-filter-duplicate-adds.in.yaml | 2 +- ...ttproute-with-header-filter-duplicate-adds.out.yaml | 4 ++-- ...r-filter-duplicate-remove-multiple-filters.out.yaml | 2 +- ...route-with-header-filter-duplicate-removes.out.yaml | 2 +- ...oute-with-header-filter-empty-header-values.in.yaml | 2 +- ...ute-with-header-filter-empty-header-values.out.yaml | 4 ++-- .../httproute-with-header-filter-empty-headers.in.yaml | 2 +- ...httproute-with-header-filter-empty-headers.out.yaml | 6 +++--- ...ttproute-with-header-filter-invalid-headers.in.yaml | 2 +- ...tproute-with-header-filter-invalid-headers.out.yaml | 6 +++--- .../httproute-with-header-filter-no-headers.out.yaml | 2 +- ...proute-with-header-filter-no-valid-headers.out.yaml | 4 ++-- .../httproute-with-header-filter-remove.out.yaml | 2 +- ...ttproute-with-invalid-backend-ref-bad-port.out.yaml | 4 ++-- ...ute-with-invalid-backend-ref-invalid-group.out.yaml | 4 ++-- ...oute-with-invalid-backend-ref-invalid-kind.out.yaml | 4 ++-- ...httproute-with-invalid-backend-ref-no-port.out.yaml | 4 ++-- ...proute-with-invalid-backend-ref-no-service.out.yaml | 4 ++-- .../httproute-with-invalid-ratelimitfilter.out.yaml | 4 ++-- ...ttproute-with-non-existent-authenfilter-ref.in.yaml | 2 +- ...tproute-with-non-existent-authenfilter-ref.out.yaml | 4 ++-- ...ttproute-with-non-matching-authenfilter-ref.in.yaml | 2 +- ...tproute-with-non-matching-authenfilter-ref.out.yaml | 4 ++-- ...ttaching-to-gateway-with-wildcard-hostname.out.yaml | 2 +- ...th-redirect-filter-full-path-replace-https.out.yaml | 2 +- .../httproute-with-redirect-filter-hostname.out.yaml | 2 +- ...e-with-redirect-filter-invalid-filter-type.out.yaml | 4 ++-- ...proute-with-redirect-filter-invalid-scheme.out.yaml | 4 ++-- ...proute-with-redirect-filter-invalid-status.out.yaml | 4 ++-- ...irect-filter-prefix-replace-with-port-http.out.yaml | 2 +- .../httproute-with-response-header-filter-adds.in.yaml | 2 +- ...httproute-with-response-header-filter-adds.out.yaml | 4 ++-- ...ader-filter-duplicate-add-multiple-filters.out.yaml | 2 +- ...-with-response-header-filter-duplicate-adds.in.yaml | 2 +- ...with-response-header-filter-duplicate-adds.out.yaml | 4 ++-- ...r-filter-duplicate-remove-multiple-filters.out.yaml | 2 +- ...h-response-header-filter-duplicate-removes.out.yaml | 2 +- ...-response-header-filter-empty-header-values.in.yaml | 2 +- ...response-header-filter-empty-header-values.out.yaml | 4 ++-- ...e-with-response-header-filter-empty-headers.in.yaml | 2 +- ...-with-response-header-filter-empty-headers.out.yaml | 6 +++--- ...with-response-header-filter-invalid-headers.in.yaml | 2 +- ...ith-response-header-filter-invalid-headers.out.yaml | 6 +++--- ...ute-with-response-header-filter-no-headers.out.yaml | 2 +- ...th-response-header-filter-no-valid-headers.out.yaml | 4 ++-- ...tproute-with-response-header-filter-remove.out.yaml | 2 +- ...-with-some-invalid-backend-refs-no-service.out.yaml | 4 ++-- .../testdata/httproute-with-sourceip-ratelimit.in.yaml | 2 +- .../httproute-with-sourceip-ratelimit.out.yaml | 2 +- ...with-urlrewrite-filter-invalid-filter-type.out.yaml | 2 +- ...te-with-urlrewrite-filter-invalid-hostname.out.yaml | 2 +- ...urlrewrite-filter-invalid-multiple-filters.out.yaml | 2 +- ...e-with-urlrewrite-filter-invalid-path-type.out.yaml | 2 +- ...proute-with-urlrewrite-filter-invalid-path.out.yaml | 2 +- ...proute-with-urlrewrite-filter-missing-path.out.yaml | 2 +- .../testdata/httproutes-with-multiple-matches.out.yaml | 2 +- .../gatewayapi/testdata/tlsroute-multiple.out.yaml | 4 ++-- .../testdata/in/extension-xds-ir/http-route.yaml | 4 ++-- .../testdata/in/ratelimit-config/distinct-match.yaml | 2 +- .../distinct-remote-address-match.yaml | 2 +- .../in/ratelimit-config/empty-header-matches.yaml | 2 +- .../ratelimit-config/masked-remote-address-match.yaml | 2 +- .../testdata/in/ratelimit-config/multiple-matches.yaml | 4 ++-- .../testdata/in/ratelimit-config/multiple-routes.yaml | 2 +- .../testdata/in/ratelimit-config/multiple-rules.yaml | 6 +++--- .../testdata/in/ratelimit-config/value-match.yaml | 2 +- .../xds/translator/testdata/in/xds-ir/accesslog.yaml | 2 +- .../testdata/in/xds-ir/http-route-direct-response.yaml | 2 +- .../testdata/in/xds-ir/http-route-mirror.yaml | 2 +- .../testdata/in/xds-ir/http-route-redirect.yaml | 2 +- .../testdata/in/xds-ir/http-route-request-headers.yaml | 2 +- .../in/xds-ir/http-route-response-add-headers.yaml | 2 +- .../xds-ir/http-route-response-add-remove-headers.yaml | 2 +- .../in/xds-ir/http-route-response-remove-headers.yaml | 2 +- .../in/xds-ir/http-route-rewrite-url-fullpath.yaml | 2 +- .../in/xds-ir/http-route-rewrite-url-host.yaml | 2 +- .../in/xds-ir/http-route-weighted-backend.yaml | 2 +- .../in/xds-ir/http-route-weighted-invalid-backend.yaml | 4 ++-- .../xds/translator/testdata/in/xds-ir/http-route.yaml | 4 ++-- .../xds/translator/testdata/in/xds-ir/http2-route.yaml | 2 +- .../in/xds-ir/multiple-listeners-same-port.yaml | 8 ++++---- .../testdata/in/xds-ir/ratelimit-custom-domain.yaml | 4 ++-- .../testdata/in/xds-ir/ratelimit-sourceip.yaml | 4 ++-- .../xds/translator/testdata/in/xds-ir/ratelimit.yaml | 4 ++-- .../xds/translator/testdata/in/xds-ir/simple-tls.yaml | 4 ++-- release-notes/v0.3.0-rc.1.yaml | 10 +++++----- release-notes/v0.3.0.yaml | 6 +++--- release-notes/v0.4.0.yaml | 2 +- tools/linter/yamllint/.yamllint | 2 +- 116 files changed, 198 insertions(+), 198 deletions(-) diff --git a/.github/workflows/build_and_test.yaml b/.github/workflows/build_and_test.yaml index 7669b5ff075..71b2e49938c 100644 --- a/.github/workflows/build_and_test.yaml +++ b/.github/workflows/build_and_test.yaml @@ -86,19 +86,19 @@ jobs: with: name: envoy-gateway path: bin/ - + - name: Give Privileges To EG Binaries run: | chmod +x bin/linux/amd64/envoy-gateway chmod +x bin/linux/arm64/envoy-gateway # conformance - - name: Run Conformance Tests + - name: Run Conformance Tests env: KIND_NODE_TAG: ${{ matrix.version }} IMAGE_PULL_POLICY: IfNotPresent run: make conformance - + e2e-test: runs-on: ubuntu-latest needs: [build] @@ -114,14 +114,14 @@ jobs: with: name: envoy-gateway path: bin/ - + - name: Give Privileges To EG Binaries run: | chmod +x bin/linux/amd64/envoy-gateway chmod +x bin/linux/arm64/envoy-gateway # E2E - - name: Run E2E Tests + - name: Run E2E Tests env: KIND_NODE_TAG: ${{ matrix.version }} IMAGE_PULL_POLICY: IfNotPresent diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index 90f3bfa6041..46b987e969e 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -34,7 +34,7 @@ jobs: - name: Generate EG Pages run: make docs - # Upload docs for GitHub Pages + # Upload docs for GitHub Pages - name: Upload GitHub Pages artifact uses: actions/upload-pages-artifact@v1.0.9 with: diff --git a/.github/workflows/latest_release.yaml b/.github/workflows/latest_release.yaml index cefd48e7632..bff1d402c46 100644 --- a/.github/workflows/latest_release.yaml +++ b/.github/workflows/latest_release.yaml @@ -17,7 +17,7 @@ jobs: run: make generate-manifests IMAGE=envoyproxy/gateway-dev TAG=latest OUTPUT_DIR=release-artifacts - name: Build egctl latest multiarch binaries - run: | + run: | make build-multiarch BINS="egctl" tar -zcvf egctl_latest_linux_amd64.tar.gz bin/linux/amd64/ tar -zcvf egctl_latest_linux_arm64.tar.gz bin/linux/arm64/ @@ -63,7 +63,7 @@ jobs: egctl_latest_darwin_arm64.tar.gz body: | This is the "latest" release of **Envoy Gateway**, which contains the most recent commits from the main branch. - + This release **might not be stable**. It is only intended for developers wishing to try out the latest features in Envoy Gateway, some of which may not be fully implemented. @@ -75,7 +75,7 @@ jobs: ``` # Check if latest release and tag are created properly, - # if not, the workflow needs to report an error, + # if not, the workflow needs to report an error, # let maintainers be aware of it and rerun it manually. # After Recreate the Latest Release and Tag, we need to sleep some time to wait # new tag and release are created before checking it. diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index ec218df6205..24d26f1e6c3 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -3,7 +3,7 @@ name: Release on: push: # Sequence of patterns matched against refs/tags - tags: + tags: - "v*.*.*" jobs: release: diff --git a/.github/workflows/retest.yaml b/.github/workflows/retest.yaml index 71f9b5e5a19..90c604cdc1c 100644 --- a/.github/workflows/retest.yaml +++ b/.github/workflows/retest.yaml @@ -21,10 +21,10 @@ jobs: console.log(`Comment: ${comment}`); console.log(`Contains Trigger: ${containsTrigger}`); return containsTrigger; - + - name: Install @octokit/core run: npm install @octokit/core@^3 - + - name: Rerun Action if: steps.check_comment.outputs.result == 'true' uses: actions/github-script@v6 diff --git a/examples/kubernetes/grpc-routing.yaml b/examples/kubernetes/grpc-routing.yaml index 388dc09aa4f..c1e922d11a1 100644 --- a/examples/kubernetes/grpc-routing.yaml +++ b/examples/kubernetes/grpc-routing.yaml @@ -66,16 +66,16 @@ kind: GRPCRoute metadata: name: yages labels: - example: grpc-routing + example: grpc-routing spec: parentRefs: - - name: example-gateway + - name: example-gateway hostnames: - "grpc-example.com" rules: - backendRefs: - group: "" kind: Service - name: yages + name: yages port: 9000 weight: 1 diff --git a/examples/loki/loki.yaml b/examples/loki/loki.yaml index 6cffb095f55..3f15a75b45e 100644 --- a/examples/loki/loki.yaml +++ b/examples/loki/loki.yaml @@ -84,7 +84,7 @@ metadata: app.kubernetes.io/managed-by: Helm data: runtime-config.yaml: | - + {} --- # Source: loki/templates/service-memberlist.yaml diff --git a/examples/otel-collector/helm-values.yaml b/examples/otel-collector/helm-values.yaml index a17d7ed5503..b01294253a3 100644 --- a/examples/otel-collector/helm-values.yaml +++ b/examples/otel-collector/helm-values.yaml @@ -17,7 +17,7 @@ config: key: loki.attribute.labels # k8s.pod.name is OpenTelemetry format for Kubernetes Pod name, # Loki will convert this to k8s_pod_name label. - value: k8s.pod.name, k8s.namespace.name + value: k8s.pod.name, k8s.namespace.name receivers: otlp: protocols: diff --git a/internal/cmd/egctl/testdata/translate/in/default-resources.yaml b/internal/cmd/egctl/testdata/translate/in/default-resources.yaml index d36c7913460..4eb7e3711c3 100644 --- a/internal/cmd/egctl/testdata/translate/in/default-resources.yaml +++ b/internal/cmd/egctl/testdata/translate/in/default-resources.yaml @@ -161,7 +161,7 @@ metadata: name: endpointslice-providedBackend namespace: default labels: - kubernetes.io/service-name: providedBackend + kubernetes.io/service-name: providedBackend addressType: IPv4 ports: - name: http diff --git a/internal/cmd/egctl/testdata/translate/in/invalid-envoyproxy.yaml b/internal/cmd/egctl/testdata/translate/in/invalid-envoyproxy.yaml index 1fb211f14ed..0900c467672 100644 --- a/internal/cmd/egctl/testdata/translate/in/invalid-envoyproxy.yaml +++ b/internal/cmd/egctl/testdata/translate/in/invalid-envoyproxy.yaml @@ -2,7 +2,7 @@ apiVersion: config.gateway.envoyproxy.io/v1alpha1 kind: EnvoyProxy metadata: name: example - namespace: default + namespace: default spec: bootstrap: | admin: @@ -26,7 +26,7 @@ spec: group: config.gateway.envoyproxy.io kind: EnvoyProxy name: example - namespace: default + namespace: default --- apiVersion: gateway.networking.k8s.io/v1beta1 kind: Gateway diff --git a/internal/cmd/egctl/testdata/translate/in/valid-envoyproxy.yaml b/internal/cmd/egctl/testdata/translate/in/valid-envoyproxy.yaml index 20868890361..67f55ea8562 100644 --- a/internal/cmd/egctl/testdata/translate/in/valid-envoyproxy.yaml +++ b/internal/cmd/egctl/testdata/translate/in/valid-envoyproxy.yaml @@ -2,14 +2,14 @@ apiVersion: config.gateway.envoyproxy.io/v1alpha1 kind: EnvoyProxy metadata: name: example - namespace: default + namespace: default spec: provider: type: Kubernetes kubernetes: envoyService: annotations: - custom1: svc-annotation1 + custom1: svc-annotation1 --- apiVersion: gateway.networking.k8s.io/v1beta1 kind: GatewayClass @@ -21,7 +21,7 @@ spec: group: config.gateway.envoyproxy.io kind: EnvoyProxy name: example - namespace: default + namespace: default --- apiVersion: gateway.networking.k8s.io/v1beta1 kind: Gateway diff --git a/internal/gatewayapi/testdata/extensions/httproute-with-extension-filter-invalid-group.out.yaml b/internal/gatewayapi/testdata/extensions/httproute-with-extension-filter-invalid-group.out.yaml index 33ffed026f6..d704f4a4c80 100644 --- a/internal/gatewayapi/testdata/extensions/httproute-with-extension-filter-invalid-group.out.yaml +++ b/internal/gatewayapi/testdata/extensions/httproute-with-extension-filter-invalid-group.out.yaml @@ -22,7 +22,7 @@ gateways: kind: HTTPRoute - group: gateway.networking.k8s.io kind: GRPCRoute - attachedRoutes: 0 + attachedRoutes: 0 conditions: - type: Programmed status: "True" @@ -57,7 +57,7 @@ httpRoutes: extensionRef: group: foo.example.io kind: Foo - name: test + name: test status: parents: - parentRef: diff --git a/internal/gatewayapi/testdata/extensions/httproute-with-non-matching-extension-filter.out.yaml b/internal/gatewayapi/testdata/extensions/httproute-with-non-matching-extension-filter.out.yaml index 35759a2d59a..38a54291a75 100644 --- a/internal/gatewayapi/testdata/extensions/httproute-with-non-matching-extension-filter.out.yaml +++ b/internal/gatewayapi/testdata/extensions/httproute-with-non-matching-extension-filter.out.yaml @@ -22,7 +22,7 @@ gateways: kind: HTTPRoute - group: gateway.networking.k8s.io kind: GRPCRoute - attachedRoutes: 0 + attachedRoutes: 0 conditions: - type: Programmed status: "True" @@ -57,7 +57,7 @@ httpRoutes: extensionRef: group: foo.example.io kind: Foo - name: example + name: example status: parents: - parentRef: diff --git a/internal/gatewayapi/testdata/extensions/httproute-with-unsupported-extension-filter.out.yaml b/internal/gatewayapi/testdata/extensions/httproute-with-unsupported-extension-filter.out.yaml index ec80541ed1e..49e40e78a67 100644 --- a/internal/gatewayapi/testdata/extensions/httproute-with-unsupported-extension-filter.out.yaml +++ b/internal/gatewayapi/testdata/extensions/httproute-with-unsupported-extension-filter.out.yaml @@ -22,7 +22,7 @@ gateways: kind: HTTPRoute - group: gateway.networking.k8s.io kind: GRPCRoute - attachedRoutes: 0 + attachedRoutes: 0 conditions: - type: Programmed status: "True" @@ -57,7 +57,7 @@ httpRoutes: extensionRef: group: foo.example.io kind: Unsupported - name: test + name: test status: parents: - parentRef: diff --git a/internal/gatewayapi/testdata/extensions/httproute-with-valid-extension-filter.out.yaml b/internal/gatewayapi/testdata/extensions/httproute-with-valid-extension-filter.out.yaml index 441d1d0d08e..59cae161da6 100644 --- a/internal/gatewayapi/testdata/extensions/httproute-with-valid-extension-filter.out.yaml +++ b/internal/gatewayapi/testdata/extensions/httproute-with-valid-extension-filter.out.yaml @@ -21,7 +21,7 @@ gateways: - group: gateway.networking.k8s.io kind: HTTPRoute - group: gateway.networking.k8s.io - kind: GRPCRoute + kind: GRPCRoute attachedRoutes: 1 conditions: - type: Programmed diff --git a/internal/gatewayapi/testdata/gateway-allows-same-namespace-with-disallowed-httproute.out.yaml b/internal/gatewayapi/testdata/gateway-allows-same-namespace-with-disallowed-httproute.out.yaml index 37e98d16926..8a89b57af5f 100644 --- a/internal/gatewayapi/testdata/gateway-allows-same-namespace-with-disallowed-httproute.out.yaml +++ b/internal/gatewayapi/testdata/gateway-allows-same-namespace-with-disallowed-httproute.out.yaml @@ -20,7 +20,7 @@ gateways: - group: gateway.networking.k8s.io kind: HTTPRoute - group: gateway.networking.k8s.io - kind: GRPCRoute + kind: GRPCRoute attachedRoutes: 0 conditions: - type: Programmed @@ -59,9 +59,9 @@ httpRoutes: status: "False" reason: NotAllowedByListeners message: No listeners included by this parent ref allowed this attachment. - - type: ResolvedRefs + - type: ResolvedRefs status: "True" - reason: ResolvedRefs + reason: ResolvedRefs message: Resolved all the Object references for the Route xdsIR: envoy-gateway-gateway-1: diff --git a/internal/gatewayapi/testdata/gateway-with-listener-with-invalid-multiple-tls-configuration.in.yaml b/internal/gatewayapi/testdata/gateway-with-listener-with-invalid-multiple-tls-configuration.in.yaml index b4355b39250..6418ac1093d 100644 --- a/internal/gatewayapi/testdata/gateway-with-listener-with-invalid-multiple-tls-configuration.in.yaml +++ b/internal/gatewayapi/testdata/gateway-with-listener-with-invalid-multiple-tls-configuration.in.yaml @@ -19,7 +19,7 @@ gateways: - name: tls-secret-ecdsa-1 - name: tls-secret-ecdsa-2 - name: tls-secret-1 - + secrets: - apiVersion: v1 kind: Secret diff --git a/internal/gatewayapi/testdata/gateway-with-two-listeners-with-http-and-tlsroute-same-hostname-and-port.out.yaml b/internal/gatewayapi/testdata/gateway-with-two-listeners-with-http-and-tlsroute-same-hostname-and-port.out.yaml index 21b51761eb6..8de2133448b 100644 --- a/internal/gatewayapi/testdata/gateway-with-two-listeners-with-http-and-tlsroute-same-hostname-and-port.out.yaml +++ b/internal/gatewayapi/testdata/gateway-with-two-listeners-with-http-and-tlsroute-same-hostname-and-port.out.yaml @@ -30,7 +30,7 @@ gateways: - group: gateway.networking.k8s.io kind: HTTPRoute - group: gateway.networking.k8s.io - kind: GRPCRoute + kind: GRPCRoute conditions: - type: Conflicted status: "True" @@ -81,9 +81,9 @@ httpRoutes: status: "False" reason: NoReadyListeners message: There are no ready listeners for this parent ref - - type: ResolvedRefs + - type: ResolvedRefs status: "True" - reason: ResolvedRefs + reason: ResolvedRefs message: Resolved all the Object references for the Route tlsRoutes: - apiVersion: gateway.networking.k8s.io/v1alpha2 @@ -110,9 +110,9 @@ tlsRoutes: status: "False" reason: NoReadyListeners message: There are no ready listeners for this parent ref - - type: ResolvedRefs + - type: ResolvedRefs status: "True" - reason: ResolvedRefs + reason: ResolvedRefs message: Resolved all the Object references for the Route xdsIR: envoy-gateway-gateway-1: diff --git a/internal/gatewayapi/testdata/gateway-with-two-listeners-with-multiple-httproutes.out.yaml b/internal/gatewayapi/testdata/gateway-with-two-listeners-with-multiple-httproutes.out.yaml index 742dd35f4b5..3ddb5f7b2b2 100644 --- a/internal/gatewayapi/testdata/gateway-with-two-listeners-with-multiple-httproutes.out.yaml +++ b/internal/gatewayapi/testdata/gateway-with-two-listeners-with-multiple-httproutes.out.yaml @@ -28,7 +28,7 @@ gateways: - group: gateway.networking.k8s.io kind: HTTPRoute - group: gateway.networking.k8s.io - kind: GRPCRoute + kind: GRPCRoute AttachedRoutes: 2 conditions: - type: Programmed @@ -44,7 +44,7 @@ gateways: - group: gateway.networking.k8s.io kind: HTTPRoute - group: gateway.networking.k8s.io - kind: GRPCRoute + kind: GRPCRoute AttachedRoutes: 2 conditions: - type: Programmed diff --git a/internal/gatewayapi/testdata/gateway-with-two-listeners-with-same-port-and-hostname.out.yaml b/internal/gatewayapi/testdata/gateway-with-two-listeners-with-same-port-and-hostname.out.yaml index fabf37648c4..c03482cef47 100644 --- a/internal/gatewayapi/testdata/gateway-with-two-listeners-with-same-port-and-hostname.out.yaml +++ b/internal/gatewayapi/testdata/gateway-with-two-listeners-with-same-port-and-hostname.out.yaml @@ -28,7 +28,7 @@ gateways: - group: gateway.networking.k8s.io kind: HTTPRoute - group: gateway.networking.k8s.io - kind: GRPCRoute + kind: GRPCRoute conditions: - type: Conflicted status: "True" @@ -43,7 +43,7 @@ gateways: - group: gateway.networking.k8s.io kind: HTTPRoute - group: gateway.networking.k8s.io - kind: GRPCRoute + kind: GRPCRoute conditions: - type: Conflicted status: "True" @@ -81,9 +81,9 @@ httpRoutes: status: "False" reason: NoReadyListeners message: There are no ready listeners for this parent ref - - type: ResolvedRefs + - type: ResolvedRefs status: "True" - reason: ResolvedRefs + reason: ResolvedRefs message: Resolved all the Object references for the Route xdsIR: envoy-gateway-gateway-1: diff --git a/internal/gatewayapi/testdata/gateway-with-two-listeners-with-same-port-http-udp-protocol.out.yaml b/internal/gatewayapi/testdata/gateway-with-two-listeners-with-same-port-http-udp-protocol.out.yaml index 14b89b6bb28..95bf36b4a69 100644 --- a/internal/gatewayapi/testdata/gateway-with-two-listeners-with-same-port-http-udp-protocol.out.yaml +++ b/internal/gatewayapi/testdata/gateway-with-two-listeners-with-same-port-http-udp-protocol.out.yaml @@ -27,7 +27,7 @@ gateways: - group: gateway.networking.k8s.io kind: HTTPRoute - group: gateway.networking.k8s.io - kind: GRPCRoute + kind: GRPCRoute AttachedRoutes: 1 conditions: - type: Programmed diff --git a/internal/gatewayapi/testdata/grpcroute-with-header-match.in.yaml b/internal/gatewayapi/testdata/grpcroute-with-header-match.in.yaml index 60b6d9cdb4f..b6078734a8d 100644 --- a/internal/gatewayapi/testdata/grpcroute-with-header-match.in.yaml +++ b/internal/gatewayapi/testdata/grpcroute-with-header-match.in.yaml @@ -7,7 +7,7 @@ gateways: spec: gatewayClassName: envoy-gateway-class listeners: - - name: http + - name: http protocol: HTTP port: 80 allowedRoutes: @@ -23,13 +23,13 @@ grpcRoutes: parentRefs: - namespace: envoy-gateway name: gateway-1 - sectionName: http + sectionName: http rules: - matches: - headers: - type: Exact name: magic - value: foo + value: foo backendRefs: - name: service-1 port: 8080 diff --git a/internal/gatewayapi/testdata/grpcroute-with-header-match.out.yaml b/internal/gatewayapi/testdata/grpcroute-with-header-match.out.yaml index eed57ad78ed..e78eb2a70a2 100644 --- a/internal/gatewayapi/testdata/grpcroute-with-header-match.out.yaml +++ b/internal/gatewayapi/testdata/grpcroute-with-header-match.out.yaml @@ -20,7 +20,7 @@ gateways: - group: gateway.networking.k8s.io kind: HTTPRoute - group: gateway.networking.k8s.io - kind: GRPCRoute + kind: GRPCRoute attachedRoutes: 1 conditions: - type: Programmed @@ -47,7 +47,7 @@ grpcRoutes: - headers: - type: Exact name: magic - value: foo + value: foo backendRefs: - name: service-1 port: 8080 @@ -78,11 +78,11 @@ xdsIR: port: 10080 hostnames: - "*" - isHTTP2: true + isHTTP2: true routes: - name: default-grpcroute-1-rule-0-match-0-* headerMatches: - - name: "magic" + - name: "magic" exact: "foo" destinations: - host: 7.7.7.7 diff --git a/internal/gatewayapi/testdata/grpcroute-with-request-header-modifier.in.yaml b/internal/gatewayapi/testdata/grpcroute-with-request-header-modifier.in.yaml index d427d1c7736..56dbf4ed110 100644 --- a/internal/gatewayapi/testdata/grpcroute-with-request-header-modifier.in.yaml +++ b/internal/gatewayapi/testdata/grpcroute-with-request-header-modifier.in.yaml @@ -7,7 +7,7 @@ gateways: spec: gatewayClassName: envoy-gateway-class listeners: - - name: http + - name: http protocol: HTTP port: 80 allowedRoutes: @@ -23,14 +23,14 @@ grpcRoutes: parentRefs: - namespace: envoy-gateway name: gateway-1 - sectionName: http + sectionName: http rules: - filters: - type: "RequestHeaderModifier" requestHeaderModifier: add: - name: "my-header" - value: "foo" + value: "foo" backendRefs: - name: service-1 port: 8080 diff --git a/internal/gatewayapi/testdata/grpcroute-with-request-header-modifier.out.yaml b/internal/gatewayapi/testdata/grpcroute-with-request-header-modifier.out.yaml index 93b9a4848e6..ea1c7f95262 100644 --- a/internal/gatewayapi/testdata/grpcroute-with-request-header-modifier.out.yaml +++ b/internal/gatewayapi/testdata/grpcroute-with-request-header-modifier.out.yaml @@ -20,7 +20,7 @@ gateways: - group: gateway.networking.k8s.io kind: HTTPRoute - group: gateway.networking.k8s.io - kind: GRPCRoute + kind: GRPCRoute attachedRoutes: 1 conditions: - type: Programmed @@ -48,7 +48,7 @@ grpcRoutes: requestHeaderModifier: add: - name: my-header - value: foo + value: foo backendRefs: - name: service-1 port: 8080 @@ -79,11 +79,11 @@ xdsIR: port: 10080 hostnames: - "*" - isHTTP2: true + isHTTP2: true routes: - name: default-grpcroute-1-rule-0-match--1-* addRequestHeaders: - - name: "my-header" + - name: "my-header" value: "foo" append: true destinations: diff --git a/internal/gatewayapi/testdata/httproute-with-empty-matches.out.yaml b/internal/gatewayapi/testdata/httproute-with-empty-matches.out.yaml index cd3aa53a1a0..04916c41708 100644 --- a/internal/gatewayapi/testdata/httproute-with-empty-matches.out.yaml +++ b/internal/gatewayapi/testdata/httproute-with-empty-matches.out.yaml @@ -78,7 +78,7 @@ xdsIR: destinations: - host: 7.7.7.7 port: 8080 - weight: 1 + weight: 1 infraIR: envoy-gateway-gateway-1: proxy: diff --git a/internal/gatewayapi/testdata/httproute-with-header-filter-duplicate-add-multiple-filters.out.yaml b/internal/gatewayapi/testdata/httproute-with-header-filter-duplicate-add-multiple-filters.out.yaml index 6101daaef3d..48f5f5e1e9b 100644 --- a/internal/gatewayapi/testdata/httproute-with-header-filter-duplicate-add-multiple-filters.out.yaml +++ b/internal/gatewayapi/testdata/httproute-with-header-filter-duplicate-add-multiple-filters.out.yaml @@ -21,7 +21,7 @@ gateways: - group: gateway.networking.k8s.io kind: HTTPRoute - group: gateway.networking.k8s.io - kind: GRPCRoute + kind: GRPCRoute attachedRoutes: 1 conditions: - type: Programmed diff --git a/internal/gatewayapi/testdata/httproute-with-header-filter-duplicate-adds.in.yaml b/internal/gatewayapi/testdata/httproute-with-header-filter-duplicate-adds.in.yaml index 27cf212753e..7a721b54686 100644 --- a/internal/gatewayapi/testdata/httproute-with-header-filter-duplicate-adds.in.yaml +++ b/internal/gatewayapi/testdata/httproute-with-header-filter-duplicate-adds.in.yaml @@ -37,7 +37,7 @@ httpRoutes: filters: - type: RequestHeaderModifier requestHeaderModifier: - set: + set: - name: "set-header-1" value: "some-value" - name: "set-header-2" diff --git a/internal/gatewayapi/testdata/httproute-with-header-filter-duplicate-adds.out.yaml b/internal/gatewayapi/testdata/httproute-with-header-filter-duplicate-adds.out.yaml index 848d3967a97..d554bff964c 100644 --- a/internal/gatewayapi/testdata/httproute-with-header-filter-duplicate-adds.out.yaml +++ b/internal/gatewayapi/testdata/httproute-with-header-filter-duplicate-adds.out.yaml @@ -21,7 +21,7 @@ gateways: - group: gateway.networking.k8s.io kind: HTTPRoute - group: gateway.networking.k8s.io - kind: GRPCRoute + kind: GRPCRoute attachedRoutes: 1 conditions: - type: Programmed @@ -55,7 +55,7 @@ httpRoutes: filters: - type: RequestHeaderModifier requestHeaderModifier: - set: + set: - name: "set-header-1" value: "some-value" - name: "set-header-2" diff --git a/internal/gatewayapi/testdata/httproute-with-header-filter-duplicate-remove-multiple-filters.out.yaml b/internal/gatewayapi/testdata/httproute-with-header-filter-duplicate-remove-multiple-filters.out.yaml index 6f560fea5fd..b2e95362ad5 100644 --- a/internal/gatewayapi/testdata/httproute-with-header-filter-duplicate-remove-multiple-filters.out.yaml +++ b/internal/gatewayapi/testdata/httproute-with-header-filter-duplicate-remove-multiple-filters.out.yaml @@ -21,7 +21,7 @@ gateways: - group: gateway.networking.k8s.io kind: HTTPRoute - group: gateway.networking.k8s.io - kind: GRPCRoute + kind: GRPCRoute attachedRoutes: 1 conditions: - type: Programmed diff --git a/internal/gatewayapi/testdata/httproute-with-header-filter-duplicate-removes.out.yaml b/internal/gatewayapi/testdata/httproute-with-header-filter-duplicate-removes.out.yaml index 609297306ed..41e7a57643d 100644 --- a/internal/gatewayapi/testdata/httproute-with-header-filter-duplicate-removes.out.yaml +++ b/internal/gatewayapi/testdata/httproute-with-header-filter-duplicate-removes.out.yaml @@ -21,7 +21,7 @@ gateways: - group: gateway.networking.k8s.io kind: HTTPRoute - group: gateway.networking.k8s.io - kind: GRPCRoute + kind: GRPCRoute attachedRoutes: 1 conditions: - type: Programmed diff --git a/internal/gatewayapi/testdata/httproute-with-header-filter-empty-header-values.in.yaml b/internal/gatewayapi/testdata/httproute-with-header-filter-empty-header-values.in.yaml index fd3cdf88210..7c22d7c62fe 100644 --- a/internal/gatewayapi/testdata/httproute-with-header-filter-empty-header-values.in.yaml +++ b/internal/gatewayapi/testdata/httproute-with-header-filter-empty-header-values.in.yaml @@ -37,7 +37,7 @@ httpRoutes: filters: - type: RequestHeaderModifier requestHeaderModifier: - set: + set: - name: "example-header-1" value: "" add: diff --git a/internal/gatewayapi/testdata/httproute-with-header-filter-empty-header-values.out.yaml b/internal/gatewayapi/testdata/httproute-with-header-filter-empty-header-values.out.yaml index ce9d1eb69a5..52b344ecefe 100644 --- a/internal/gatewayapi/testdata/httproute-with-header-filter-empty-header-values.out.yaml +++ b/internal/gatewayapi/testdata/httproute-with-header-filter-empty-header-values.out.yaml @@ -21,7 +21,7 @@ gateways: - group: gateway.networking.k8s.io kind: HTTPRoute - group: gateway.networking.k8s.io - kind: GRPCRoute + kind: GRPCRoute attachedRoutes: 1 conditions: - type: Programmed @@ -55,7 +55,7 @@ httpRoutes: filters: - type: RequestHeaderModifier requestHeaderModifier: - set: + set: - name: "example-header-1" value: "" add: diff --git a/internal/gatewayapi/testdata/httproute-with-header-filter-empty-headers.in.yaml b/internal/gatewayapi/testdata/httproute-with-header-filter-empty-headers.in.yaml index 74fa4eaba59..978ef416a6d 100644 --- a/internal/gatewayapi/testdata/httproute-with-header-filter-empty-headers.in.yaml +++ b/internal/gatewayapi/testdata/httproute-with-header-filter-empty-headers.in.yaml @@ -37,7 +37,7 @@ httpRoutes: filters: - type: RequestHeaderModifier requestHeaderModifier: - set: + set: - name: "" value: "some-value" add: diff --git a/internal/gatewayapi/testdata/httproute-with-header-filter-empty-headers.out.yaml b/internal/gatewayapi/testdata/httproute-with-header-filter-empty-headers.out.yaml index fe848f05a15..e81580c66cb 100644 --- a/internal/gatewayapi/testdata/httproute-with-header-filter-empty-headers.out.yaml +++ b/internal/gatewayapi/testdata/httproute-with-header-filter-empty-headers.out.yaml @@ -21,8 +21,8 @@ gateways: - group: gateway.networking.k8s.io kind: HTTPRoute - group: gateway.networking.k8s.io - kind: GRPCRoute - attachedRoutes: 0 + kind: GRPCRoute + attachedRoutes: 0 conditions: - type: Programmed status: "True" @@ -55,7 +55,7 @@ httpRoutes: filters: - type: RequestHeaderModifier requestHeaderModifier: - set: + set: - name: "" value: "some-value" add: diff --git a/internal/gatewayapi/testdata/httproute-with-header-filter-invalid-headers.in.yaml b/internal/gatewayapi/testdata/httproute-with-header-filter-invalid-headers.in.yaml index 193fe86698a..ecdaf8f42dd 100644 --- a/internal/gatewayapi/testdata/httproute-with-header-filter-invalid-headers.in.yaml +++ b/internal/gatewayapi/testdata/httproute-with-header-filter-invalid-headers.in.yaml @@ -37,7 +37,7 @@ httpRoutes: filters: - type: RequestHeaderModifier requestHeaderModifier: - set: + set: - name: "example:1" value: "some-value" - name: "good-header" diff --git a/internal/gatewayapi/testdata/httproute-with-header-filter-invalid-headers.out.yaml b/internal/gatewayapi/testdata/httproute-with-header-filter-invalid-headers.out.yaml index dc9b1b30c2e..42853facaab 100644 --- a/internal/gatewayapi/testdata/httproute-with-header-filter-invalid-headers.out.yaml +++ b/internal/gatewayapi/testdata/httproute-with-header-filter-invalid-headers.out.yaml @@ -21,8 +21,8 @@ gateways: - group: gateway.networking.k8s.io kind: HTTPRoute - group: gateway.networking.k8s.io - kind: GRPCRoute - attachedRoutes: 0 + kind: GRPCRoute + attachedRoutes: 0 conditions: - type: Programmed status: "True" @@ -55,7 +55,7 @@ httpRoutes: filters: - type: RequestHeaderModifier requestHeaderModifier: - set: + set: - name: "example:1" value: "some-value" - name: "good-header" diff --git a/internal/gatewayapi/testdata/httproute-with-header-filter-no-headers.out.yaml b/internal/gatewayapi/testdata/httproute-with-header-filter-no-headers.out.yaml index 067e9caff93..2abe256e2b4 100644 --- a/internal/gatewayapi/testdata/httproute-with-header-filter-no-headers.out.yaml +++ b/internal/gatewayapi/testdata/httproute-with-header-filter-no-headers.out.yaml @@ -21,7 +21,7 @@ gateways: - group: gateway.networking.k8s.io kind: HTTPRoute - group: gateway.networking.k8s.io - kind: GRPCRoute + kind: GRPCRoute attachedRoutes: 1 conditions: - type: Programmed diff --git a/internal/gatewayapi/testdata/httproute-with-header-filter-no-valid-headers.out.yaml b/internal/gatewayapi/testdata/httproute-with-header-filter-no-valid-headers.out.yaml index a35f0233a08..10c42c51c5a 100644 --- a/internal/gatewayapi/testdata/httproute-with-header-filter-no-valid-headers.out.yaml +++ b/internal/gatewayapi/testdata/httproute-with-header-filter-no-valid-headers.out.yaml @@ -21,8 +21,8 @@ gateways: - group: gateway.networking.k8s.io kind: HTTPRoute - group: gateway.networking.k8s.io - kind: GRPCRoute - attachedRoutes: 0 + kind: GRPCRoute + attachedRoutes: 0 conditions: - type: Programmed status: "True" diff --git a/internal/gatewayapi/testdata/httproute-with-header-filter-remove.out.yaml b/internal/gatewayapi/testdata/httproute-with-header-filter-remove.out.yaml index c5837381213..d6c4626e9c2 100644 --- a/internal/gatewayapi/testdata/httproute-with-header-filter-remove.out.yaml +++ b/internal/gatewayapi/testdata/httproute-with-header-filter-remove.out.yaml @@ -21,7 +21,7 @@ gateways: - group: gateway.networking.k8s.io kind: HTTPRoute - group: gateway.networking.k8s.io - kind: GRPCRoute + kind: GRPCRoute attachedRoutes: 1 conditions: - type: Programmed diff --git a/internal/gatewayapi/testdata/httproute-with-invalid-backend-ref-bad-port.out.yaml b/internal/gatewayapi/testdata/httproute-with-invalid-backend-ref-bad-port.out.yaml index f09f1f92eac..eddeae921f4 100644 --- a/internal/gatewayapi/testdata/httproute-with-invalid-backend-ref-bad-port.out.yaml +++ b/internal/gatewayapi/testdata/httproute-with-invalid-backend-ref-bad-port.out.yaml @@ -20,7 +20,7 @@ gateways: - group: gateway.networking.k8s.io kind: HTTPRoute - group: gateway.networking.k8s.io - kind: GRPCRoute + kind: GRPCRoute attachedRoutes: 1 conditions: - type: Programmed @@ -79,7 +79,7 @@ xdsIR: - name: default-httproute-1-rule-0-match-0-* pathMatch: exact: "/exact" - backendWeights: + backendWeights: invalid: 1 directResponse: statusCode: 500 diff --git a/internal/gatewayapi/testdata/httproute-with-invalid-backend-ref-invalid-group.out.yaml b/internal/gatewayapi/testdata/httproute-with-invalid-backend-ref-invalid-group.out.yaml index 77a2d9d0aa4..15d81da4795 100644 --- a/internal/gatewayapi/testdata/httproute-with-invalid-backend-ref-invalid-group.out.yaml +++ b/internal/gatewayapi/testdata/httproute-with-invalid-backend-ref-invalid-group.out.yaml @@ -20,7 +20,7 @@ gateways: - group: gateway.networking.k8s.io kind: HTTPRoute - group: gateway.networking.k8s.io - kind: GRPCRoute + kind: GRPCRoute attachedRoutes: 1 conditions: - type: Programmed @@ -81,7 +81,7 @@ xdsIR: - name: default-httproute-1-rule-0-match-0-* pathMatch: exact: "/exact" - backendWeights: + backendWeights: invalid: 1 directResponse: statusCode: 500 diff --git a/internal/gatewayapi/testdata/httproute-with-invalid-backend-ref-invalid-kind.out.yaml b/internal/gatewayapi/testdata/httproute-with-invalid-backend-ref-invalid-kind.out.yaml index 3d302a55cce..e65acdb4240 100644 --- a/internal/gatewayapi/testdata/httproute-with-invalid-backend-ref-invalid-kind.out.yaml +++ b/internal/gatewayapi/testdata/httproute-with-invalid-backend-ref-invalid-kind.out.yaml @@ -20,7 +20,7 @@ gateways: - group: gateway.networking.k8s.io kind: HTTPRoute - group: gateway.networking.k8s.io - kind: GRPCRoute + kind: GRPCRoute attachedRoutes: 1 conditions: - type: Programmed @@ -80,7 +80,7 @@ xdsIR: - name: default-httproute-1-rule-0-match-0-* pathMatch: exact: "/exact" - backendWeights: + backendWeights: invalid: 1 directResponse: statusCode: 500 diff --git a/internal/gatewayapi/testdata/httproute-with-invalid-backend-ref-no-port.out.yaml b/internal/gatewayapi/testdata/httproute-with-invalid-backend-ref-no-port.out.yaml index 38cfc763208..96eec55e1bc 100644 --- a/internal/gatewayapi/testdata/httproute-with-invalid-backend-ref-no-port.out.yaml +++ b/internal/gatewayapi/testdata/httproute-with-invalid-backend-ref-no-port.out.yaml @@ -20,7 +20,7 @@ gateways: - group: gateway.networking.k8s.io kind: HTTPRoute - group: gateway.networking.k8s.io - kind: GRPCRoute + kind: GRPCRoute attachedRoutes: 1 conditions: - type: Programmed @@ -78,7 +78,7 @@ xdsIR: - name: default-httproute-1-rule-0-match-0-* pathMatch: exact: "/exact" - backendWeights: + backendWeights: invalid: 1 directResponse: statusCode: 500 diff --git a/internal/gatewayapi/testdata/httproute-with-invalid-backend-ref-no-service.out.yaml b/internal/gatewayapi/testdata/httproute-with-invalid-backend-ref-no-service.out.yaml index e170fe730a7..91947d8b7ce 100644 --- a/internal/gatewayapi/testdata/httproute-with-invalid-backend-ref-no-service.out.yaml +++ b/internal/gatewayapi/testdata/httproute-with-invalid-backend-ref-no-service.out.yaml @@ -20,7 +20,7 @@ gateways: - group: gateway.networking.k8s.io kind: HTTPRoute - group: gateway.networking.k8s.io - kind: GRPCRoute + kind: GRPCRoute attachedRoutes: 1 conditions: - type: Programmed @@ -79,7 +79,7 @@ xdsIR: - name: default-httproute-1-rule-0-match-0-* pathMatch: exact: "/exact" - backendWeights: + backendWeights: invalid: 1 directResponse: statusCode: 500 diff --git a/internal/gatewayapi/testdata/httproute-with-invalid-ratelimitfilter.out.yaml b/internal/gatewayapi/testdata/httproute-with-invalid-ratelimitfilter.out.yaml index a5c405535d6..3bd31d66bf0 100644 --- a/internal/gatewayapi/testdata/httproute-with-invalid-ratelimitfilter.out.yaml +++ b/internal/gatewayapi/testdata/httproute-with-invalid-ratelimitfilter.out.yaml @@ -22,7 +22,7 @@ gateways: kind: HTTPRoute - group: gateway.networking.k8s.io kind: GRPCRoute - attachedRoutes: 0 + attachedRoutes: 0 conditions: - type: Programmed status: "True" @@ -57,7 +57,7 @@ httpRoutes: extensionRef: group: gateway.envoyproxy.io kind: RateLimitFilter - name: test + name: test status: parents: - parentRef: diff --git a/internal/gatewayapi/testdata/httproute-with-non-existent-authenfilter-ref.in.yaml b/internal/gatewayapi/testdata/httproute-with-non-existent-authenfilter-ref.in.yaml index 7fdb47e419c..da672ca499e 100644 --- a/internal/gatewayapi/testdata/httproute-with-non-existent-authenfilter-ref.in.yaml +++ b/internal/gatewayapi/testdata/httproute-with-non-existent-authenfilter-ref.in.yaml @@ -39,5 +39,5 @@ httpRoutes: extensionRef: group: gateway.envoyproxy.io kind: AuthenticationFilter - name: non-exist + name: non-exist diff --git a/internal/gatewayapi/testdata/httproute-with-non-existent-authenfilter-ref.out.yaml b/internal/gatewayapi/testdata/httproute-with-non-existent-authenfilter-ref.out.yaml index 981af58137e..51534991812 100644 --- a/internal/gatewayapi/testdata/httproute-with-non-existent-authenfilter-ref.out.yaml +++ b/internal/gatewayapi/testdata/httproute-with-non-existent-authenfilter-ref.out.yaml @@ -22,7 +22,7 @@ gateways: kind: HTTPRoute - group: gateway.networking.k8s.io kind: GRPCRoute - attachedRoutes: 0 + attachedRoutes: 0 conditions: - type: Programmed status: "True" @@ -57,7 +57,7 @@ httpRoutes: extensionRef: group: gateway.envoyproxy.io kind: AuthenticationFilter - name: non-exist + name: non-exist status: parents: - parentRef: diff --git a/internal/gatewayapi/testdata/httproute-with-non-matching-authenfilter-ref.in.yaml b/internal/gatewayapi/testdata/httproute-with-non-matching-authenfilter-ref.in.yaml index a571b30739c..cdf5030c62f 100644 --- a/internal/gatewayapi/testdata/httproute-with-non-matching-authenfilter-ref.in.yaml +++ b/internal/gatewayapi/testdata/httproute-with-non-matching-authenfilter-ref.in.yaml @@ -39,7 +39,7 @@ httpRoutes: extensionRef: group: gateway.envoyproxy.io kind: AuthenticationFilter - name: test + name: test authenticationFilters: - apiVersion: gateway.envoyproxy.io/v1alpha1 kind: AuthenticationFilter diff --git a/internal/gatewayapi/testdata/httproute-with-non-matching-authenfilter-ref.out.yaml b/internal/gatewayapi/testdata/httproute-with-non-matching-authenfilter-ref.out.yaml index 2a7a4af45e7..528213af92f 100644 --- a/internal/gatewayapi/testdata/httproute-with-non-matching-authenfilter-ref.out.yaml +++ b/internal/gatewayapi/testdata/httproute-with-non-matching-authenfilter-ref.out.yaml @@ -22,7 +22,7 @@ gateways: kind: HTTPRoute - group: gateway.networking.k8s.io kind: GRPCRoute - attachedRoutes: 0 + attachedRoutes: 0 conditions: - type: Programmed status: "True" @@ -57,7 +57,7 @@ httpRoutes: extensionRef: group: gateway.envoyproxy.io kind: AuthenticationFilter - name: test + name: test status: parents: - parentRef: diff --git a/internal/gatewayapi/testdata/httproute-with-non-matching-specific-hostname-attaching-to-gateway-with-wildcard-hostname.out.yaml b/internal/gatewayapi/testdata/httproute-with-non-matching-specific-hostname-attaching-to-gateway-with-wildcard-hostname.out.yaml index 99f13925158..cf4bc21c460 100644 --- a/internal/gatewayapi/testdata/httproute-with-non-matching-specific-hostname-attaching-to-gateway-with-wildcard-hostname.out.yaml +++ b/internal/gatewayapi/testdata/httproute-with-non-matching-specific-hostname-attaching-to-gateway-with-wildcard-hostname.out.yaml @@ -21,7 +21,7 @@ gateways: - group: gateway.networking.k8s.io kind: HTTPRoute - group: gateway.networking.k8s.io - kind: GRPCRoute + kind: GRPCRoute attachedRoutes: 0 conditions: - type: Programmed diff --git a/internal/gatewayapi/testdata/httproute-with-redirect-filter-full-path-replace-https.out.yaml b/internal/gatewayapi/testdata/httproute-with-redirect-filter-full-path-replace-https.out.yaml index 0f521547fed..92b0fec3731 100644 --- a/internal/gatewayapi/testdata/httproute-with-redirect-filter-full-path-replace-https.out.yaml +++ b/internal/gatewayapi/testdata/httproute-with-redirect-filter-full-path-replace-https.out.yaml @@ -21,7 +21,7 @@ gateways: - group: gateway.networking.k8s.io kind: HTTPRoute - group: gateway.networking.k8s.io - kind: GRPCRoute + kind: GRPCRoute attachedRoutes: 1 conditions: - type: Programmed diff --git a/internal/gatewayapi/testdata/httproute-with-redirect-filter-hostname.out.yaml b/internal/gatewayapi/testdata/httproute-with-redirect-filter-hostname.out.yaml index 8b96017249e..caf2893c674 100644 --- a/internal/gatewayapi/testdata/httproute-with-redirect-filter-hostname.out.yaml +++ b/internal/gatewayapi/testdata/httproute-with-redirect-filter-hostname.out.yaml @@ -21,7 +21,7 @@ gateways: - group: gateway.networking.k8s.io kind: HTTPRoute - group: gateway.networking.k8s.io - kind: GRPCRoute + kind: GRPCRoute attachedRoutes: 1 conditions: - type: Programmed diff --git a/internal/gatewayapi/testdata/httproute-with-redirect-filter-invalid-filter-type.out.yaml b/internal/gatewayapi/testdata/httproute-with-redirect-filter-invalid-filter-type.out.yaml index 753a07e104e..8ee4e91fce0 100644 --- a/internal/gatewayapi/testdata/httproute-with-redirect-filter-invalid-filter-type.out.yaml +++ b/internal/gatewayapi/testdata/httproute-with-redirect-filter-invalid-filter-type.out.yaml @@ -21,8 +21,8 @@ gateways: - group: gateway.networking.k8s.io kind: HTTPRoute - group: gateway.networking.k8s.io - kind: GRPCRoute - attachedRoutes: 0 + kind: GRPCRoute + attachedRoutes: 0 conditions: - type: Programmed status: "True" diff --git a/internal/gatewayapi/testdata/httproute-with-redirect-filter-invalid-scheme.out.yaml b/internal/gatewayapi/testdata/httproute-with-redirect-filter-invalid-scheme.out.yaml index 753cd1cb487..7f6467e1e12 100644 --- a/internal/gatewayapi/testdata/httproute-with-redirect-filter-invalid-scheme.out.yaml +++ b/internal/gatewayapi/testdata/httproute-with-redirect-filter-invalid-scheme.out.yaml @@ -21,8 +21,8 @@ gateways: - group: gateway.networking.k8s.io kind: HTTPRoute - group: gateway.networking.k8s.io - kind: GRPCRoute - attachedRoutes: 0 + kind: GRPCRoute + attachedRoutes: 0 conditions: - type: Programmed status: "True" diff --git a/internal/gatewayapi/testdata/httproute-with-redirect-filter-invalid-status.out.yaml b/internal/gatewayapi/testdata/httproute-with-redirect-filter-invalid-status.out.yaml index 864c3430831..9654ab7e378 100644 --- a/internal/gatewayapi/testdata/httproute-with-redirect-filter-invalid-status.out.yaml +++ b/internal/gatewayapi/testdata/httproute-with-redirect-filter-invalid-status.out.yaml @@ -21,8 +21,8 @@ gateways: - group: gateway.networking.k8s.io kind: HTTPRoute - group: gateway.networking.k8s.io - kind: GRPCRoute - attachedRoutes: 0 + kind: GRPCRoute + attachedRoutes: 0 conditions: - type: Programmed status: "True" diff --git a/internal/gatewayapi/testdata/httproute-with-redirect-filter-prefix-replace-with-port-http.out.yaml b/internal/gatewayapi/testdata/httproute-with-redirect-filter-prefix-replace-with-port-http.out.yaml index fe6d026b007..4c3e601e1c5 100644 --- a/internal/gatewayapi/testdata/httproute-with-redirect-filter-prefix-replace-with-port-http.out.yaml +++ b/internal/gatewayapi/testdata/httproute-with-redirect-filter-prefix-replace-with-port-http.out.yaml @@ -21,7 +21,7 @@ gateways: - group: gateway.networking.k8s.io kind: HTTPRoute - group: gateway.networking.k8s.io - kind: GRPCRoute + kind: GRPCRoute attachedRoutes: 1 conditions: - type: Programmed diff --git a/internal/gatewayapi/testdata/httproute-with-response-header-filter-adds.in.yaml b/internal/gatewayapi/testdata/httproute-with-response-header-filter-adds.in.yaml index e73d2263433..cea778dd95b 100644 --- a/internal/gatewayapi/testdata/httproute-with-response-header-filter-adds.in.yaml +++ b/internal/gatewayapi/testdata/httproute-with-response-header-filter-adds.in.yaml @@ -37,7 +37,7 @@ httpRoutes: filters: - type: ResponseHeaderModifier responseHeaderModifier: - set: + set: - name: "set-header-1" value: "some-value" - name: "set-header-2" diff --git a/internal/gatewayapi/testdata/httproute-with-response-header-filter-adds.out.yaml b/internal/gatewayapi/testdata/httproute-with-response-header-filter-adds.out.yaml index 12ab7b23d54..0c2debcd6d3 100644 --- a/internal/gatewayapi/testdata/httproute-with-response-header-filter-adds.out.yaml +++ b/internal/gatewayapi/testdata/httproute-with-response-header-filter-adds.out.yaml @@ -21,7 +21,7 @@ gateways: - group: gateway.networking.k8s.io kind: HTTPRoute - group: gateway.networking.k8s.io - kind: GRPCRoute + kind: GRPCRoute attachedRoutes: 1 conditions: - type: Programmed @@ -55,7 +55,7 @@ httpRoutes: filters: - type: ResponseHeaderModifier responseHeaderModifier: - set: + set: - name: "set-header-1" value: "some-value" - name: "set-header-2" diff --git a/internal/gatewayapi/testdata/httproute-with-response-header-filter-duplicate-add-multiple-filters.out.yaml b/internal/gatewayapi/testdata/httproute-with-response-header-filter-duplicate-add-multiple-filters.out.yaml index 2394f323261..96cf03ed11c 100644 --- a/internal/gatewayapi/testdata/httproute-with-response-header-filter-duplicate-add-multiple-filters.out.yaml +++ b/internal/gatewayapi/testdata/httproute-with-response-header-filter-duplicate-add-multiple-filters.out.yaml @@ -21,7 +21,7 @@ gateways: - group: gateway.networking.k8s.io kind: HTTPRoute - group: gateway.networking.k8s.io - kind: GRPCRoute + kind: GRPCRoute attachedRoutes: 1 conditions: - type: Programmed diff --git a/internal/gatewayapi/testdata/httproute-with-response-header-filter-duplicate-adds.in.yaml b/internal/gatewayapi/testdata/httproute-with-response-header-filter-duplicate-adds.in.yaml index 001c927c230..42e37c41aaa 100644 --- a/internal/gatewayapi/testdata/httproute-with-response-header-filter-duplicate-adds.in.yaml +++ b/internal/gatewayapi/testdata/httproute-with-response-header-filter-duplicate-adds.in.yaml @@ -37,7 +37,7 @@ httpRoutes: filters: - type: ResponseHeaderModifier responseHeaderModifier: - set: + set: - name: "set-header-1" value: "some-value" - name: "set-header-2" diff --git a/internal/gatewayapi/testdata/httproute-with-response-header-filter-duplicate-adds.out.yaml b/internal/gatewayapi/testdata/httproute-with-response-header-filter-duplicate-adds.out.yaml index abc3947d41f..f62fcff669f 100644 --- a/internal/gatewayapi/testdata/httproute-with-response-header-filter-duplicate-adds.out.yaml +++ b/internal/gatewayapi/testdata/httproute-with-response-header-filter-duplicate-adds.out.yaml @@ -21,7 +21,7 @@ gateways: - group: gateway.networking.k8s.io kind: HTTPRoute - group: gateway.networking.k8s.io - kind: GRPCRoute + kind: GRPCRoute attachedRoutes: 1 conditions: - type: Programmed @@ -55,7 +55,7 @@ httpRoutes: filters: - type: ResponseHeaderModifier responseHeaderModifier: - set: + set: - name: "set-header-1" value: "some-value" - name: "set-header-2" diff --git a/internal/gatewayapi/testdata/httproute-with-response-header-filter-duplicate-remove-multiple-filters.out.yaml b/internal/gatewayapi/testdata/httproute-with-response-header-filter-duplicate-remove-multiple-filters.out.yaml index 843cff5f738..73426512f4f 100644 --- a/internal/gatewayapi/testdata/httproute-with-response-header-filter-duplicate-remove-multiple-filters.out.yaml +++ b/internal/gatewayapi/testdata/httproute-with-response-header-filter-duplicate-remove-multiple-filters.out.yaml @@ -21,7 +21,7 @@ gateways: - group: gateway.networking.k8s.io kind: HTTPRoute - group: gateway.networking.k8s.io - kind: GRPCRoute + kind: GRPCRoute attachedRoutes: 1 conditions: - type: Programmed diff --git a/internal/gatewayapi/testdata/httproute-with-response-header-filter-duplicate-removes.out.yaml b/internal/gatewayapi/testdata/httproute-with-response-header-filter-duplicate-removes.out.yaml index 4c1544ca474..4759b2fd253 100644 --- a/internal/gatewayapi/testdata/httproute-with-response-header-filter-duplicate-removes.out.yaml +++ b/internal/gatewayapi/testdata/httproute-with-response-header-filter-duplicate-removes.out.yaml @@ -21,7 +21,7 @@ gateways: - group: gateway.networking.k8s.io kind: HTTPRoute - group: gateway.networking.k8s.io - kind: GRPCRoute + kind: GRPCRoute attachedRoutes: 1 conditions: - type: Programmed diff --git a/internal/gatewayapi/testdata/httproute-with-response-header-filter-empty-header-values.in.yaml b/internal/gatewayapi/testdata/httproute-with-response-header-filter-empty-header-values.in.yaml index ce9a34f01fa..d6e1c760913 100644 --- a/internal/gatewayapi/testdata/httproute-with-response-header-filter-empty-header-values.in.yaml +++ b/internal/gatewayapi/testdata/httproute-with-response-header-filter-empty-header-values.in.yaml @@ -37,7 +37,7 @@ httpRoutes: filters: - type: ResponseHeaderModifier responseHeaderModifier: - set: + set: - name: "example-header-1" value: "" add: diff --git a/internal/gatewayapi/testdata/httproute-with-response-header-filter-empty-header-values.out.yaml b/internal/gatewayapi/testdata/httproute-with-response-header-filter-empty-header-values.out.yaml index ffcd8e2d082..6198030d85f 100644 --- a/internal/gatewayapi/testdata/httproute-with-response-header-filter-empty-header-values.out.yaml +++ b/internal/gatewayapi/testdata/httproute-with-response-header-filter-empty-header-values.out.yaml @@ -21,7 +21,7 @@ gateways: - group: gateway.networking.k8s.io kind: HTTPRoute - group: gateway.networking.k8s.io - kind: GRPCRoute + kind: GRPCRoute attachedRoutes: 1 conditions: - type: Programmed @@ -55,7 +55,7 @@ httpRoutes: filters: - type: ResponseHeaderModifier responseHeaderModifier: - set: + set: - name: "example-header-1" value: "" add: diff --git a/internal/gatewayapi/testdata/httproute-with-response-header-filter-empty-headers.in.yaml b/internal/gatewayapi/testdata/httproute-with-response-header-filter-empty-headers.in.yaml index dad660ec223..2eb722baea5 100644 --- a/internal/gatewayapi/testdata/httproute-with-response-header-filter-empty-headers.in.yaml +++ b/internal/gatewayapi/testdata/httproute-with-response-header-filter-empty-headers.in.yaml @@ -37,7 +37,7 @@ httpRoutes: filters: - type: ResponseHeaderModifier responseHeaderModifier: - set: + set: - name: "" value: "some-value" add: diff --git a/internal/gatewayapi/testdata/httproute-with-response-header-filter-empty-headers.out.yaml b/internal/gatewayapi/testdata/httproute-with-response-header-filter-empty-headers.out.yaml index efd7c77dbc2..1ba7e86a58d 100644 --- a/internal/gatewayapi/testdata/httproute-with-response-header-filter-empty-headers.out.yaml +++ b/internal/gatewayapi/testdata/httproute-with-response-header-filter-empty-headers.out.yaml @@ -21,8 +21,8 @@ gateways: - group: gateway.networking.k8s.io kind: HTTPRoute - group: gateway.networking.k8s.io - kind: GRPCRoute - attachedRoutes: 0 + kind: GRPCRoute + attachedRoutes: 0 conditions: - type: Programmed status: "True" @@ -55,7 +55,7 @@ httpRoutes: filters: - type: ResponseHeaderModifier responseHeaderModifier: - set: + set: - name: "" value: "some-value" add: diff --git a/internal/gatewayapi/testdata/httproute-with-response-header-filter-invalid-headers.in.yaml b/internal/gatewayapi/testdata/httproute-with-response-header-filter-invalid-headers.in.yaml index 511159ef07f..4c1a29d288e 100644 --- a/internal/gatewayapi/testdata/httproute-with-response-header-filter-invalid-headers.in.yaml +++ b/internal/gatewayapi/testdata/httproute-with-response-header-filter-invalid-headers.in.yaml @@ -37,7 +37,7 @@ httpRoutes: filters: - type: ResponseHeaderModifier responseHeaderModifier: - set: + set: - name: "example:1" value: "some-value" - name: "good-header" diff --git a/internal/gatewayapi/testdata/httproute-with-response-header-filter-invalid-headers.out.yaml b/internal/gatewayapi/testdata/httproute-with-response-header-filter-invalid-headers.out.yaml index 3c9372947cf..e4153edd085 100644 --- a/internal/gatewayapi/testdata/httproute-with-response-header-filter-invalid-headers.out.yaml +++ b/internal/gatewayapi/testdata/httproute-with-response-header-filter-invalid-headers.out.yaml @@ -21,8 +21,8 @@ gateways: - group: gateway.networking.k8s.io kind: HTTPRoute - group: gateway.networking.k8s.io - kind: GRPCRoute - attachedRoutes: 0 + kind: GRPCRoute + attachedRoutes: 0 conditions: - type: Programmed status: "True" @@ -55,7 +55,7 @@ httpRoutes: filters: - type: ResponseHeaderModifier responseHeaderModifier: - set: + set: - name: "example:1" value: "some-value" - name: "good-header" diff --git a/internal/gatewayapi/testdata/httproute-with-response-header-filter-no-headers.out.yaml b/internal/gatewayapi/testdata/httproute-with-response-header-filter-no-headers.out.yaml index 1a1a1c16d53..6203cc213cf 100644 --- a/internal/gatewayapi/testdata/httproute-with-response-header-filter-no-headers.out.yaml +++ b/internal/gatewayapi/testdata/httproute-with-response-header-filter-no-headers.out.yaml @@ -21,7 +21,7 @@ gateways: - group: gateway.networking.k8s.io kind: HTTPRoute - group: gateway.networking.k8s.io - kind: GRPCRoute + kind: GRPCRoute attachedRoutes: 1 conditions: - type: Programmed diff --git a/internal/gatewayapi/testdata/httproute-with-response-header-filter-no-valid-headers.out.yaml b/internal/gatewayapi/testdata/httproute-with-response-header-filter-no-valid-headers.out.yaml index 4cb70836604..93388811dfa 100644 --- a/internal/gatewayapi/testdata/httproute-with-response-header-filter-no-valid-headers.out.yaml +++ b/internal/gatewayapi/testdata/httproute-with-response-header-filter-no-valid-headers.out.yaml @@ -21,8 +21,8 @@ gateways: - group: gateway.networking.k8s.io kind: HTTPRoute - group: gateway.networking.k8s.io - kind: GRPCRoute - attachedRoutes: 0 + kind: GRPCRoute + attachedRoutes: 0 conditions: - type: Programmed status: "True" diff --git a/internal/gatewayapi/testdata/httproute-with-response-header-filter-remove.out.yaml b/internal/gatewayapi/testdata/httproute-with-response-header-filter-remove.out.yaml index 25ec34294d4..e1150d5b4a5 100644 --- a/internal/gatewayapi/testdata/httproute-with-response-header-filter-remove.out.yaml +++ b/internal/gatewayapi/testdata/httproute-with-response-header-filter-remove.out.yaml @@ -21,7 +21,7 @@ gateways: - group: gateway.networking.k8s.io kind: HTTPRoute - group: gateway.networking.k8s.io - kind: GRPCRoute + kind: GRPCRoute attachedRoutes: 1 conditions: - type: Programmed diff --git a/internal/gatewayapi/testdata/httproute-with-some-invalid-backend-refs-no-service.out.yaml b/internal/gatewayapi/testdata/httproute-with-some-invalid-backend-refs-no-service.out.yaml index cfa17ed498c..4802122b00f 100644 --- a/internal/gatewayapi/testdata/httproute-with-some-invalid-backend-refs-no-service.out.yaml +++ b/internal/gatewayapi/testdata/httproute-with-some-invalid-backend-refs-no-service.out.yaml @@ -20,7 +20,7 @@ gateways: - group: gateway.networking.k8s.io kind: HTTPRoute - group: gateway.networking.k8s.io - kind: GRPCRoute + kind: GRPCRoute attachedRoutes: 1 conditions: - type: Programmed @@ -83,7 +83,7 @@ xdsIR: - name: default-httproute-1-rule-0-match-0-* pathMatch: exact: "/exact" - backendWeights: + backendWeights: invalid: 2 # The weighted clusters for invalid backend refs aren't part of the IR valid: 1 destinations: diff --git a/internal/gatewayapi/testdata/httproute-with-sourceip-ratelimit.in.yaml b/internal/gatewayapi/testdata/httproute-with-sourceip-ratelimit.in.yaml index caf6d64a9f3..7046b141e08 100644 --- a/internal/gatewayapi/testdata/httproute-with-sourceip-ratelimit.in.yaml +++ b/internal/gatewayapi/testdata/httproute-with-sourceip-ratelimit.in.yaml @@ -50,7 +50,7 @@ rateLimitFilters: type: Global global: rules: - - clientSelectors: + - clientSelectors: - sourceIP: 192.168.0.0/16 limit: requests: 10 diff --git a/internal/gatewayapi/testdata/httproute-with-sourceip-ratelimit.out.yaml b/internal/gatewayapi/testdata/httproute-with-sourceip-ratelimit.out.yaml index 98cd7091cb0..20b376167f0 100644 --- a/internal/gatewayapi/testdata/httproute-with-sourceip-ratelimit.out.yaml +++ b/internal/gatewayapi/testdata/httproute-with-sourceip-ratelimit.out.yaml @@ -98,7 +98,7 @@ xdsIR: - cidrMatch: cidr: "192.168.0.0/16" maskLen: 16 - headerMatches: [] + headerMatches: [] limit: requests: 10 unit: Hour diff --git a/internal/gatewayapi/testdata/httproute-with-urlrewrite-filter-invalid-filter-type.out.yaml b/internal/gatewayapi/testdata/httproute-with-urlrewrite-filter-invalid-filter-type.out.yaml index b1b950c637b..8a0e71afb37 100644 --- a/internal/gatewayapi/testdata/httproute-with-urlrewrite-filter-invalid-filter-type.out.yaml +++ b/internal/gatewayapi/testdata/httproute-with-urlrewrite-filter-invalid-filter-type.out.yaml @@ -21,7 +21,7 @@ gateways: - group: gateway.networking.k8s.io kind: HTTPRoute - group: gateway.networking.k8s.io - kind: GRPCRoute + kind: GRPCRoute attachedRoutes: 1 conditions: - type: Programmed diff --git a/internal/gatewayapi/testdata/httproute-with-urlrewrite-filter-invalid-hostname.out.yaml b/internal/gatewayapi/testdata/httproute-with-urlrewrite-filter-invalid-hostname.out.yaml index b6f2e16db8e..efbcfb868d1 100644 --- a/internal/gatewayapi/testdata/httproute-with-urlrewrite-filter-invalid-hostname.out.yaml +++ b/internal/gatewayapi/testdata/httproute-with-urlrewrite-filter-invalid-hostname.out.yaml @@ -22,7 +22,7 @@ gateways: kind: HTTPRoute - group: gateway.networking.k8s.io kind: GRPCRoute - attachedRoutes: 0 + attachedRoutes: 0 conditions: - type: Programmed status: "True" diff --git a/internal/gatewayapi/testdata/httproute-with-urlrewrite-filter-invalid-multiple-filters.out.yaml b/internal/gatewayapi/testdata/httproute-with-urlrewrite-filter-invalid-multiple-filters.out.yaml index 2344b7b4f64..cbc85a5bec8 100644 --- a/internal/gatewayapi/testdata/httproute-with-urlrewrite-filter-invalid-multiple-filters.out.yaml +++ b/internal/gatewayapi/testdata/httproute-with-urlrewrite-filter-invalid-multiple-filters.out.yaml @@ -22,7 +22,7 @@ gateways: kind: HTTPRoute - group: gateway.networking.k8s.io kind: GRPCRoute - attachedRoutes: 0 + attachedRoutes: 0 conditions: - type: Programmed status: "True" diff --git a/internal/gatewayapi/testdata/httproute-with-urlrewrite-filter-invalid-path-type.out.yaml b/internal/gatewayapi/testdata/httproute-with-urlrewrite-filter-invalid-path-type.out.yaml index 290957aea2a..8a6ede0a66b 100644 --- a/internal/gatewayapi/testdata/httproute-with-urlrewrite-filter-invalid-path-type.out.yaml +++ b/internal/gatewayapi/testdata/httproute-with-urlrewrite-filter-invalid-path-type.out.yaml @@ -22,7 +22,7 @@ gateways: kind: HTTPRoute - group: gateway.networking.k8s.io kind: GRPCRoute - attachedRoutes: 0 + attachedRoutes: 0 conditions: - type: Programmed status: "True" diff --git a/internal/gatewayapi/testdata/httproute-with-urlrewrite-filter-invalid-path.out.yaml b/internal/gatewayapi/testdata/httproute-with-urlrewrite-filter-invalid-path.out.yaml index a79014f7b28..52eb9ee2e29 100644 --- a/internal/gatewayapi/testdata/httproute-with-urlrewrite-filter-invalid-path.out.yaml +++ b/internal/gatewayapi/testdata/httproute-with-urlrewrite-filter-invalid-path.out.yaml @@ -22,7 +22,7 @@ gateways: kind: HTTPRoute - group: gateway.networking.k8s.io kind: GRPCRoute - attachedRoutes: 0 + attachedRoutes: 0 conditions: - type: Programmed status: "True" diff --git a/internal/gatewayapi/testdata/httproute-with-urlrewrite-filter-missing-path.out.yaml b/internal/gatewayapi/testdata/httproute-with-urlrewrite-filter-missing-path.out.yaml index 275e8a62a51..f3f718574d0 100644 --- a/internal/gatewayapi/testdata/httproute-with-urlrewrite-filter-missing-path.out.yaml +++ b/internal/gatewayapi/testdata/httproute-with-urlrewrite-filter-missing-path.out.yaml @@ -22,7 +22,7 @@ gateways: kind: HTTPRoute - group: gateway.networking.k8s.io kind: GRPCRoute - attachedRoutes: 0 + attachedRoutes: 0 conditions: - type: Programmed status: "True" diff --git a/internal/gatewayapi/testdata/httproutes-with-multiple-matches.out.yaml b/internal/gatewayapi/testdata/httproutes-with-multiple-matches.out.yaml index 818a11616d2..9186ca86c60 100644 --- a/internal/gatewayapi/testdata/httproutes-with-multiple-matches.out.yaml +++ b/internal/gatewayapi/testdata/httproutes-with-multiple-matches.out.yaml @@ -20,7 +20,7 @@ gateways: - group: gateway.networking.k8s.io kind: HTTPRoute - group: gateway.networking.k8s.io - kind: GRPCRoute + kind: GRPCRoute attachedRoutes: 5 conditions: - type: Programmed diff --git a/internal/gatewayapi/testdata/tlsroute-multiple.out.yaml b/internal/gatewayapi/testdata/tlsroute-multiple.out.yaml index 72872be212b..e449cfafca9 100644 --- a/internal/gatewayapi/testdata/tlsroute-multiple.out.yaml +++ b/internal/gatewayapi/testdata/tlsroute-multiple.out.yaml @@ -21,7 +21,7 @@ gateways: supportedKinds: - group: gateway.networking.k8s.io kind: TLSRoute - attachedRoutes: 2 + attachedRoutes: 2 conditions: - type: Programmed status: "True" @@ -119,7 +119,7 @@ xdsIR: destinations: - host: 7.7.7.7 port: 8080 - weight: 1 + weight: 1 infraIR: envoy-gateway-gateway-1: proxy: diff --git a/internal/xds/translator/testdata/in/extension-xds-ir/http-route.yaml b/internal/xds/translator/testdata/in/extension-xds-ir/http-route.yaml index dea29d39d06..449f0571f36 100644 --- a/internal/xds/translator/testdata/in/extension-xds-ir/http-route.yaml +++ b/internal/xds/translator/testdata/in/extension-xds-ir/http-route.yaml @@ -10,9 +10,9 @@ http: - name: user stringMatch: exact: "jason" - - name: test + - name: test stringMatch: - suffix: "end" + suffix: "end" queryParamMatches: - name: "debug" exact: "yes" diff --git a/internal/xds/translator/testdata/in/ratelimit-config/distinct-match.yaml b/internal/xds/translator/testdata/in/ratelimit-config/distinct-match.yaml index 109b76ce920..461405e3132 100644 --- a/internal/xds/translator/testdata/in/ratelimit-config/distinct-match.yaml +++ b/internal/xds/translator/testdata/in/ratelimit-config/distinct-match.yaml @@ -18,4 +18,4 @@ routes: exact: "foo/bar" destinations: - host: "1.2.3.4" - port: 50000 + port: 50000 diff --git a/internal/xds/translator/testdata/in/ratelimit-config/distinct-remote-address-match.yaml b/internal/xds/translator/testdata/in/ratelimit-config/distinct-remote-address-match.yaml index b74f7504450..126423fac1f 100644 --- a/internal/xds/translator/testdata/in/ratelimit-config/distinct-remote-address-match.yaml +++ b/internal/xds/translator/testdata/in/ratelimit-config/distinct-remote-address-match.yaml @@ -20,4 +20,4 @@ routes: exact: "foo/bar" destinations: - host: "1.2.3.4" - port: 50000 + port: 50000 diff --git a/internal/xds/translator/testdata/in/ratelimit-config/empty-header-matches.yaml b/internal/xds/translator/testdata/in/ratelimit-config/empty-header-matches.yaml index 5e7faec8b6c..de53be9737f 100644 --- a/internal/xds/translator/testdata/in/ratelimit-config/empty-header-matches.yaml +++ b/internal/xds/translator/testdata/in/ratelimit-config/empty-header-matches.yaml @@ -15,4 +15,4 @@ routes: exact: "foo/bar" destinations: - host: "1.2.3.4" - port: 50000 + port: 50000 diff --git a/internal/xds/translator/testdata/in/ratelimit-config/masked-remote-address-match.yaml b/internal/xds/translator/testdata/in/ratelimit-config/masked-remote-address-match.yaml index 1891126cd58..0cfe65b6224 100644 --- a/internal/xds/translator/testdata/in/ratelimit-config/masked-remote-address-match.yaml +++ b/internal/xds/translator/testdata/in/ratelimit-config/masked-remote-address-match.yaml @@ -19,4 +19,4 @@ routes: exact: "foo/bar" destinations: - host: "1.2.3.4" - port: 50000 + port: 50000 diff --git a/internal/xds/translator/testdata/in/ratelimit-config/multiple-matches.yaml b/internal/xds/translator/testdata/in/ratelimit-config/multiple-matches.yaml index fc0ec0f7483..14ff04aad25 100644 --- a/internal/xds/translator/testdata/in/ratelimit-config/multiple-matches.yaml +++ b/internal/xds/translator/testdata/in/ratelimit-config/multiple-matches.yaml @@ -12,7 +12,7 @@ routes: - name: "x-user-id" exact: "one" - name: "x-user-id" - exact: "two" + exact: "two" limit: requests: 5 unit: second @@ -20,4 +20,4 @@ routes: exact: "foo/bar" destinations: - host: "1.2.3.4" - port: 50000 + port: 50000 diff --git a/internal/xds/translator/testdata/in/ratelimit-config/multiple-routes.yaml b/internal/xds/translator/testdata/in/ratelimit-config/multiple-routes.yaml index a158cb7d9fa..761e936ac7b 100644 --- a/internal/xds/translator/testdata/in/ratelimit-config/multiple-routes.yaml +++ b/internal/xds/translator/testdata/in/ratelimit-config/multiple-routes.yaml @@ -30,4 +30,4 @@ routes: exact: "foo/bar" destinations: - host: "1.2.3.4" - port: 50000 + port: 50000 diff --git a/internal/xds/translator/testdata/in/ratelimit-config/multiple-rules.yaml b/internal/xds/translator/testdata/in/ratelimit-config/multiple-rules.yaml index 42b297f2662..9cfe4156caf 100644 --- a/internal/xds/translator/testdata/in/ratelimit-config/multiple-rules.yaml +++ b/internal/xds/translator/testdata/in/ratelimit-config/multiple-rules.yaml @@ -18,10 +18,10 @@ routes: - name: "x-user-id" exact: "two" limit: - requests: 10 - unit: second + requests: 10 + unit: second pathMatch: exact: "foo/bar" destinations: - host: "1.2.3.4" - port: 50000 + port: 50000 diff --git a/internal/xds/translator/testdata/in/ratelimit-config/value-match.yaml b/internal/xds/translator/testdata/in/ratelimit-config/value-match.yaml index 1a3b847bf11..018b78a2190 100644 --- a/internal/xds/translator/testdata/in/ratelimit-config/value-match.yaml +++ b/internal/xds/translator/testdata/in/ratelimit-config/value-match.yaml @@ -18,4 +18,4 @@ routes: exact: "foo/bar" destinations: - host: "1.2.3.4" - port: 50000 + port: 50000 diff --git a/internal/xds/translator/testdata/in/xds-ir/accesslog.yaml b/internal/xds/translator/testdata/in/xds-ir/accesslog.yaml index 4740ddc8e75..3fe85c2f389 100644 --- a/internal/xds/translator/testdata/in/xds-ir/accesslog.yaml +++ b/internal/xds/translator/testdata/in/xds-ir/accesslog.yaml @@ -28,7 +28,7 @@ http: hostnames: - "*" routes: - - name: "direct-route" + - name: "direct-route" destinations: - host: "1.2.3.4" port: 50000 diff --git a/internal/xds/translator/testdata/in/xds-ir/http-route-direct-response.yaml b/internal/xds/translator/testdata/in/xds-ir/http-route-direct-response.yaml index ffedf91b990..12ff0b778e6 100644 --- a/internal/xds/translator/testdata/in/xds-ir/http-route-direct-response.yaml +++ b/internal/xds/translator/testdata/in/xds-ir/http-route-direct-response.yaml @@ -6,7 +6,7 @@ http: hostnames: - "*" routes: - - name: "direct-route" + - name: "direct-route" destinations: - host: "1.2.3.4" port: 50000 diff --git a/internal/xds/translator/testdata/in/xds-ir/http-route-mirror.yaml b/internal/xds/translator/testdata/in/xds-ir/http-route-mirror.yaml index b79f54030ca..936b690bf05 100644 --- a/internal/xds/translator/testdata/in/xds-ir/http-route-mirror.yaml +++ b/internal/xds/translator/testdata/in/xds-ir/http-route-mirror.yaml @@ -6,7 +6,7 @@ http: hostnames: - "*" routes: - - name: "mirror-route" + - name: "mirror-route" destinations: - host: "1.2.3.4" port: 50000 diff --git a/internal/xds/translator/testdata/in/xds-ir/http-route-redirect.yaml b/internal/xds/translator/testdata/in/xds-ir/http-route-redirect.yaml index 74c19ceb63c..96e87f7c621 100644 --- a/internal/xds/translator/testdata/in/xds-ir/http-route-redirect.yaml +++ b/internal/xds/translator/testdata/in/xds-ir/http-route-redirect.yaml @@ -6,7 +6,7 @@ http: hostnames: - "*" routes: - - name: "redirect-route" + - name: "redirect-route" destinations: - host: "1.2.3.4" port: 50000 diff --git a/internal/xds/translator/testdata/in/xds-ir/http-route-request-headers.yaml b/internal/xds/translator/testdata/in/xds-ir/http-route-request-headers.yaml index 1561b7adc62..a75f97fa9b9 100644 --- a/internal/xds/translator/testdata/in/xds-ir/http-route-request-headers.yaml +++ b/internal/xds/translator/testdata/in/xds-ir/http-route-request-headers.yaml @@ -6,7 +6,7 @@ http: hostnames: - "*" routes: - - name: "request-header-route" + - name: "request-header-route" destinations: - host: "1.2.3.4" port: 50000 diff --git a/internal/xds/translator/testdata/in/xds-ir/http-route-response-add-headers.yaml b/internal/xds/translator/testdata/in/xds-ir/http-route-response-add-headers.yaml index d4b7fba7c9b..3cafd43593c 100644 --- a/internal/xds/translator/testdata/in/xds-ir/http-route-response-add-headers.yaml +++ b/internal/xds/translator/testdata/in/xds-ir/http-route-response-add-headers.yaml @@ -6,7 +6,7 @@ http: hostnames: - "*" routes: - - name: "response-header-route" + - name: "response-header-route" destinations: - host: "1.2.3.4" port: 50000 diff --git a/internal/xds/translator/testdata/in/xds-ir/http-route-response-add-remove-headers.yaml b/internal/xds/translator/testdata/in/xds-ir/http-route-response-add-remove-headers.yaml index 33629740a4c..01b888594ff 100644 --- a/internal/xds/translator/testdata/in/xds-ir/http-route-response-add-remove-headers.yaml +++ b/internal/xds/translator/testdata/in/xds-ir/http-route-response-add-remove-headers.yaml @@ -6,7 +6,7 @@ http: hostnames: - "*" routes: - - name: "response-header-route" + - name: "response-header-route" destinations: - host: "1.2.3.4" port: 50000 diff --git a/internal/xds/translator/testdata/in/xds-ir/http-route-response-remove-headers.yaml b/internal/xds/translator/testdata/in/xds-ir/http-route-response-remove-headers.yaml index 49fb464caaf..f9fc78e32f3 100644 --- a/internal/xds/translator/testdata/in/xds-ir/http-route-response-remove-headers.yaml +++ b/internal/xds/translator/testdata/in/xds-ir/http-route-response-remove-headers.yaml @@ -6,7 +6,7 @@ http: hostnames: - "*" routes: - - name: "response-header-route" + - name: "response-header-route" destinations: - host: "1.2.3.4" port: 50000 diff --git a/internal/xds/translator/testdata/in/xds-ir/http-route-rewrite-url-fullpath.yaml b/internal/xds/translator/testdata/in/xds-ir/http-route-rewrite-url-fullpath.yaml index 32c9114460c..21a05fcbefd 100644 --- a/internal/xds/translator/testdata/in/xds-ir/http-route-rewrite-url-fullpath.yaml +++ b/internal/xds/translator/testdata/in/xds-ir/http-route-rewrite-url-fullpath.yaml @@ -6,7 +6,7 @@ http: hostnames: - "*" routes: - - name: "rewrite-route" + - name: "rewrite-route" pathMatch: prefix: "/origin" headerMatches: diff --git a/internal/xds/translator/testdata/in/xds-ir/http-route-rewrite-url-host.yaml b/internal/xds/translator/testdata/in/xds-ir/http-route-rewrite-url-host.yaml index c63d100436d..1c6af60e7fd 100644 --- a/internal/xds/translator/testdata/in/xds-ir/http-route-rewrite-url-host.yaml +++ b/internal/xds/translator/testdata/in/xds-ir/http-route-rewrite-url-host.yaml @@ -6,7 +6,7 @@ http: hostnames: - "*" routes: - - name: "rewrite-route" + - name: "rewrite-route" pathMatch: prefix: "/origin" headerMatches: diff --git a/internal/xds/translator/testdata/in/xds-ir/http-route-weighted-backend.yaml b/internal/xds/translator/testdata/in/xds-ir/http-route-weighted-backend.yaml index e6d314d1f5e..ed038fb0874 100644 --- a/internal/xds/translator/testdata/in/xds-ir/http-route-weighted-backend.yaml +++ b/internal/xds/translator/testdata/in/xds-ir/http-route-weighted-backend.yaml @@ -5,7 +5,7 @@ http: hostnames: - "*" routes: - - name: "first-route" + - name: "first-route" destinations: - host: "1.1.1.1" port: 50001 diff --git a/internal/xds/translator/testdata/in/xds-ir/http-route-weighted-invalid-backend.yaml b/internal/xds/translator/testdata/in/xds-ir/http-route-weighted-invalid-backend.yaml index b0ee0913f36..fde9aa76907 100644 --- a/internal/xds/translator/testdata/in/xds-ir/http-route-weighted-invalid-backend.yaml +++ b/internal/xds/translator/testdata/in/xds-ir/http-route-weighted-invalid-backend.yaml @@ -5,10 +5,10 @@ http: hostnames: - "*" routes: - - name: "first-route" + - name: "first-route" destinations: - host: "1.2.3.4" port: 50000 - backendWeights: + backendWeights: invalid: 1 valid: 1 diff --git a/internal/xds/translator/testdata/in/xds-ir/http-route.yaml b/internal/xds/translator/testdata/in/xds-ir/http-route.yaml index dea29d39d06..449f0571f36 100644 --- a/internal/xds/translator/testdata/in/xds-ir/http-route.yaml +++ b/internal/xds/translator/testdata/in/xds-ir/http-route.yaml @@ -10,9 +10,9 @@ http: - name: user stringMatch: exact: "jason" - - name: test + - name: test stringMatch: - suffix: "end" + suffix: "end" queryParamMatches: - name: "debug" exact: "yes" diff --git a/internal/xds/translator/testdata/in/xds-ir/http2-route.yaml b/internal/xds/translator/testdata/in/xds-ir/http2-route.yaml index 131d775c9bf..ff2282adb59 100644 --- a/internal/xds/translator/testdata/in/xds-ir/http2-route.yaml +++ b/internal/xds/translator/testdata/in/xds-ir/http2-route.yaml @@ -4,7 +4,7 @@ http: port: 10080 hostnames: - "*" - isHTTP2: true + isHTTP2: true routes: - name: "first-route" pathMatch: diff --git a/internal/xds/translator/testdata/in/xds-ir/multiple-listeners-same-port.yaml b/internal/xds/translator/testdata/in/xds-ir/multiple-listeners-same-port.yaml index 746c06db4b1..320dccaacf3 100644 --- a/internal/xds/translator/testdata/in/xds-ir/multiple-listeners-same-port.yaml +++ b/internal/xds/translator/testdata/in/xds-ir/multiple-listeners-same-port.yaml @@ -11,7 +11,7 @@ http: # byte slice representation of "key-data" privateKey: [107, 101, 121, 45, 100, 97, 116, 97] routes: - - name: "first-route" + - name: "first-route" destinations: - host: "1.2.3.4" port: 50000 @@ -27,7 +27,7 @@ http: # byte slice representation of "key-data" privateKey: [107, 101, 121, 45, 100, 97, 116, 97] routes: - - name: "second-route" + - name: "second-route" destinations: - host: "1.2.3.4" port: 50000 @@ -37,7 +37,7 @@ http: hostnames: - "example.com" routes: - - name: "third-route" + - name: "third-route" destinations: - host: "1.2.3.4" port: 50000 @@ -47,7 +47,7 @@ http: hostnames: - "example.net" routes: - - name: "fourth-route" + - name: "fourth-route" destinations: - host: "1.2.3.4" port: 50000 diff --git a/internal/xds/translator/testdata/in/xds-ir/ratelimit-custom-domain.yaml b/internal/xds/translator/testdata/in/xds-ir/ratelimit-custom-domain.yaml index 4bdfb033cd0..c9c17210220 100644 --- a/internal/xds/translator/testdata/in/xds-ir/ratelimit-custom-domain.yaml +++ b/internal/xds/translator/testdata/in/xds-ir/ratelimit-custom-domain.yaml @@ -19,7 +19,7 @@ http: exact: "foo/bar" destinations: - host: "1.2.3.4" - port: 50000 + port: 50000 - name: "second-route" rateLimit: global: @@ -34,7 +34,7 @@ http: exact: "example" destinations: - host: "1.2.3.4" - port: 50000 + port: 50000 - name: "third-route" rateLimit: global: diff --git a/internal/xds/translator/testdata/in/xds-ir/ratelimit-sourceip.yaml b/internal/xds/translator/testdata/in/xds-ir/ratelimit-sourceip.yaml index 0ced52fd98c..ef7602d291d 100644 --- a/internal/xds/translator/testdata/in/xds-ir/ratelimit-sourceip.yaml +++ b/internal/xds/translator/testdata/in/xds-ir/ratelimit-sourceip.yaml @@ -19,7 +19,7 @@ http: exact: "foo/bar" destinations: - host: "1.2.3.4" - port: 50000 + port: 50000 - name: "second-route" rateLimit: global: @@ -34,7 +34,7 @@ http: exact: "example" destinations: - host: "1.2.3.4" - port: 50000 + port: 50000 - name: "third-route" rateLimit: global: diff --git a/internal/xds/translator/testdata/in/xds-ir/ratelimit.yaml b/internal/xds/translator/testdata/in/xds-ir/ratelimit.yaml index 4bdfb033cd0..c9c17210220 100644 --- a/internal/xds/translator/testdata/in/xds-ir/ratelimit.yaml +++ b/internal/xds/translator/testdata/in/xds-ir/ratelimit.yaml @@ -19,7 +19,7 @@ http: exact: "foo/bar" destinations: - host: "1.2.3.4" - port: 50000 + port: 50000 - name: "second-route" rateLimit: global: @@ -34,7 +34,7 @@ http: exact: "example" destinations: - host: "1.2.3.4" - port: 50000 + port: 50000 - name: "third-route" rateLimit: global: diff --git a/internal/xds/translator/testdata/in/xds-ir/simple-tls.yaml b/internal/xds/translator/testdata/in/xds-ir/simple-tls.yaml index 58e6970c8c8..38915b9046b 100644 --- a/internal/xds/translator/testdata/in/xds-ir/simple-tls.yaml +++ b/internal/xds/translator/testdata/in/xds-ir/simple-tls.yaml @@ -12,9 +12,9 @@ http: privateKey: [107, 101, 121, 45, 100, 97, 116, 97] - name: secret-2 serverCertificate: [99, 101, 114, 116, 45, 100, 97, 116, 97] - privateKey: [107, 101, 121, 45, 100, 97, 116, 97] + privateKey: [107, 101, 121, 45, 100, 97, 116, 97] routes: - - name: "first-route" + - name: "first-route" destinations: - host: "1.2.3.4" port: 50000 diff --git a/release-notes/v0.3.0-rc.1.yaml b/release-notes/v0.3.0-rc.1.yaml index 2182b05b65d..7cde6d6d67e 100644 --- a/release-notes/v0.3.0-rc.1.yaml +++ b/release-notes/v0.3.0-rc.1.yaml @@ -17,8 +17,8 @@ changes: Added Support for HTTPRoute URLRewrite Filter Added Support for HTTPRoute RequestMirror Filter Added Support for HTTPRoute ResponseHeaderModifier Filter - Added APIs to Manage Envoy Deployment - Added Support for Request Authentication + Added APIs to Manage Envoy Deployment + Added Support for Request Authentication Added Support for Global Rate Limiting Added Support for Routes ReferenceGrant Added Support for Namespace Server Config Type @@ -38,7 +38,7 @@ changes: Enabled GatewayInvalidRouteKind conformance test Enabled HTTPRoutePartiallyInvalidViaInvalidReferenceGrant conformance test Enabled HTTPRouteReferenceGrant conformance test - Enabled HTTPRouteMethodMatching conformance test + Enabled HTTPRouteMethodMatching conformance test - area: ir change: | @@ -56,9 +56,9 @@ changes: change: | Refactored Kubernetes Provider to Single Reconciler Upgraded Kube Provider Test Data Manifests to v0.6.0 - Removed Duplicate Settings from Bootstrap Config + Removed Duplicate Settings from Bootstrap Config Updated Certgen to Use EG Namespace Env - Added EnvoyProxy to Translator and Kube Infra Manager + Added EnvoyProxy to Translator and Kube Infra Manager Upgraded Envoyproxy Image to envoy-dev latest in Main Removed EG Logs Private Key diff --git a/release-notes/v0.3.0.yaml b/release-notes/v0.3.0.yaml index 384537c27a7..53a5d2c171b 100644 --- a/release-notes/v0.3.0.yaml +++ b/release-notes/v0.3.0.yaml @@ -28,7 +28,7 @@ changes: Added Support for HTTPRoute URLRewrite Filter Added Support for HTTPRoute RequestMirror Filter Added Support for HTTPRoute ResponseHeaderModifier Filter - Added Support for Request Authentication + Added Support for Request Authentication Added Support for Global Rate Limiting Added Support for Routes ReferenceGrant Added Support for Namespace Server Config Type @@ -69,9 +69,9 @@ changes: change: | Refactored Kubernetes Provider to Single Reconciler Upgraded Kube Provider Test Data Manifests to v0.6.1 - Removed Duplicate Settings from Bootstrap Config + Removed Duplicate Settings from Bootstrap Config Updated Certgen to Use EG Namespace Env - Added EnvoyProxy to Translator and Kube Infra Manager + Added EnvoyProxy to Translator and Kube Infra Manager Upgraded Envoyproxy Image to envoy-dev latest in Main Removed EG Logs Private Key diff --git a/release-notes/v0.4.0.yaml b/release-notes/v0.4.0.yaml index a4938621f97..d05676beaa2 100644 --- a/release-notes/v0.4.0.yaml +++ b/release-notes/v0.4.0.yaml @@ -24,7 +24,7 @@ changes: Envoy Proxy Pod and Container SecurityContext is now Configurable Added Custom Envoy Gateway Extensions Framework Added Support for Service Method Match in GRPCRoute - Fixed a Bug in the Extension Hooks for xDS Virtual Hosts and Routes + Fixed a Bug in the Extension Hooks for xDS Virtual Hosts and Routes - area: ci-tooling-testing change: | diff --git a/tools/linter/yamllint/.yamllint b/tools/linter/yamllint/.yamllint index 1d944440e84..9bafddf18f0 100644 --- a/tools/linter/yamllint/.yamllint +++ b/tools/linter/yamllint/.yamllint @@ -51,7 +51,7 @@ rules: new-line-at-end-of-file: enable new-lines: type: unix - trailing-spaces: disable + trailing-spaces: enable truthy: check-keys: false # GitHub Actions uses "on:" as a key level: warning From 5a3f925660a623df41bc586a4c2bb80f34015508 Mon Sep 17 00:00:00 2001 From: Arko Dasgupta Date: Tue, 27 Jun 2023 09:28:11 -0700 Subject: [PATCH 14/16] Fix `make conformance` on Mac (#1597) * Use `buildx` for all builds * Adds the `--load` flag to `docker buildx build` to save the image in the local image store. Signed-off-by: Arko Dasgupta --- tools/make/image.mk | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/make/image.mk b/tools/make/image.mk index 38d6075e51c..f3864a22963 100644 --- a/tools/make/image.mk +++ b/tools/make/image.mk @@ -4,7 +4,7 @@ include tools/make/env.mk -DOCKER := DOCKER_BUILDKIT=1 docker +DOCKER := docker DOCKER_SUPPORTED_API_VERSION ?= 1.32 # Determine image files by looking into build/docker/*/Dockerfile @@ -43,9 +43,9 @@ image.build.%: image.verify go.build.linux_$(GOARCH).% $(eval COMMAND := $(word 1,$(subst ., ,$*))) $(eval IMAGES := $(COMMAND)) @$(call log, "Building image $(IMAGES):$(TAG) in linux/$(GOARCH)") - $(eval BUILD_SUFFIX := --pull -t $(IMAGE):$(TAG) -f $(ROOT_DIR)/tools/docker/$(IMAGES)/Dockerfile bin) + $(eval BUILD_SUFFIX := --pull --load -t $(IMAGE):$(TAG) -f $(ROOT_DIR)/tools/docker/$(IMAGES)/Dockerfile bin) @$(call log, "Creating image tag $(REGISTRY)/$(IMAGES):$(TAG) in linux/$(GOARCH)") - $(DOCKER) build --platform linux/$(GOARCH) $(BUILD_SUFFIX) + $(DOCKER) buildx build --platform linux/$(GOARCH) $(BUILD_SUFFIX) .PHONY: image.push image.push: $(addprefix image.push., $(IMAGES)) From d83510c99e7cd53d035d025da199b8670b7736cc Mon Sep 17 00:00:00 2001 From: zirain Date: Wed, 28 Jun 2023 07:50:09 +0800 Subject: [PATCH 15/16] e2e: improve accesslog tests (#1599) Signed-off-by: hejianpeng --- .../{accesslog.yaml => accesslog-file.yaml} | 4 +- test/e2e/testdata/accesslog-otel.yaml | 16 +++++++ test/e2e/tests/accesslog.go | 46 +++++++------------ 3 files changed, 34 insertions(+), 32 deletions(-) rename test/e2e/testdata/{accesslog.yaml => accesslog-file.yaml} (85%) create mode 100644 test/e2e/testdata/accesslog-otel.yaml diff --git a/test/e2e/testdata/accesslog.yaml b/test/e2e/testdata/accesslog-file.yaml similarity index 85% rename from test/e2e/testdata/accesslog.yaml rename to test/e2e/testdata/accesslog-file.yaml index aafce06fcff..18d164fc608 100644 --- a/test/e2e/testdata/accesslog.yaml +++ b/test/e2e/testdata/accesslog-file.yaml @@ -1,7 +1,7 @@ apiVersion: gateway.networking.k8s.io/v1beta1 kind: HTTPRoute metadata: - name: http-infra-backend-v1 + name: accesslog-file namespace: gateway-conformance-infra spec: parentRefs: @@ -10,7 +10,7 @@ spec: - matches: - path: type: PathPrefix - value: / + value: /file backendRefs: - name: infra-backend-v1 port: 8080 diff --git a/test/e2e/testdata/accesslog-otel.yaml b/test/e2e/testdata/accesslog-otel.yaml new file mode 100644 index 00000000000..8f9e4924080 --- /dev/null +++ b/test/e2e/testdata/accesslog-otel.yaml @@ -0,0 +1,16 @@ +apiVersion: gateway.networking.k8s.io/v1beta1 +kind: HTTPRoute +metadata: + name: accesslog-otel + namespace: gateway-conformance-infra +spec: + parentRefs: + - name: same-namespace + rules: + - matches: + - path: + type: PathPrefix + value: /otel + backendRefs: + - name: infra-backend-v2 + port: 8080 diff --git a/test/e2e/tests/accesslog.go b/test/e2e/tests/accesslog.go index 4e51cd48b25..9efe5f0d619 100644 --- a/test/e2e/tests/accesslog.go +++ b/test/e2e/tests/accesslog.go @@ -35,24 +35,25 @@ func init() { var FileAccessLogTest = suite.ConformanceTest{ ShortName: "FileAccessLog", Description: "Make sure file access log is working", - Manifests: []string{"testdata/accesslog.yaml"}, + Manifests: []string{"testdata/accesslog-file.yaml"}, Test: func(t *testing.T, suite *suite.ConformanceTestSuite) { t.Run("Stdout", func(t *testing.T) { ns := "gateway-conformance-infra" - routeNN := types.NamespacedName{Name: "http-infra-backend-v1", Namespace: ns} + routeNN := types.NamespacedName{Name: "accesslog-file", Namespace: ns} gwNN := types.NamespacedName{Name: "same-namespace", Namespace: ns} gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), routeNN) - // make sure listener is ready - httputils.MakeRequestAndExpectEventuallyConsistentResponse(t, suite.RoundTripper, suite.TimeoutConfig, gwAddr, httputils.ExpectedResponse{ + expectedResponse := httputils.ExpectedResponse{ Request: httputils.Request{ - Path: "/", + Path: "/file", }, Response: httputils.Response{ StatusCode: 200, }, Namespace: ns, - }) + } + // make sure listener is ready + httputils.MakeRequestAndExpectEventuallyConsistentResponse(t, suite.RoundTripper, suite.TimeoutConfig, gwAddr, expectedResponse) labels := map[string]string{ "job": "fluentbit", @@ -90,15 +91,7 @@ var FileAccessLogTest = suite.ConformanceTest{ return false, nil } - httputils.MakeRequestAndExpectEventuallyConsistentResponse(t, suite.RoundTripper, suite.TimeoutConfig, gwAddr, httputils.ExpectedResponse{ - Request: httputils.Request{ - Path: "/", - }, - Response: httputils.Response{ - StatusCode: 200, - }, - Namespace: ns, - }) + httputils.MakeRequestAndExpectEventuallyConsistentResponse(t, suite.RoundTripper, suite.TimeoutConfig, gwAddr, expectedResponse) // it will take some time for fluent-bit to collect the log and send to loki // let's wait for a while @@ -133,24 +126,25 @@ var FileAccessLogTest = suite.ConformanceTest{ var OpenTelemetryTest = suite.ConformanceTest{ ShortName: "OpenTelemetryAccessLog", Description: "Make sure OpenTelemetry access log is working", - Manifests: []string{"testdata/accesslog.yaml"}, + Manifests: []string{"testdata/accesslog-otel.yaml"}, Test: func(t *testing.T, suite *suite.ConformanceTestSuite) { t.Run("OTel", func(t *testing.T) { ns := "gateway-conformance-infra" - routeNN := types.NamespacedName{Name: "http-infra-backend-v1", Namespace: ns} + routeNN := types.NamespacedName{Name: "accesslog-otel", Namespace: ns} gwNN := types.NamespacedName{Name: "same-namespace", Namespace: ns} gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), routeNN) - // make sure listener is ready - httputils.MakeRequestAndExpectEventuallyConsistentResponse(t, suite.RoundTripper, suite.TimeoutConfig, gwAddr, httputils.ExpectedResponse{ + expectedResponse := httputils.ExpectedResponse{ Request: httputils.Request{ - Path: "/", + Path: "/otel", }, Response: httputils.Response{ StatusCode: 200, }, Namespace: ns, - }) + } + // make sure listener is ready + httputils.MakeRequestAndExpectEventuallyConsistentResponse(t, suite.RoundTripper, suite.TimeoutConfig, gwAddr, expectedResponse) labels := map[string]string{ "k8s_namespace_name": "envoy-gateway-system", @@ -167,15 +161,7 @@ var OpenTelemetryTest = suite.ConformanceTest{ return false, nil } - httputils.MakeRequestAndExpectEventuallyConsistentResponse(t, suite.RoundTripper, suite.TimeoutConfig, gwAddr, httputils.ExpectedResponse{ - Request: httputils.Request{ - Path: "/", - }, - Response: httputils.Response{ - StatusCode: 200, - }, - Namespace: ns, - }) + httputils.MakeRequestAndExpectEventuallyConsistentResponse(t, suite.RoundTripper, suite.TimeoutConfig, gwAddr, expectedResponse) if err := wait.PollUntilContextTimeout(ctx, 500*time.Millisecond, 10*time.Second, true, func(_ context.Context) (bool, error) { count, err := QueryLogCountFromLoki(t, suite.Client, types.NamespacedName{ From f4252e6685a4378a9b2e75f802507711c464dfa6 Mon Sep 17 00:00:00 2001 From: zirain Date: Wed, 28 Jun 2023 09:02:42 +0800 Subject: [PATCH 16/16] lint: enable stylecheck (#1593) Signed-off-by: hejianpeng Co-authored-by: Arko Dasgupta --- api/config/v1alpha1/envoygateway_types.go | 4 ++-- api/config/v1alpha1/validate_test.go | 6 +++--- internal/envoygateway/config/config.go | 2 +- internal/gatewayapi/runner/runner.go | 2 +- internal/provider/kubernetes/controller_test.go | 5 ++--- internal/provider/kubernetes/routes_test.go | 3 +-- internal/xds/types/resourceversiontable.go | 3 +-- tools/linter/golangci-lint/.golangci.yml | 1 + 8 files changed, 12 insertions(+), 14 deletions(-) diff --git a/api/config/v1alpha1/envoygateway_types.go b/api/config/v1alpha1/envoygateway_types.go index 23590814702..d90cb3b929f 100644 --- a/api/config/v1alpha1/envoygateway_types.go +++ b/api/config/v1alpha1/envoygateway_types.go @@ -95,8 +95,8 @@ const ( // LogComponentProviderRunner defines the "provider" runner component. LogComponentProviderRunner EnvoyGatewayLogComponent = "provider" - // LogComponentGatewayApiRunner defines the "gateway-api" runner component. - LogComponentGatewayApiRunner EnvoyGatewayLogComponent = "gateway-api" + // LogComponentGatewayAPIRunner defines the "gateway-api" runner component. + LogComponentGatewayAPIRunner EnvoyGatewayLogComponent = "gateway-api" // LogComponentXdsTranslatorRunner defines the "xds-translator" runner component. LogComponentXdsTranslatorRunner EnvoyGatewayLogComponent = "xds-translator" diff --git a/api/config/v1alpha1/validate_test.go b/api/config/v1alpha1/validate_test.go index 45ea1737bd3..4980fcf0937 100644 --- a/api/config/v1alpha1/validate_test.go +++ b/api/config/v1alpha1/validate_test.go @@ -284,17 +284,17 @@ func TestDefaultEnvoyGatewayLoggingLevel(t *testing.T) { }, { name: "test gateway-api error level for error level", - args: args{component: string(LogComponentGatewayApiRunner), level: LogLevelError}, + args: args{component: string(LogComponentGatewayAPIRunner), level: LogLevelError}, want: LogLevelError, }, { name: "test gateway-api info level for info level", - args: args{component: string(LogComponentGatewayApiRunner), level: LogLevelInfo}, + args: args{component: string(LogComponentGatewayAPIRunner), level: LogLevelInfo}, want: LogLevelInfo, }, { name: "test default gateway-api warn level for info level", - args: args{component: string(LogComponentGatewayApiRunner), level: ""}, + args: args{component: string(LogComponentGatewayAPIRunner), level: ""}, want: LogLevelInfo, }, } diff --git a/internal/envoygateway/config/config.go b/internal/envoygateway/config/config.go index 177103416a6..4aaa0c59328 100644 --- a/internal/envoygateway/config/config.go +++ b/internal/envoygateway/config/config.go @@ -75,7 +75,7 @@ func (s *Server) Validate() error { switch component { case v1alpha1.LogComponentGatewayDefault, v1alpha1.LogComponentProviderRunner, - v1alpha1.LogComponentGatewayApiRunner, + v1alpha1.LogComponentGatewayAPIRunner, v1alpha1.LogComponentXdsTranslatorRunner, v1alpha1.LogComponentXdsServerRunner, v1alpha1.LogComponentInfrastructureRunner, diff --git a/internal/gatewayapi/runner/runner.go b/internal/gatewayapi/runner/runner.go index 51d374826bd..45d5d3a578e 100644 --- a/internal/gatewayapi/runner/runner.go +++ b/internal/gatewayapi/runner/runner.go @@ -37,7 +37,7 @@ func New(cfg *Config) *Runner { } func (r *Runner) Name() string { - return string(v1alpha1.LogComponentGatewayApiRunner) + return string(v1alpha1.LogComponentGatewayAPIRunner) } // Start starts the gateway-api translator runner diff --git a/internal/provider/kubernetes/controller_test.go b/internal/provider/kubernetes/controller_test.go index e1ffacd67f6..840e80d5dcf 100644 --- a/internal/provider/kubernetes/controller_test.go +++ b/internal/provider/kubernetes/controller_test.go @@ -17,7 +17,6 @@ import ( "sigs.k8s.io/controller-runtime/pkg/reconcile" gwapiv1b1 "sigs.k8s.io/gateway-api/apis/v1beta1" - "github.com/envoyproxy/gateway/api/config/v1alpha1" egcfgv1a1 "github.com/envoyproxy/gateway/api/config/v1alpha1" "github.com/envoyproxy/gateway/internal/envoygateway" "github.com/envoyproxy/gateway/internal/envoygateway/config" @@ -318,7 +317,7 @@ func TestEnqueueManagedClass(t *testing.T) { tc := testCases[i] // Create the reconciler. - logger := logging.DefaultLogger(v1alpha1.LogLevelInfo) + logger := logging.DefaultLogger(egcfgv1a1.LogLevelInfo) r := &gatewayAPIReconciler{ log: logger, classController: gcCtrlName, @@ -451,7 +450,7 @@ func TestProcessParamsRef(t *testing.T) { tc := testCases[i] // Create the reconciler. - logger := logging.DefaultLogger(v1alpha1.LogLevelInfo) + logger := logging.DefaultLogger(egcfgv1a1.LogLevelInfo) r := &gatewayAPIReconciler{ log: logger, diff --git a/internal/provider/kubernetes/routes_test.go b/internal/provider/kubernetes/routes_test.go index 1420a28b277..d6515946298 100644 --- a/internal/provider/kubernetes/routes_test.go +++ b/internal/provider/kubernetes/routes_test.go @@ -20,7 +20,6 @@ import ( fakeclient "sigs.k8s.io/controller-runtime/pkg/client/fake" gwapiv1b1 "sigs.k8s.io/gateway-api/apis/v1beta1" - "github.com/envoyproxy/gateway/api/config/v1alpha1" cfgv1a1 "github.com/envoyproxy/gateway/api/config/v1alpha1" egv1a1 "github.com/envoyproxy/gateway/api/v1alpha1" "github.com/envoyproxy/gateway/internal/envoygateway" @@ -478,7 +477,7 @@ func TestProcessHTTPRoutes(t *testing.T) { objs := []client.Object{gc, gw} // Create the reconciler. - logger := logging.DefaultLogger(v1alpha1.LogLevelInfo) + logger := logging.DefaultLogger(cfgv1a1.LogLevelInfo) ctx := context.Background() diff --git a/internal/xds/types/resourceversiontable.go b/internal/xds/types/resourceversiontable.go index ae388b52d1c..ec080e28555 100644 --- a/internal/xds/types/resourceversiontable.go +++ b/internal/xds/types/resourceversiontable.go @@ -7,7 +7,6 @@ package types import ( "github.com/envoyproxy/go-control-plane/pkg/cache/types" - "github.com/envoyproxy/go-control-plane/pkg/resource/v3" resourcev3 "github.com/envoyproxy/go-control-plane/pkg/resource/v3" "google.golang.org/protobuf/proto" ) @@ -78,7 +77,7 @@ func (t *ResourceVersionTable) AddXdsResource(rType resourcev3.Type, xdsResource // AddOrReplaceXdsResource will update an existing resource of rType according to matchFunc or add as a new resource // if none satisfy the match criteria. It will only update the first match it finds, regardless // if multiple resources satisfy the match criteria. -func (t *ResourceVersionTable) AddOrReplaceXdsResource(rType resource.Type, resource types.Resource, matchFunc func(existing types.Resource, new types.Resource) bool) { +func (t *ResourceVersionTable) AddOrReplaceXdsResource(rType resourcev3.Type, resource types.Resource, matchFunc func(existing types.Resource, new types.Resource) bool) { if t.XdsResources == nil || t.XdsResources[rType] == nil { t.AddXdsResource(rType, resource) return diff --git a/tools/linter/golangci-lint/.golangci.yml b/tools/linter/golangci-lint/.golangci.yml index 0e097034fa1..ac65207238c 100644 --- a/tools/linter/golangci-lint/.golangci.yml +++ b/tools/linter/golangci-lint/.golangci.yml @@ -3,6 +3,7 @@ run: linters: enable: + - stylecheck - bodyclose - depguard - exportloopref