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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ require (
k8s.io/apimachinery v0.32.2
k8s.io/client-go v0.32.2
k8s.io/code-generator v0.32.2
knative.dev/caching v0.0.0-20250515023348-e27e90746aeb
knative.dev/eventing v0.45.1-0.20250526160117-40bac3cce0e6
knative.dev/caching v0.0.0-20250603022924-4217d80f9aad
knative.dev/eventing v0.45.1-0.20250603123125-da948cba5099
knative.dev/hack v0.0.0-20250514121446-f525e187efdc
knative.dev/pkg v0.0.0-20250520014526-44579e9ce5ed
knative.dev/reconciler-test v0.0.0-20250516121650-f46fa6544a97
knative.dev/serving v0.45.1-0.20250529121820-92b23aa11d52
knative.dev/pkg v0.0.0-20250602175424-3c3a920206ea
knative.dev/reconciler-test v0.0.0-20250602074324-9a20896ca854
knative.dev/serving v0.45.1-0.20250605124427-cf4b1ae4810d
sigs.k8s.io/yaml v1.4.0
)

Expand Down Expand Up @@ -145,7 +145,7 @@ require (
google.golang.org/genproto v0.0.0-20240903143218-8af14fe29dc1 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20250218202821-56aae31c358a // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250218202821-56aae31c358a // indirect
google.golang.org/grpc v1.72.1 // indirect
google.golang.org/grpc v1.72.2 // indirect
google.golang.org/protobuf v1.36.6 // indirect
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
Expand All @@ -157,7 +157,7 @@ require (
k8s.io/klog/v2 v2.130.1 // indirect
k8s.io/kube-openapi v0.0.0-20241212222426-2c72e554b1e7 // indirect
k8s.io/utils v0.0.0-20241210054802-24370beab758 // indirect
knative.dev/networking v0.0.0-20250515023348-eea9fd8d72f2 // indirect
knative.dev/networking v0.0.0-20250602222425-e132e247fa39 // indirect
sigs.k8s.io/controller-runtime v0.19.0 // indirect
sigs.k8s.io/gateway-api v1.1.0 // indirect
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect
Expand Down
28 changes: 14 additions & 14 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1599,8 +1599,8 @@ google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACu
google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk=
google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI=
google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww=
google.golang.org/grpc v1.72.1 h1:HR03wO6eyZ7lknl75XlxABNVLLFc2PAb6mHlYh756mA=
google.golang.org/grpc v1.72.1/go.mod h1:wH5Aktxcg25y1I3w7H69nHfXdOG3UiadoBtjh3izSDM=
google.golang.org/grpc v1.72.2 h1:TdbGzwb82ty4OusHWepvFWGLgIbNo1/SUynEN0ssqv8=
google.golang.org/grpc v1.72.2/go.mod h1:wH5Aktxcg25y1I3w7H69nHfXdOG3UiadoBtjh3izSDM=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw=
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=
Expand Down Expand Up @@ -1714,20 +1714,20 @@ k8s.io/utils v0.0.0-20210819203725-bdf08cb9a70a/go.mod h1:jPW/WVKK9YHAvNhRxK0md/
k8s.io/utils v0.0.0-20230209194617-a36077c30491/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
k8s.io/utils v0.0.0-20241210054802-24370beab758 h1:sdbE21q2nlQtFh65saZY+rRM6x6aJJI8IUa1AmH/qa0=
k8s.io/utils v0.0.0-20241210054802-24370beab758/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
knative.dev/caching v0.0.0-20250515023348-e27e90746aeb h1:KwHEtzmX8E6bcU3uHBn+jTo/puiUSaonyHgbgdam25k=
knative.dev/caching v0.0.0-20250515023348-e27e90746aeb/go.mod h1:z8YjsYR5SxPW8mSkKf7To6Ye6gJlnS/uSed8Cguyepg=
knative.dev/eventing v0.45.1-0.20250526160117-40bac3cce0e6 h1:fniykATajL1VvDiZQfpgWg1wR000KIYJCL7oEpxIvJU=
knative.dev/eventing v0.45.1-0.20250526160117-40bac3cce0e6/go.mod h1:WeMsyA/c2/QEYAxSQrtCDr2tDegvkVxHlqlSuC9GS9k=
knative.dev/caching v0.0.0-20250603022924-4217d80f9aad h1:RPiGjQ2++UzvrfwhSQfnizPEZiTSy54fSEE58C1PLiA=
knative.dev/caching v0.0.0-20250603022924-4217d80f9aad/go.mod h1:BcJikEZAgMHlWT6TmP6TMrQRv82/5tfRAEdPxVbC2fw=
knative.dev/eventing v0.45.1-0.20250603123125-da948cba5099 h1:/YPJyTvzKjDNvc4upX+JsFXRb0tGwTWFca+/o+lRk3E=
knative.dev/eventing v0.45.1-0.20250603123125-da948cba5099/go.mod h1:EsMEGF9zAiS2mJ2P2r1HCTWQ+Zv96ytiSqttIMeqNj0=
knative.dev/hack v0.0.0-20250514121446-f525e187efdc h1:8HmclJlA0zNE/G1SkgdC3/IFSSyhaSz2iIhihU6YbEo=
knative.dev/hack v0.0.0-20250514121446-f525e187efdc/go.mod h1:R0ritgYtjLDO9527h5vb5X6gfvt5LCrJ55BNbVDsWiY=
knative.dev/networking v0.0.0-20250515023348-eea9fd8d72f2 h1:ohEu0ii0tHMFESdUOF++47/stJ2gFfc8KPM3TavRfrI=
knative.dev/networking v0.0.0-20250515023348-eea9fd8d72f2/go.mod h1:2YJmcqu+PHpCGpxvu9jCkoepJaOg/SnNJZz/qBhn71A=
knative.dev/pkg v0.0.0-20250520014526-44579e9ce5ed h1:5ZYbJDnkQ/Q3oZsiwD0hnbmMwC6+2KvkIJNPH9IToUE=
knative.dev/pkg v0.0.0-20250520014526-44579e9ce5ed/go.mod h1:RgnJAMaNr/5xVZ9Kkd2BBkeNt1/TpDOo5fCSTqaVX8w=
knative.dev/reconciler-test v0.0.0-20250516121650-f46fa6544a97 h1:IcAtORqZ3ek+HN9799LRRiBijSgNCdtAvF1S7qzPvcM=
knative.dev/reconciler-test v0.0.0-20250516121650-f46fa6544a97/go.mod h1:CWM3ApZHYFCw2gQi1SDSVSoMNaGMm3M4JZidda6PhY0=
knative.dev/serving v0.45.1-0.20250529121820-92b23aa11d52 h1:BFGqIFAkAWzAorrEjdTiM+fLAMl7lmr97S/bflYz27g=
knative.dev/serving v0.45.1-0.20250529121820-92b23aa11d52/go.mod h1:qp7RLjdvL5SP593DZJCdgPDBsZEyhFQd9kL771hDDfs=
knative.dev/networking v0.0.0-20250602222425-e132e247fa39 h1:wVgAQb7ScYe+jmvZscU0AomHCeweaYB4bwTxUnbQ8qE=
knative.dev/networking v0.0.0-20250602222425-e132e247fa39/go.mod h1:JnMvVJHh999ob4zLB/CHxdA32/G88Cmz+y1pxTGwY3A=
knative.dev/pkg v0.0.0-20250602175424-3c3a920206ea h1:ukJPq9MzFTEH/Sei5MSVnSE8+7NSCKixCDZPd6p4ohw=
knative.dev/pkg v0.0.0-20250602175424-3c3a920206ea/go.mod h1:tFayQbi6t4+5HXuEGLOGvILW228Q7uaJp/FYEgbjJ3A=
knative.dev/reconciler-test v0.0.0-20250602074324-9a20896ca854 h1:lVLYcQMWGDzcY2jKJI4NwbCReADA/k9f3RQUBBxx/cc=
knative.dev/reconciler-test v0.0.0-20250602074324-9a20896ca854/go.mod h1:r6tSGY5T+AXRITlgAbyg2wM2LfCn/DgXX7tw24ku58k=
knative.dev/serving v0.45.1-0.20250605124427-cf4b1ae4810d h1:iQWlpi6dseUyy782x6yoAKwPgJCSIMIdJ4vu44nUHYc=
knative.dev/serving v0.45.1-0.20250605124427-cf4b1ae4810d/go.mod h1:s1uHTOOggJqyCo0DB3Unf462EG7803f9RM/v0Bszcwk=
nhooyr.io/websocket v1.8.6/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0=
pgregory.net/rapid v1.1.0 h1:CMa0sjHSru3puNx+J0MIAuiiEV4N0qj8/cMWGBBCsjw=
pgregory.net/rapid v1.1.0/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04=
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/google.golang.org/grpc/version.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func init() {
CA, Key, Crt = loadCerts()
}

func StartServer(ctx context.Context, t *testing.T, port int, handler http.Handler, receiverOptions ...kncloudevents.HTTPEventReceiverOption) string {
func StartServer(ctx context.Context, t *testing.T, port int, handler http.Handler, receiverOptions ...kncloudevents.HTTPEventReceiverOption) (string, int) {
secret := types.NamespacedName{
Namespace: "knative-tests",
Name: "tls-secret",
Expand Down Expand Up @@ -83,7 +83,7 @@ func StartServer(ctx context.Context, t *testing.T, port int, handler http.Handl
}
}()

return string(CA)
return string(CA), receiver.GetPort()
}

func loadCerts() ([]byte, []byte, []byte) {
Expand Down
36 changes: 30 additions & 6 deletions vendor/knative.dev/eventing/pkg/kncloudevents/event_receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"fmt"
"net"
"net/http"
"strconv"
"time"

"go.opencensus.io/plugin/ochttp"
Expand All @@ -34,7 +35,8 @@ const (
)

type HTTPEventReceiver struct {
port int
desiredPort int
port int

server *http.Server
listener net.Listener
Expand All @@ -49,13 +51,14 @@ type HTTPEventReceiver struct {
// HTTPEventReceiverOption enables further configuration of a HTTPEventReceiver.
type HTTPEventReceiverOption func(*HTTPEventReceiver)

func NewHTTPEventReceiver(port int, o ...HTTPEventReceiverOption) *HTTPEventReceiver {
// NewHTTPEventReceiver creates a new HTTPEventReceiver. When desiredPort is set to 0, a free port will be chosen.
// The final port of the running server will be stored in receiver.Port.
func NewHTTPEventReceiver(desiredPort int, o ...HTTPEventReceiverOption) *HTTPEventReceiver {
h := &HTTPEventReceiver{
port: port,
desiredPort: desiredPort,
Ready: make(chan interface{}),
}

h.Ready = make(chan interface{})

for _, opt := range o {
opt(h)
}
Expand Down Expand Up @@ -122,10 +125,19 @@ func (recv *HTTPEventReceiver) GetAddr() string {
return ""
}

// GetPort returns the final assigned port of the server.
// This is blocking, as we need to wait until the server is running.
func (recv *HTTPEventReceiver) GetPort() int {
// wait until server is ready, as only then the port is assigned
<-recv.Ready

return recv.port
}

// Blocking
func (recv *HTTPEventReceiver) StartListen(ctx context.Context, handler http.Handler) error {
var err error
if recv.listener, err = net.Listen("tcp", fmt.Sprintf(":%d", recv.port)); err != nil {
if recv.listener, err = net.Listen("tcp", fmt.Sprintf(":%d", recv.desiredPort)); err != nil {
return err
}

Expand All @@ -140,6 +152,18 @@ func (recv *HTTPEventReceiver) StartListen(ctx context.Context, handler http.Han
recv.server.Addr = recv.listener.Addr().String()
recv.server.Handler = drainer

_, portStr, err := net.SplitHostPort(recv.server.Addr)
if err != nil {
return fmt.Errorf("could not get port of server: %w", err)
}

port, err := strconv.Atoi(portStr)
if err != nil {
return fmt.Errorf("could not convert port to int: %w", err)
}

recv.port = port

errChan := make(chan error, 1)
go func() {
close(recv.Ready)
Expand Down
14 changes: 7 additions & 7 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ google.golang.org/genproto/googleapis/api/httpbody
google.golang.org/genproto/googleapis/rpc/code
google.golang.org/genproto/googleapis/rpc/errdetails
google.golang.org/genproto/googleapis/rpc/status
# google.golang.org/grpc v1.72.1
# google.golang.org/grpc v1.72.2
## explicit; go 1.23
google.golang.org/grpc
google.golang.org/grpc/attributes
Expand Down Expand Up @@ -1428,11 +1428,11 @@ k8s.io/utils/net
k8s.io/utils/pointer
k8s.io/utils/ptr
k8s.io/utils/trace
# knative.dev/caching v0.0.0-20250515023348-e27e90746aeb
# knative.dev/caching v0.0.0-20250603022924-4217d80f9aad
## explicit; go 1.23.0
knative.dev/caching/pkg/apis/caching
knative.dev/caching/pkg/apis/caching/v1alpha1
# knative.dev/eventing v0.45.1-0.20250526160117-40bac3cce0e6
# knative.dev/eventing v0.45.1-0.20250603123125-da948cba5099
## explicit; go 1.23.0
knative.dev/eventing/cmd/heartbeats
knative.dev/eventing/pkg/apis
Expand Down Expand Up @@ -1526,7 +1526,7 @@ knative.dev/eventing/test/upgrade/prober/wathola/sender
# knative.dev/hack v0.0.0-20250514121446-f525e187efdc
## explicit; go 1.21
knative.dev/hack
# knative.dev/networking v0.0.0-20250515023348-eea9fd8d72f2
# knative.dev/networking v0.0.0-20250602222425-e132e247fa39
## explicit; go 1.23.0
knative.dev/networking/pkg
knative.dev/networking/pkg/apis/networking
Expand All @@ -1543,7 +1543,7 @@ knative.dev/networking/pkg/http/proxy
knative.dev/networking/pkg/http/stats
knative.dev/networking/pkg/ingress
knative.dev/networking/pkg/k8s
# knative.dev/pkg v0.0.0-20250520014526-44579e9ce5ed
# knative.dev/pkg v0.0.0-20250602175424-3c3a920206ea
## explicit; go 1.23.0
knative.dev/pkg/apiextensions/storageversion
knative.dev/pkg/apiextensions/storageversion/cmd/migrate
Expand Down Expand Up @@ -1631,7 +1631,7 @@ knative.dev/pkg/webhook
knative.dev/pkg/webhook/certificates
knative.dev/pkg/webhook/certificates/resources
knative.dev/pkg/webhook/resourcesemantics/conversion
# knative.dev/reconciler-test v0.0.0-20250516121650-f46fa6544a97
# knative.dev/reconciler-test v0.0.0-20250602074324-9a20896ca854
## explicit; go 1.23.0
knative.dev/reconciler-test/cmd/eventshub
knative.dev/reconciler-test/pkg/environment
Expand Down Expand Up @@ -1660,7 +1660,7 @@ knative.dev/reconciler-test/pkg/resources/service
knative.dev/reconciler-test/pkg/resources/serviceaccount
knative.dev/reconciler-test/pkg/state
knative.dev/reconciler-test/resources/certificate
# knative.dev/serving v0.45.1-0.20250529121820-92b23aa11d52
# knative.dev/serving v0.45.1-0.20250605124427-cf4b1ae4810d
## explicit; go 1.24.0
knative.dev/serving/pkg/apis/autoscaling
knative.dev/serving/pkg/apis/autoscaling/v1alpha1
Expand Down
Loading