Skip to content

Commit

Permalink
upgrade to latest dependencies (#1151)
Browse files Browse the repository at this point in the history
bumping knative.dev/eventing 4b5fde8...f5b1b12:%0A  > f5b1b12 Send namespace header in MT components (# 7048)

Signed-off-by: Knative Automation <[email protected]>
  • Loading branch information
knative-automation authored Jun 29, 2023
1 parent e5d3ca7 commit 680e89f
Show file tree
Hide file tree
Showing 8 changed files with 119 additions and 21 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ require (
k8s.io/client-go v0.26.5
k8s.io/code-generator v0.26.5
k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280
knative.dev/eventing v0.37.1-0.20230628105954-4b5fde82647d
knative.dev/eventing v0.37.1-0.20230629130303-f5b1b124c233
knative.dev/hack v0.0.0-20230628110129-fc42790854e8
knative.dev/pkg v0.0.0-20230628105954-6eb4b40a9a30
knative.dev/reconciler-test v0.0.0-20230628013854-710f92a76fc1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1027,8 +1027,8 @@ 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-20230505201702-9f6742963106 h1:EObNQ3TW2D+WptiYXlApGNLVy0zm/JIBVY9i+M4wpAU=
k8s.io/utils v0.0.0-20230505201702-9f6742963106/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
knative.dev/eventing v0.37.1-0.20230628105954-4b5fde82647d h1:GF9+9uKyWY32xQa4+JJzH3E2V/wdREpgjFTdMAi1b7A=
knative.dev/eventing v0.37.1-0.20230628105954-4b5fde82647d/go.mod h1:MRpJ0pRqodV9mlPvRTLXnUOo0ExPDHyEk04Zxjn3bA0=
knative.dev/eventing v0.37.1-0.20230629130303-f5b1b124c233 h1:VdyVbjbNEfhXDdErjs7llMJSub3yjCAXNtgvXsWejFI=
knative.dev/eventing v0.37.1-0.20230629130303-f5b1b124c233/go.mod h1:MRpJ0pRqodV9mlPvRTLXnUOo0ExPDHyEk04Zxjn3bA0=
knative.dev/hack v0.0.0-20230628110129-fc42790854e8 h1:l7CnU4IiRB0TTQAWqOSXg9MnB2bxWjx4o/Vw6Yb27eM=
knative.dev/hack v0.0.0-20230628110129-fc42790854e8/go.mod h1:yk2OjGDsbEnQjfxdm0/HJKS2WqTLEFg/N6nUs6Rqx3Q=
knative.dev/pkg v0.0.0-20230628105954-6eb4b40a9a30 h1:UUjxZMKgK907IfFY3b7xj9sY53c+feiYvzUwPtajN8I=
Expand Down
3 changes: 3 additions & 0 deletions vendor/knative.dev/eventing/pkg/adapter/v2/cloudevents.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import (
"knative.dev/pkg/tracing/propagation/tracecontextb3"

"knative.dev/eventing/pkg/adapter/v2/util/crstatusevent"
"knative.dev/eventing/pkg/apis"
"knative.dev/eventing/pkg/eventingtls"
"knative.dev/eventing/pkg/metrics/source"
obsclient "knative.dev/eventing/pkg/observability/client"
Expand Down Expand Up @@ -171,6 +172,8 @@ func NewClient(cfg ClientConfig) (Client, error) {
return nil, err
}
}

pOpts = append(pOpts, http.WithHeader(apis.KnNamespaceHeader, cfg.Env.GetNamespace()))
}

pOpts = append(pOpts, http.WithRoundTripper(transport))
Expand Down
20 changes: 20 additions & 0 deletions vendor/knative.dev/eventing/pkg/apis/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
Copyright 2021 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

// This file is need to work around a gengo/go1.20 issue
// details https://github.com/ahmetb/gen-crd-api-reference-docs/issues/61

package apis
21 changes: 21 additions & 0 deletions vendor/knative.dev/eventing/pkg/apis/http.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
Copyright 2023 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package apis

const (
KnNamespaceHeader = "Kn-Namespace"
)
46 changes: 29 additions & 17 deletions vendor/knative.dev/eventing/test/rekt/features/broker/feature.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ import (
"github.com/cloudevents/sdk-go/v2/binding/spec"
"github.com/cloudevents/sdk-go/v2/test"
"github.com/google/uuid"
"knative.dev/reconciler-test/pkg/environment"

duckv1 "knative.dev/eventing/pkg/apis/duck/v1"
eventingv1 "knative.dev/eventing/pkg/apis/eventing/v1"
"knative.dev/eventing/test/rekt/features"
"knative.dev/eventing/test/rekt/resources/broker"
"knative.dev/eventing/test/rekt/resources/channel"
"knative.dev/eventing/test/rekt/resources/subscription"
Expand Down Expand Up @@ -186,10 +188,12 @@ func BrokerWithManyTriggers() *feature.Feature {
for _, matcher := range matchers {
// One match per event is enough
f.Stable("test message without explicit prefer header should have the header").
Must("delivers events",
eventasssert.OnStore(sink).Match(
matcher,
).AtLeast(1))
Must("delivers events", func(ctx context.Context, t feature.T) {
eventasssert.OnStore(sink).
Match(features.HasKnNamespaceHeader(environment.FromContext(ctx).Namespace())).
Match(matcher).
AtLeast(1)(ctx, t)
})
}
}
}
Expand Down Expand Up @@ -628,14 +632,19 @@ func brokerRedeliveryDropN(retryNum int32, dropNum uint) *feature.Feature {

f.Stable("Broker Redelivery failed the first n events").
Must("delivers events",
eventasssert.OnStore(sink).Match(
eventasssert.MatchKind(eventasssert.EventReceived),
eventasssert.MatchEvent(
test.HasSource(eventSource),
test.HasType(eventType),
test.HasData([]byte(eventBody)),
),
).AtLeast(1))
func(ctx context.Context, t feature.T) {
eventasssert.OnStore(sink).
Match(features.HasKnNamespaceHeader(environment.FromContext(ctx).Namespace())).
Match(
eventasssert.MatchKind(eventasssert.EventReceived),
eventasssert.MatchEvent(
test.HasSource(eventSource),
test.HasType(eventType),
test.HasData([]byte(eventBody)),
),
).
AtLeast(1)(ctx, t)
})

return f
}
Expand Down Expand Up @@ -693,11 +702,14 @@ func brokerSubscriberUnreachable() *feature.Feature {
))

f.Assert("Receives dls extensions when subscriber is unreachable",
eventasssert.OnStore(sink).
MatchEvent(
test.HasExtension("knativeerrordest", "http://fake.svc.cluster.local"),
).
AtLeast(1),
func(ctx context.Context, t feature.T) {
eventasssert.OnStore(sink).
Match(features.HasKnNamespaceHeader(environment.FromContext(ctx).Namespace())).
MatchEvent(
test.HasExtension("knativeerrordest", "http://fake.svc.cluster.local"),
).
AtLeast(1)(ctx, t)
},
)
return f
}
Expand Down
40 changes: 40 additions & 0 deletions vendor/knative.dev/eventing/test/rekt/features/matchers.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
Copyright 2023 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package features

import (
"fmt"

"knative.dev/reconciler-test/pkg/eventshub"

"knative.dev/eventing/pkg/apis"
)

func HasKnNamespaceHeader(ns string) eventshub.EventInfoMatcher {
return func(info eventshub.EventInfo) error {
values, ok := info.HTTPHeaders[apis.KnNamespaceHeader]
if !ok {
return fmt.Errorf("%s header not found", apis.KnNamespaceHeader)
}
for _, v := range values {
if v == ns {
return nil
}
}
return fmt.Errorf("wanted %s header to have value %s, got %+v", apis.KnNamespaceHeader, ns, values)
}
}
4 changes: 3 additions & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1049,11 +1049,12 @@ k8s.io/utils/net
k8s.io/utils/pointer
k8s.io/utils/strings/slices
k8s.io/utils/trace
# knative.dev/eventing v0.37.1-0.20230628105954-4b5fde82647d
# knative.dev/eventing v0.37.1-0.20230629130303-f5b1b124c233
## explicit; go 1.19
knative.dev/eventing/cmd/heartbeats
knative.dev/eventing/pkg/adapter/v2
knative.dev/eventing/pkg/adapter/v2/util/crstatusevent
knative.dev/eventing/pkg/apis
knative.dev/eventing/pkg/apis/config
knative.dev/eventing/pkg/apis/duck
knative.dev/eventing/pkg/apis/duck/v1
Expand Down Expand Up @@ -1139,6 +1140,7 @@ knative.dev/eventing/test/performance/infra/common
knative.dev/eventing/test/performance/infra/event_state
knative.dev/eventing/test/performance/infra/receiver
knative.dev/eventing/test/performance/infra/sender
knative.dev/eventing/test/rekt/features
knative.dev/eventing/test/rekt/features/broker
knative.dev/eventing/test/rekt/features/featureflags
knative.dev/eventing/test/rekt/features/knconf
Expand Down

0 comments on commit 680e89f

Please sign in to comment.