Skip to content

Commit

Permalink
upgrade to latest dependencies (#456)
Browse files Browse the repository at this point in the history
bumping knative.dev/eventing 6833ee6...6911db0:
  > 6911db0 Tag line proposal (# 7045)
  > a13eebe [main] Upgrade to latest dependencies (# 7100)
  > a755429 Re-enable PingSource TLS E2E test (# 7082)
  > de75496 Function CopySecretWithName for creating secrets with specific name (# 7002)
bumping knative.dev/pkg 7051d30...aef227e:
  > aef227e upgrade to latest dependencies (# 2767)

Signed-off-by: Knative Automation <[email protected]>
  • Loading branch information
knative-automation authored Jul 24, 2023
1 parent bcdf5d8 commit 14328d9
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 23 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ require (
k8s.io/api v0.26.5
k8s.io/apimachinery v0.26.5
k8s.io/client-go v0.26.5
knative.dev/eventing v0.37.1-0.20230714071414-6833ee64374e
knative.dev/eventing v0.37.1-0.20230721081414-6911db0b3592
knative.dev/hack v0.0.0-20230712131415-ddae80293c43
knative.dev/pkg v0.0.0-20230712131115-7051d301e7f4
knative.dev/pkg v0.0.0-20230718152110-aef227e72ead
knative.dev/serving v0.37.1-0.20230713131514-294cb9c08b37
)

Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -816,14 +816,14 @@ k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280 h1:+70TFaan3hfJzs+7VK2o+O
k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280/go.mod h1:+Axhij7bCpeqhklhUTe3xmOn6bWxolyZEeyaFpjGtl4=
k8s.io/utils v0.0.0-20221108210102-8e77b1f39fe2 h1:GfD9OzL11kvZN5iArC6oTS7RTj7oJOIfnislxYlqTj8=
k8s.io/utils v0.0.0-20221108210102-8e77b1f39fe2/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
knative.dev/eventing v0.37.1-0.20230714071414-6833ee64374e h1:3+SGb8aTSigT4qigFf59ntdGVzEsaABUVqRuL4TPNNY=
knative.dev/eventing v0.37.1-0.20230714071414-6833ee64374e/go.mod h1:qdgFteB1E2/K0TfweX9zDX3An6PkzsQ/a4xEWkitusk=
knative.dev/eventing v0.37.1-0.20230721081414-6911db0b3592 h1:U4gZpFKb5VIL/f6nK88q3ORL7yv+VOh2A1wmFxrjfYg=
knative.dev/eventing v0.37.1-0.20230721081414-6911db0b3592/go.mod h1:nd7MZ/O5nyNKlZ1m9XAxI9eSq2bYWJQfYogSXflRpqc=
knative.dev/hack v0.0.0-20230712131415-ddae80293c43 h1:3SE06uNfSFGm/5XS+0trbyCUpgsOaBeyhPQU8FPNFz8=
knative.dev/hack v0.0.0-20230712131415-ddae80293c43/go.mod h1:yk2OjGDsbEnQjfxdm0/HJKS2WqTLEFg/N6nUs6Rqx3Q=
knative.dev/networking v0.0.0-20230710015341-b2cce924227a h1:l3yIUSoxxU+y1OBYRDirwM3XY9zturWvjiKkFha+BWk=
knative.dev/networking v0.0.0-20230710015341-b2cce924227a/go.mod h1:cSrqxaHRb/SSNd19YS3tJq6YHoQIqlRpWv4v9OXmhDg=
knative.dev/pkg v0.0.0-20230712131115-7051d301e7f4 h1:oO/BQJpVCFTSTMHF/S6u+nPtIvbHDTsvbPZvdCZAFjs=
knative.dev/pkg v0.0.0-20230712131115-7051d301e7f4/go.mod h1:eXobTqst4aI7CNa6W7sG73VhEsHGWPSrkefeMTb++a0=
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/serving v0.37.1-0.20230713131514-294cb9c08b37 h1:tzEO9XdOvGlPj9jAa61BlSi3Gq7SQ5pVnWWntVv74P4=
knative.dev/serving v0.37.1-0.20230713131514-294cb9c08b37/go.mod h1:KzM8JVJDX87Mx4ACwG3R3TypDYiZgz6PZOdnyIcPwi8=
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
Expand Down
50 changes: 35 additions & 15 deletions vendor/knative.dev/eventing/pkg/adapter/v2/cloudevents.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ import (
"net/url"
"time"

obshttp "github.com/cloudevents/sdk-go/observability/opencensus/v2/http"
cloudevents "github.com/cloudevents/sdk-go/v2"
ceclient "github.com/cloudevents/sdk-go/v2/client"
"github.com/cloudevents/sdk-go/v2/event"
"github.com/cloudevents/sdk-go/v2/protocol"
"github.com/cloudevents/sdk-go/v2/protocol/http"
"go.opencensus.io/plugin/ochttp"
"go.opencensus.io/plugin/ochttp/propagation/tracecontext"
duckv1 "knative.dev/pkg/apis/duck/v1"
"knative.dev/pkg/tracing/propagation/tracecontextb3"

Expand All @@ -53,7 +53,9 @@ type Client interface {
var newClientHTTPObserved = NewClientHTTPObserved

func NewClientHTTPObserved(topt []http.Option, copt []ceclient.Option) (Client, error) {
t, err := obshttp.NewObservedHTTP(topt...)
t, err := http.New(append(topt,
http.WithMiddleware(tracecontextMiddleware),
)...)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -108,8 +110,6 @@ type ClientConfig struct {
Reporter source.StatsReporter
CrStatusEventClient *crstatusevent.CRStatusEventClient
Options []http.Option

Client Client
}

type clientConfigKey struct{}
Expand All @@ -127,16 +127,12 @@ func GetClientConfig(ctx context.Context) ClientConfig {
}

func NewClient(cfg ClientConfig) (Client, error) {
if cfg.Client != nil {
return cfg.Client, nil
}

transport := &ochttp.Transport{
Base: nethttp.DefaultTransport.(*nethttp.Transport),
Propagation: tracecontextb3.TraceContextEgress,
}

pOpts := make([]http.Option, 0)
var closeIdler closeIdler = nethttp.DefaultTransport.(*nethttp.Transport)

ceOverrides := cfg.CeOverrides
if cfg.Env != nil {
Expand All @@ -152,16 +148,16 @@ func NewClient(cfg ClientConfig) (Client, error) {
clientConfig := eventingtls.NewDefaultClientConfig()
clientConfig.CACerts = cfg.Env.GetCACerts()

httpTransport := nethttp.DefaultTransport.(*nethttp.Transport).Clone()
httpTransport.TLSClientConfig, err = eventingtls.GetTLSClientConfig(clientConfig)
tlsConfig, err := eventingtls.GetTLSClientConfig(clientConfig)
if err != nil {
return nil, err
}

closeIdler = httpTransport
httpsTransport := transport.Base.(*nethttp.Transport).Clone()
httpsTransport.TLSClientConfig = tlsConfig

transport = &ochttp.Transport{
Base: httpTransport,
Base: httpsTransport,
Propagation: tracecontextb3.TraceContextEgress,
}
}
Expand All @@ -176,7 +172,11 @@ func NewClient(cfg ClientConfig) (Client, error) {
pOpts = append(pOpts, http.WithHeader(apis.KnNamespaceHeader, cfg.Env.GetNamespace()))
}

pOpts = append(pOpts, http.WithRoundTripper(transport))
httpClient := nethttp.Client{Transport: roundTripperDecorator(transport)}

// Important: prepend HTTP client option to make sure that other options are applied to this
// client and not to the default client.
pOpts = append([]http.Option{http.WithClient(httpClient)}, pOpts...)

// Make sure that explicitly set options have priority
opts := append(pOpts, cfg.Options...)
Expand All @@ -191,7 +191,7 @@ func NewClient(cfg ClientConfig) (Client, error) {
}
return &client{
ceClient: ceClient,
closeIdler: closeIdler,
closeIdler: transport.Base.(*nethttp.Transport),
ceOverrides: ceOverrides,
reporter: cfg.Reporter,
crStatusEventClient: cfg.CrStatusEventClient,
Expand Down Expand Up @@ -341,3 +341,23 @@ func MetricTagFromContext(ctx context.Context) *MetricTag {
ResourceGroup: "unknown",
}
}

func roundTripperDecorator(roundTripper nethttp.RoundTripper) nethttp.RoundTripper {
return &ochttp.Transport{
Propagation: &tracecontext.HTTPFormat{},
Base: roundTripper,
FormatSpanName: formatSpanName,
}
}

func formatSpanName(r *nethttp.Request) string {
return "cloudevents.http." + r.URL.Path
}

func tracecontextMiddleware(h nethttp.Handler) nethttp.Handler {
return &ochttp.Handler{
Propagation: &tracecontext.HTTPFormat{},
Handler: h,
FormatSpanName: formatSpanName,
}
}
4 changes: 2 additions & 2 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -953,7 +953,7 @@ k8s.io/utils/net
k8s.io/utils/pointer
k8s.io/utils/strings/slices
k8s.io/utils/trace
# knative.dev/eventing v0.37.1-0.20230714071414-6833ee64374e
# knative.dev/eventing v0.37.1-0.20230721081414-6911db0b3592
## explicit; go 1.19
knative.dev/eventing/pkg/adapter/v2
knative.dev/eventing/pkg/adapter/v2/util/crstatusevent
Expand Down Expand Up @@ -1007,7 +1007,7 @@ knative.dev/hack
knative.dev/networking/pkg/apis/networking
knative.dev/networking/pkg/apis/networking/v1alpha1
knative.dev/networking/pkg/config
# knative.dev/pkg v0.0.0-20230712131115-7051d301e7f4
# knative.dev/pkg v0.0.0-20230718152110-aef227e72ead
## explicit; go 1.18
knative.dev/pkg/apis
knative.dev/pkg/apis/duck
Expand Down

0 comments on commit 14328d9

Please sign in to comment.