diff --git a/go.mod b/go.mod index da76ac5031a..6b4b26434d5 100644 --- a/go.mod +++ b/go.mod @@ -47,7 +47,7 @@ require ( knative.dev/hack v0.0.0-20230712131415-ddae80293c43 knative.dev/hack/schema v0.0.0-20230712131415-ddae80293c43 knative.dev/pkg v0.0.0-20230718152110-aef227e72ead - knative.dev/reconciler-test v0.0.0-20230726074640-26cee79ad63d + knative.dev/reconciler-test v0.0.0-20230817082142-9e58415bcb84 sigs.k8s.io/yaml v1.3.0 ) diff --git a/go.sum b/go.sum index 23922671fc0..2be5f00e1cd 100644 --- a/go.sum +++ b/go.sum @@ -936,8 +936,10 @@ knative.dev/hack/schema v0.0.0-20230712131415-ddae80293c43 h1:FqKKg9cUKc2I9bw27f knative.dev/hack/schema v0.0.0-20230712131415-ddae80293c43/go.mod h1:GeIb+PLd5mllawcpHEGF5J5fYTQrvgEO5liao8lUKUs= knative.dev/pkg v0.0.0-20230718152110-aef227e72ead h1:2dDzorpKuVZW3Qp7TbirMMq16FbId8f6bacQFX8jXLw= knative.dev/pkg v0.0.0-20230718152110-aef227e72ead/go.mod h1:WmrwRV/P+hGHoMraAEfwg6ec+fBTf+Obu41v354Iabc= -knative.dev/reconciler-test v0.0.0-20230726074640-26cee79ad63d h1:B7s1+wFSkQF3oJFjMK3WGPiKvBYMatjgxqei0CX0BoA= -knative.dev/reconciler-test v0.0.0-20230726074640-26cee79ad63d/go.mod h1:i+/PWK/n3HPgjXMoj5U7CA6WRW/C3c3EfHCQ0FmrhNM= +knative.dev/reconciler-test v0.0.0-20230810072039-fd95669c4f59 h1:rzTXeYYAaUZCxdkqBL+2jlj0Ah03esebEAtTEJZQzNw= +knative.dev/reconciler-test v0.0.0-20230810072039-fd95669c4f59/go.mod h1:i+/PWK/n3HPgjXMoj5U7CA6WRW/C3c3EfHCQ0FmrhNM= +knative.dev/reconciler-test v0.0.0-20230817082142-9e58415bcb84 h1:H7bpsKuXpyGZwEQKDLRkkBRc5stvJWy8GCiI8HAHOcc= +knative.dev/reconciler-test v0.0.0-20230817082142-9e58415bcb84/go.mod h1:i+/PWK/n3HPgjXMoj5U7CA6WRW/C3c3EfHCQ0FmrhNM= pgregory.net/rapid v0.3.3 h1:jCjBsY4ln4Atz78QoBWxUEvAHaFyNDQg9+WU62aCn1U= pgregory.net/rapid v0.3.3/go.mod h1:UYpPVyjFHzYBGHIxLFoupi8vwk6rXNzRY9OMvVxFIOU= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= diff --git a/vendor/knative.dev/reconciler-test/pkg/eventshub/assert/step.go b/vendor/knative.dev/reconciler-test/pkg/eventshub/assert/step.go index 390a4575c5b..e4a2436aacc 100644 --- a/vendor/knative.dev/reconciler-test/pkg/eventshub/assert/step.go +++ b/vendor/knative.dev/reconciler-test/pkg/eventshub/assert/step.go @@ -9,7 +9,6 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" kubeclient "knative.dev/pkg/client/injection/kube/client" - "knative.dev/reconciler-test/pkg/environment" "knative.dev/reconciler-test/pkg/eventshub" "knative.dev/reconciler-test/pkg/feature" ) @@ -126,10 +125,10 @@ func toFixedContextMatchers(ctx context.Context, matchers []eventshub.EventInfoM return out } -func MatchPeerCertificatesFromSecret(name string, key string) eventshub.EventInfoMatcherCtx { +func MatchPeerCertificatesFromSecret(namespace, name string, key string) eventshub.EventInfoMatcherCtx { return func(ctx context.Context, info eventshub.EventInfo) error { secret, err := kubeclient.Get(ctx).CoreV1(). - Secrets(environment.FromContext(ctx).Namespace()). + Secrets(namespace). Get(ctx, name, metav1.GetOptions{}) if err != nil { @@ -141,7 +140,7 @@ func MatchPeerCertificatesFromSecret(name string, key string) eventshub.EventInf return fmt.Errorf("failed to get value from secret %s/%s for key %s", secret.Namespace, secret.Name, key) } - if info.Connection == nil && info.Connection.TLS == nil { + if info.Connection == nil || info.Connection.TLS == nil { return fmt.Errorf("failed to match peer certificates, connection is not TLS") } diff --git a/vendor/knative.dev/reconciler-test/pkg/eventshub/forwarder/forwarder.go b/vendor/knative.dev/reconciler-test/pkg/eventshub/forwarder/forwarder.go index 19ed26e53e2..e1caaeae046 100644 --- a/vendor/knative.dev/reconciler-test/pkg/eventshub/forwarder/forwarder.go +++ b/vendor/knative.dev/reconciler-test/pkg/eventshub/forwarder/forwarder.go @@ -130,15 +130,19 @@ func (o *Forwarder) ServeHTTP(writer http.ResponseWriter, request *http.Request) defer m.Finish(nil) event, eventErr := cloudeventsbindings.ToEvent(context.TODO(), m) - headers := make(http.Header) + receivedHeaders := make(http.Header) + headersToBeSent := make(http.Header) for k, v := range request.Header { if !strings.HasPrefix(k, "Ce-") { - headers[k] = v + receivedHeaders[k] = v + } + if strings.HasPrefix(k, "Kn-") { + headersToBeSent[k] = v } } // Host header is removed from the request.Header map by net/http if request.Host != "" { - headers.Set("Host", request.Host) + receivedHeaders.Set("Host", request.Host) } eventErrStr := "" @@ -150,7 +154,7 @@ func (o *Forwarder) ServeHTTP(writer http.ResponseWriter, request *http.Request) Error: eventErrStr, Event: event, Observer: o.Name, - HTTPHeaders: headers, + HTTPHeaders: receivedHeaders, Origin: request.RemoteAddr, Time: time.Now(), Kind: eventshub.EventReceived, @@ -166,6 +170,8 @@ func (o *Forwarder) ServeHTTP(writer http.ResponseWriter, request *http.Request) logging.FromContext(o.ctx).Error("Cannot create the request: ", err) } + req.Header = headersToBeSent + err = cehttp.WriteRequest(requestCtx, binding.ToMessage(event), req) if err != nil { logging.FromContext(o.ctx).Error("Cannot write the event: ", err) diff --git a/vendor/knative.dev/reconciler-test/pkg/eventshub/options.go b/vendor/knative.dev/reconciler-test/pkg/eventshub/options.go index 44d82b789ce..6448bde960d 100644 --- a/vendor/knative.dev/reconciler-test/pkg/eventshub/options.go +++ b/vendor/knative.dev/reconciler-test/pkg/eventshub/options.go @@ -88,6 +88,11 @@ func StartSenderToResource(gvr schema.GroupVersionResource, name string) EventsH if u == nil { return fmt.Errorf("resource %v named %s is not addressable", gvr, name) } + + if u.URL.Scheme == "https" { + return StartSenderURLTLS(u.URL.String(), u.CACerts)(ctx, envs) + } + return StartSenderURL(u.URL.String())(ctx, envs) } } diff --git a/vendor/knative.dev/reconciler-test/pkg/manifest/options.go b/vendor/knative.dev/reconciler-test/pkg/manifest/options.go index 94855ddbd6d..bb51fb58a3a 100644 --- a/vendor/knative.dev/reconciler-test/pkg/manifest/options.go +++ b/vendor/knative.dev/reconciler-test/pkg/manifest/options.go @@ -86,6 +86,7 @@ func WithIstioPodAnnotations(cfg map[string]interface{}) { podAnnotations := map[string]interface{}{ "sidecar.istio.io/inject": "true", "sidecar.istio.io/rewriteAppHTTPProbers": "true", + "proxy.istio.io/config": "{ 'holdApplicationUntilProxyStarts': true }", } WithAnnotations(podAnnotations)(cfg) diff --git a/vendor/modules.txt b/vendor/modules.txt index e9333cab33d..f6792d90b87 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1316,7 +1316,7 @@ knative.dev/pkg/webhook/resourcesemantics knative.dev/pkg/webhook/resourcesemantics/conversion knative.dev/pkg/webhook/resourcesemantics/defaulting knative.dev/pkg/webhook/resourcesemantics/validation -# knative.dev/reconciler-test v0.0.0-20230726074640-26cee79ad63d +# knative.dev/reconciler-test v0.0.0-20230817082142-9e58415bcb84 ## explicit; go 1.18 knative.dev/reconciler-test/cmd/eventshub knative.dev/reconciler-test/pkg/environment