Skip to content

Commit

Permalink
upgrade to latest dependencies
Browse files Browse the repository at this point in the history
bumping google.golang.org/genproto/googleapis/api d264139...ef581f9:
  > ef581f9 chore(all): update all (# 1132)
  > 5315273 chore(all): update all (# 1131)
  > a332354 chore(all): auto-regenerate .pb.go files (# 1130)
bumping knative.dev/pkg 339c22b...7ecd548:
  > 7ecd548 Update community files (# 3071)
  > 3f6a546 Fix rand source in name (# 3070)
  > ee1db86 Update linter config and address lint warnings/failures (# 3068)
  > 26bc7b4 Register AuthenticatableType in schema (# 3069)
  > 8535fcc gofumpt the repo (# 3067)
  > fc0720b [logstream] test polling should use a different context (# 3066)
  > 51dec91 drop test-infra code (# 3065)
  > b5bb12c drop unused OWNERS files and update script (# 3064)
  > 915c009 drop google/s2a-go (# 3062)
  > cd0e61e drop mako (# 3060)
  > fe2597a drop eventing kafka from downstream tests - repo is archived (# 3061)
  > b94232c Bump cloud.google.com/go/storage from 1.41.0 to 1.42.0 (# 3057)
bumping knative.dev/client-pkg 8fbea3d...18eac77:
  > 18eac77 Update community files (# 188)
bumping knative.dev/networking 3b8764c...370ddbb:
  > 370ddbb Update community files (# 991)
  > f35497a upgrade to latest dependencies (# 990)
bumping knative.dev/hack 0914314...b979959:
  > b979959 Update community files (# 387)
bumping knative.dev/eventing ea8f0fd...fe6bd56:
  > fe6bd56 Adding symbolic link for event policy type.  (# 8081)
  > 2f1f866 fix: trigger labels are set properly with cn event links enabled (# 8066)
  > 5f6713a fix(test): creating the knsubscribe clusterrolebinding does not cause install script to fail (# 8068)
  > 8e039dd Watch only our own OIDC-related secrets (# 8070)
  > 5a96619 Add Kubernetes Version Check to Installation Script (# 8025)
  > 332d974 Update TokenVerifier to verify AuthZ too (# 8063)
  > 3264b21 List applying EventPolicies in Brokers status (# 8060)
  > 657c3cd List applying policies in job sink (# 8064)
  > 98ed09c [main] Update community files (# 8069)
  > e2d782f # 7879: Changes to add filters field (# 7930)
  > d18595f 🐛 Codecov reject any coverage drop (# 8065)
  > 399bb86 Reconcile EventPolicies when features configmap changes (# 8059)
  > 4f2b53f Set APIVersion and Kind of EventPolicy manually in OwnerReference of backing channels policy (# 8031)
  > 96c30bd List applying EventPolicies in Sequence status (# 8012)
  > 3b1bfb4 feat(test): create knsubscribe rolebinding to current user in e2e test setup (# 8055)
  > beb71be Add EventPolicy Reconciler (# 8024)
  > 6992e6f Avoid fatal errors for unknown features flags that can be added in a future release (# 8051)
  > a6ac811 [main] Upgrade to latest dependencies (# 8032)
  > c5ac18a Update Github actions automatically (# 7942)
  > e36a2cf Use `knative/actions/setup-go` to be in sync with other projects (# 8044)
  > 922edf2 Remove unneeded replaces in go.mod (# 8033)
  > 0f71292 [main] Upgrade to latest dependencies (# 8029)
  > 9cf272a Event Type API: updated test name to avoid confusion (# 8030)
  > 6352784 Updating RetryableHttp lib to latest (# 8026)
  > d4e647d List applying policies in Channel and propagate EventPolicies to underlying channel (# 8014)
  > 7253b36 Add EventPolicy resource for rekt tests (# 8010)
  > e21311d [main] Upgrade to latest dependencies (# 8019)
  > 36c904a Fix test case in `TestCreateExpectedEventDeliveryMap` (# 8023)
  > 825202f Fix test case in TestCreateExpectedEventPatterns (# 8022)
  > c9deeb9 Add JobSink to storage version migration (# 8020)
  > f84a98c Remove unused performance tests (# 7707)
  > f4df40f List applying policies in InMemoryChannels status (# 8011)
  > 18dfe3c JobSink: Test OIDC support (# 8000)
  > e298f32 Add authz library (# 8002)
  > 1a21fee Add all JobSink symlinks in config/ (# 8007)
  > 2157639 Add validation for EventPolicy sub suffix matching (# 8008)
  > 0eee301 Propagate read error correctly in event-dispatcher (# 8005)
  > 43cf75a [main] Upgrade to latest dependencies (# 8004)
bumping knative.dev/serving 1f7cc48...a923915:
  > a923915 enable system internal tls for contour (# 15374)
  > a310476 Update net-contour nightly (# 15377)
  > 9ffb3ad Update net-kourier nightly (# 15373)
  > b0eab7d Update net-contour nightly (# 15371)
  > 9b25954 Update net-istio nightly (# 15370)
  > 208138f Update net-gateway-api nightly (# 15372)
  > 4bbb7cf Fix external domain tls test setup (# 15366)
  > 05b60b5 Update community files (# 15369)
  > 75f7393 Update net-gateway-api nightly (# 15355)
  > af2c899 Adjust Workload HA test iterations to fit within test timeout (# 15362)
  > 89fdbe1 Update net-kourier nightly (# 15357)
  > 9873264 Update net-contour nightly (# 15363)
  > 6d257d8 Update net-istio nightly (# 15365)
  > a043ddf Drop duplicate test case - TestActivatorInRequestPathPossibly (# 15361)
  > 95c751a upgrade to latest dependencies (# 15353)
  > 25783ae Update net-contour nightly (# 15356)
  > b02cc68 Update net-istio nightly (# 15358)
  > 1dff15d feat: add defaults configurable runtimeClassName (# 15271)
  > 5558435 Update net-contour nightly (# 15350)
  > 2ac8b35 add tests to validate uptime of services during user pod deletion (# 15284)
  > 7193018 upgrade to latest dependencies (# 15351)
  > d6d8525 use wait.Interrupted (# 15342)
  > 48d3196 Update net-gateway-api nightly (# 15349)
  > 866782a Update net-istio nightly (# 15348)
  > 226c771 Bump ko-build/setup-ko from 0.6 to 0.7 (# 15346)
  > 6fa0f6d upgrade to latest dependencies (# 15344)
  > a5ad85b Update net-gateway-api nightly (# 15337)
  > b22e06c Update net-kourier nightly (# 15340)
  > de3b9ba upgrade to latest dependencies (# 15341)
  > 6d90f54 Update net-contour nightly (# 15339)
  > 78fd584 Update net-istio nightly (# 15338)
  > faf421a Update net-gateway-api nightly (# 15335)
  > 5a92452 Clean up job for old resources (# 15312)
  > 408b284 Update net-istio nightly (# 15336)
  > c980773 re-enable failng contour/gateway api tests (# 15334)
  > a4fa238 bump istio and contour for gateway api testing (# 15333)
  > e56319d Allow ipv6 address for sslip.io in default-domain Job (# 15328)
  > f464e2d upgrade to latest dependencies (# 15329)
  > 0b61640 Update net-kourier nightly (# 15314)
  > 8d768f5 Cert rotation test does not use specific ingress namespace (# 15331)

Signed-off-by: Knative Automation <automation@knative.team>
  • Loading branch information
knative-automation committed Jul 8, 2024
1 parent b626b74 commit d1223f3
Show file tree
Hide file tree
Showing 74 changed files with 399 additions and 200 deletions.
16 changes: 8 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module knative.dev/client

go 1.21
go 1.22

require (
github.com/google/go-cmp v0.6.0
Expand All @@ -20,12 +20,12 @@ require (
k8s.io/cli-runtime v0.29.2
k8s.io/client-go v0.29.2
k8s.io/code-generator v0.29.2
knative.dev/client-pkg v0.0.0-20240607132727-8fbea3d02b53
knative.dev/eventing v0.41.1-0.20240613093107-ea8f0fda4c06
knative.dev/hack v0.0.0-20240607132042-09143140a254
knative.dev/networking v0.0.0-20240611072033-3b8764c0bb4c
knative.dev/pkg v0.0.0-20240614135239-339c22b8218c
knative.dev/serving v0.41.1-0.20240614080555-1f7cc4852a07
knative.dev/client-pkg v0.0.0-20240704014437-18eac77f7749
knative.dev/eventing v0.41.1-0.20240705133111-fe6bd5682edc
knative.dev/hack v0.0.0-20240704013904-b9799599afcf
knative.dev/networking v0.0.0-20240704015122-370ddbb8fd13
knative.dev/pkg v0.0.0-20240704013837-7ecd5485cbc6
knative.dev/serving v0.41.1-0.20240708063112-a9239154ab8c
sigs.k8s.io/yaml v1.4.0
)

Expand Down Expand Up @@ -113,7 +113,7 @@ require (
golang.org/x/tools v0.22.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
google.golang.org/api v0.183.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240521202816-d264139d666e // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 // indirect
google.golang.org/grpc v1.64.0 // indirect
google.golang.org/protobuf v1.34.1 // indirect
Expand Down
32 changes: 16 additions & 16 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,8 @@ github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 h1:YBftPWNWd4WwGqtY2yeZL2ef8rH
github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9Kz84aCaG7AsGZnLjhHbUqwPg=
github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ=
github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
github.com/hashicorp/go-retryablehttp v0.6.7 h1:8/CAEZt/+F7kR7GevNHulKkUjLht3CPmn7egmhieNKo=
github.com/hashicorp/go-retryablehttp v0.6.7/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY=
github.com/hashicorp/go-retryablehttp v0.7.7 h1:C8hUCYzor8PIfXHa4UrZkU4VvK8o9ISHxT2Q8+VepXU=
github.com/hashicorp/go-retryablehttp v0.7.7/go.mod h1:pkQpWZeYWskR+D1tR2O5OcBFOxfA7DoAO6xtkuQnHTk=
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c=
Expand Down Expand Up @@ -738,8 +738,8 @@ google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6D
google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto/googleapis/api v0.0.0-20240521202816-d264139d666e h1:SkdGTrROJl2jRGT/Fxv5QUf9jtdKCQh4KQJXbXVLAi0=
google.golang.org/genproto/googleapis/api v0.0.0-20240521202816-d264139d666e/go.mod h1:LweJcLbyVij6rCex8YunD8DYR5VDonap/jYl3ZRxcIU=
google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 h1:+rdxYoE3E5htTEWIe15GlN6IfvbURM//Jt0mmkmm6ZU=
google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117/go.mod h1:OimBR/bc1wPO9iV4NC2bpyjy3VnAwZh5EBPQdtaE5oo=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 h1:Zy9XzmMEflZ/MAaA7vNcoebnRAld7FsPW1EeBB7V0m8=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
Expand Down Expand Up @@ -832,18 +832,18 @@ k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 h1:aVUu9fTY98ivBPKR9Y5w/A
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00/go.mod h1:AsvuZPBlUDVuCdzJ87iajxtXuR9oktsTctW/R9wwouA=
k8s.io/utils v0.0.0-20240102154912-e7106e64919e h1:eQ/4ljkx21sObifjzXwlPKpdGLrCfRziVtos3ofG/sQ=
k8s.io/utils v0.0.0-20240102154912-e7106e64919e/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
knative.dev/client-pkg v0.0.0-20240607132727-8fbea3d02b53 h1:L9LG8J5Efl0wX0Kgab2UOi40tUnQC3g/KkcCTPTVe88=
knative.dev/client-pkg v0.0.0-20240607132727-8fbea3d02b53/go.mod h1:KK2I9/U/k24Y7l4OwmluGEtV5CWoccjewRauaTJLOr4=
knative.dev/eventing v0.41.1-0.20240613093107-ea8f0fda4c06 h1:GYVCeO9+udWWzNfyWlBrclwB07kxzIElbhCCtFrsIRo=
knative.dev/eventing v0.41.1-0.20240613093107-ea8f0fda4c06/go.mod h1:PQpuuOYjAl6rW74U+1CgcKP9IyKhk7XhS8aAu9zWQG0=
knative.dev/hack v0.0.0-20240607132042-09143140a254 h1:1YFnu3U6dWZg0oxm6GU8kEdA9A+BvSWKJO7sg3N0kq8=
knative.dev/hack v0.0.0-20240607132042-09143140a254/go.mod h1:yk2OjGDsbEnQjfxdm0/HJKS2WqTLEFg/N6nUs6Rqx3Q=
knative.dev/networking v0.0.0-20240611072033-3b8764c0bb4c h1:Q+DdJYzvhwAVWMQtP6mbEr5dNxpr+K9HAF9RqJmZefY=
knative.dev/networking v0.0.0-20240611072033-3b8764c0bb4c/go.mod h1:WhZLv94eOMDGHbdZiMrw6cnRfN3WEcFgpjUcV0A48pI=
knative.dev/pkg v0.0.0-20240614135239-339c22b8218c h1:OaKrY7L6rzWTvs51JlieJajL40F6CpBbvO1aZspg2EA=
knative.dev/pkg v0.0.0-20240614135239-339c22b8218c/go.mod h1:l7R8/SteYph0mZDsVgq3fVs4mWp1DaYx9BJJX68U6ik=
knative.dev/serving v0.41.1-0.20240614080555-1f7cc4852a07 h1:Qcf6ytf+Ug1Xu7NBn/kFH+qtzXQ8ASoGiEmtNx53UpU=
knative.dev/serving v0.41.1-0.20240614080555-1f7cc4852a07/go.mod h1:Z58WxiVmEynF1kX8cK4fYmNprj8IkPLl2mEHdvuP6nc=
knative.dev/client-pkg v0.0.0-20240704014437-18eac77f7749 h1:gv7ehDLzk/D6dBfPkY7cIChuZhDkf6K3a+/9Kmj0vz0=
knative.dev/client-pkg v0.0.0-20240704014437-18eac77f7749/go.mod h1:KK2I9/U/k24Y7l4OwmluGEtV5CWoccjewRauaTJLOr4=
knative.dev/eventing v0.41.1-0.20240705133111-fe6bd5682edc h1:a7PW/Y2+VjU1POOAziOEYXx1lQDP8Cuv+AJV128vqQw=
knative.dev/eventing v0.41.1-0.20240705133111-fe6bd5682edc/go.mod h1:3h0QrfHELs61mrTI4GDPEQh4rwsap0YYA5XgRrNgnlc=
knative.dev/hack v0.0.0-20240704013904-b9799599afcf h1:n92FmZRywgtHso7pFAku7CW0qvRAs1hXtMQqO0R6eiE=
knative.dev/hack v0.0.0-20240704013904-b9799599afcf/go.mod h1:yk2OjGDsbEnQjfxdm0/HJKS2WqTLEFg/N6nUs6Rqx3Q=
knative.dev/networking v0.0.0-20240704015122-370ddbb8fd13 h1:ik1TeuFTNAweZiQhUZKnKjE27Imk2vnJXMyanLzcTzo=
knative.dev/networking v0.0.0-20240704015122-370ddbb8fd13/go.mod h1:x0GM7pp5hLZ0OBpJvHsJxMMJ0XKYWW3PQHCMGBlo9Ls=
knative.dev/pkg v0.0.0-20240704013837-7ecd5485cbc6 h1:/oGRGm/csTc0sUHo00MQ3NQrJaRP7iMTGC9bXpeEuuU=
knative.dev/pkg v0.0.0-20240704013837-7ecd5485cbc6/go.mod h1:Wikg4u73T6vk9TctrxZt60VXzqmGEQIx0iKfk1+9o4c=
knative.dev/serving v0.41.1-0.20240708063112-a9239154ab8c h1:IPFCHrZPfpie98kVyeJqgcewOQYXyZvd9O7M7svR6ao=
knative.dev/serving v0.41.1-0.20240708063112-a9239154ab8c/go.mod h1:7+wAf1rE/O2O+92Ft8Bfw3LnDirkg4c/+jKU3giMIoc=
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ type ChannelableStatus struct {
// resolved delivery options.
// +optional
DeliveryStatus `json:",inline"`
// AppliedEventPoliciesStatus contains the list of EventPolicies which apply to this Channel
// +optional
AppliedEventPoliciesStatus `json:",inline"`
}

var (
Expand Down

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 @@ -32,6 +32,7 @@ const (
BrokerConditionFilter apis.ConditionType = "FilterReady"
BrokerConditionAddressable apis.ConditionType = "Addressable"
BrokerConditionDeadLetterSinkResolved apis.ConditionType = "DeadLetterSinkResolved"
BrokerConditionEventPoliciesReady apis.ConditionType = "EventPoliciesReady"
)

var brokerCondSet = apis.NewLivingConditionSet(
Expand All @@ -40,6 +41,7 @@ var brokerCondSet = apis.NewLivingConditionSet(
BrokerConditionFilter,
BrokerConditionAddressable,
BrokerConditionDeadLetterSinkResolved,
BrokerConditionEventPoliciesReady,
)
var brokerCondSetLock = sync.RWMutex{}

Expand Down Expand Up @@ -118,3 +120,19 @@ func (bs *BrokerStatus) MarkDeadLetterSinkResolvedFailed(reason, messageFormat s
bs.DeliveryStatus = eventingduck.DeliveryStatus{}
bs.GetConditionSet().Manage(bs).MarkFalse(BrokerConditionDeadLetterSinkResolved, reason, messageFormat, messageA...)
}

func (bs *BrokerStatus) MarkEventPoliciesTrue() {
bs.GetConditionSet().Manage(bs).MarkTrue(BrokerConditionEventPoliciesReady)
}

func (bs *BrokerStatus) MarkEventPoliciesTrueWithReason(reason, messageFormat string, messageA ...interface{}) {
bs.GetConditionSet().Manage(bs).MarkTrueWithReason(BrokerConditionEventPoliciesReady, reason, messageFormat, messageA...)
}

func (bs *BrokerStatus) MarkEventPoliciesFailed(reason, messageFormat string, messageA ...interface{}) {
bs.GetConditionSet().Manage(bs).MarkFalse(BrokerConditionEventPoliciesReady, reason, messageFormat, messageA...)
}

func (bs *BrokerStatus) MarkEventPoliciesUnknown(reason, messageFormat string, messageA ...interface{}) {
bs.GetConditionSet().Manage(bs).MarkUnknown(BrokerConditionEventPoliciesReady, reason, messageFormat, messageA...)
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ func (t testHelper) ReadyBrokerStatus() *BrokerStatus {
URL: apis.HTTP("example.com"),
})
bs.MarkDeadLetterSinkResolvedSucceeded(eventingduckv1.DeliveryStatus{})
bs.MarkEventPoliciesTrue()
return bs
}

Expand All @@ -77,6 +78,7 @@ func (t testHelper) ReadyBrokerStatusWithoutDLS() *BrokerStatus {
bs.SetAddress(&duckv1.Addressable{
URL: apis.HTTP("example.com"),
})
bs.MarkEventPoliciesTrue()
bs.MarkDeadLetterSinkNotConfigured()
return bs
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ package v1
import (
"context"

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

"knative.dev/pkg/apis"
)

Expand All @@ -29,7 +31,7 @@ const (
func (t *Trigger) SetDefaults(ctx context.Context) {
withNS := apis.WithinParent(ctx, t.ObjectMeta)
t.Spec.SetDefaults(withNS)
setLabels(t)
setLabels(ctx, t)
}

func (ts *TriggerSpec) SetDefaults(ctx context.Context) {
Expand All @@ -42,8 +44,13 @@ func (ts *TriggerSpec) SetDefaults(ctx context.Context) {
ts.Delivery.SetDefaults(ctx)
}

func setLabels(t *Trigger) {
if t.Spec.Broker != "" {
func setLabels(ctx context.Context, t *Trigger) {
if feature.FromContext(ctx).IsEnabled(feature.CrossNamespaceEventLinks) && t.Spec.BrokerRef != nil {
if len(t.Labels) == 0 {
t.Labels = map[string]string{}
}
t.Labels[brokerLabel] = t.Spec.BrokerRef.Name
} else if t.Spec.Broker != "" {
if len(t.Labels) == 0 {
t.Labels = map[string]string{}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2020 The Knative Authors
Copyright 2024 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.
Expand All @@ -20,10 +20,12 @@ import (
"knative.dev/pkg/apis"
)

var eventPolicyCondSet = apis.NewLivingConditionSet()
var eventPolicyCondSet = apis.NewLivingConditionSet(EventPolicyConditionAuthenticationEnabled, EventPolicyConditionSubjectsResolved)

const (
EventPolicyConditionReady = apis.ConditionReady
EventPolicyConditionReady = apis.ConditionReady
EventPolicyConditionAuthenticationEnabled apis.ConditionType = "AuthenticationEnabled"
EventPolicyConditionSubjectsResolved apis.ConditionType = "SubjectsResolved"
)

// GetConditionSet retrieves the condition set for this resource. Implements the KRShaped interface.
Expand All @@ -32,21 +34,41 @@ func (*EventPolicy) GetConditionSet() apis.ConditionSet {
}

// GetCondition returns the condition currently associated with the given type, or nil.
func (et *EventPolicyStatus) GetCondition(t apis.ConditionType) *apis.Condition {
return eventPolicyCondSet.Manage(et).GetCondition(t)
func (ep *EventPolicyStatus) GetCondition(t apis.ConditionType) *apis.Condition {
return eventPolicyCondSet.Manage(ep).GetCondition(t)
}

// IsReady returns true if the resource is ready overall.
func (et *EventPolicyStatus) IsReady() bool {
return et.GetTopLevelCondition().IsTrue()
func (ep *EventPolicyStatus) IsReady() bool {
return ep.GetTopLevelCondition().IsTrue()
}

// GetTopLevelCondition returns the top level Condition.
func (et *EventPolicyStatus) GetTopLevelCondition() *apis.Condition {
return eventPolicyCondSet.Manage(et).GetTopLevelCondition()
func (ep *EventPolicyStatus) GetTopLevelCondition() *apis.Condition {
return eventPolicyCondSet.Manage(ep).GetTopLevelCondition()
}

// InitializeConditions sets relevant unset conditions to Unknown state.
func (et *EventPolicyStatus) InitializeConditions() {
eventPolicyCondSet.Manage(et).InitializeConditions()
func (ep *EventPolicyStatus) InitializeConditions() {
eventPolicyCondSet.Manage(ep).InitializeConditions()
}

// MarkOIDCAuthenticationEnabled sets EventPolicyConditionAuthenticationEnabled condition to true.
func (ep *EventPolicyStatus) MarkOIDCAuthenticationEnabled() {
eventPolicyCondSet.Manage(ep).MarkTrue(EventPolicyConditionAuthenticationEnabled)
}

// MarkOIDCAuthenticationDisabled sets EventPolicyConditionAuthenticationEnabled condition to false.
func (ep *EventPolicyStatus) MarkOIDCAuthenticationDisabled(reason, messageFormat string, messageA ...interface{}) {
eventPolicyCondSet.Manage(ep).MarkFalse(EventPolicyConditionAuthenticationEnabled, reason, messageFormat, messageA...)
}

// MarkSubjectsResolved sets EventPolicyConditionSubjectsResolved condition to true.
func (ep *EventPolicyStatus) MarkSubjectsResolvedSucceeded() {
eventPolicyCondSet.Manage(ep).MarkTrue(EventPolicyConditionSubjectsResolved)
}

// MarkSubjectsNotResolved sets EventPolicyConditionSubjectsResolved condition to false.
func (ep *EventPolicyStatus) MarkSubjectsResolvedFailed(reason, messageFormat string, messageA ...interface{}) {
eventPolicyCondSet.Manage(ep).MarkFalse(EventPolicyConditionSubjectsResolved, reason, messageFormat, messageA...)
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package v1alpha1

import (
"context"
"strings"

"knative.dev/pkg/apis"
)
Expand All @@ -36,6 +37,7 @@ func (ets *EventPolicySpec) Validate(ctx context.Context) *apis.FieldError {
err = err.Also(apis.ErrMultipleOneOf("ref", "sub").ViaFieldIndex("from", i))
}
err = err.Also(f.Ref.Validate().ViaField("ref").ViaFieldIndex("from", i))
err = err.Also(validateSub(f.Sub).ViaField("sub").ViaFieldIndex("from", i))
}

for i, t := range ets.To {
Expand All @@ -53,6 +55,20 @@ func (ets *EventPolicySpec) Validate(ctx context.Context) *apis.FieldError {
return err
}

func validateSub(sub *string) *apis.FieldError {
if sub == nil || len(*sub) <= 1 {
return nil
}

lastInvalidIdx := len(*sub) - 2
firstInvalidIdx := 0
if idx := strings.IndexRune(*sub, '*'); idx >= firstInvalidIdx && idx <= lastInvalidIdx {
return apis.ErrInvalidValue(*sub, "", "'*' is only allowed as suffix")
}

return nil
}

func (r *EventPolicyFromReference) Validate() *apis.FieldError {
if r == nil {
return nil
Expand Down
4 changes: 3 additions & 1 deletion vendor/knative.dev/eventing/pkg/apis/feature/features.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package feature

import (
"fmt"
"log"
"strings"

corev1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -186,7 +187,8 @@ func NewFlagsConfigFromMap(data map[string]string) (Flags, error) {
} else if strings.Contains(k, NodeSelectorLabel) {
flags[sanitizedKey] = Flag(v)
} else {
return flags, fmt.Errorf("cannot parse the feature flag '%s' = '%s'", k, v)
flags[k] = Flag(v)
log.Printf("Warning: unknown feature flag value %q=%q\n", k, v)
}
}

Expand Down
4 changes: 2 additions & 2 deletions vendor/knative.dev/eventing/pkg/apis/feature/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ func FromContext(ctx context.Context) Flags {
}

// FromContextOrDefaults is like FromContext, but when no Flags is attached it
// returns an empty Flags.
// returns default Flags.
func FromContextOrDefaults(ctx context.Context) Flags {
if cfg := FromContext(ctx); cfg != nil {
return cfg
}
return Flags{}
return newDefaults()
}

// ToContext attaches the provided Flags to the provided context, returning the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,13 @@ import (
duckv1 "knative.dev/pkg/apis/duck/v1"
)

var sCondSet = apis.NewLivingConditionSet(SequenceConditionReady, SequenceConditionChannelsReady, SequenceConditionSubscriptionsReady, SequenceConditionAddressable)
var sCondSet = apis.NewLivingConditionSet(
SequenceConditionReady,
SequenceConditionChannelsReady,
SequenceConditionSubscriptionsReady,
SequenceConditionAddressable,
SequenceConditionEventPoliciesReady,
)

const (
// SequenceConditionReady has status True when all subconditions below have been set to True.
Expand All @@ -45,6 +51,10 @@ const (
// SequenceConditionAddressable has status true when this Sequence meets
// the Addressable contract and has a non-empty hostname.
SequenceConditionAddressable apis.ConditionType = "Addressable"

// SequenceConditionEventPoliciesReady has status True when all the applying EventPolicies for this
// Sequence are ready.
SequenceConditionEventPoliciesReady apis.ConditionType = "EventPoliciesReady"
)

// GetConditionSet retrieves the condition set for this resource. Implements the KRShaped interface.
Expand Down Expand Up @@ -189,6 +199,22 @@ func (ss *SequenceStatus) MarkAddressableNotReady(reason, messageFormat string,
sCondSet.Manage(ss).MarkUnknown(SequenceConditionAddressable, reason, messageFormat, messageA...)
}

func (ss *SequenceStatus) MarkEventPoliciesFailed(reason, messageFormat string, messageA ...interface{}) {
sCondSet.Manage(ss).MarkFalse(SequenceConditionEventPoliciesReady, reason, messageFormat, messageA...)
}

func (ss *SequenceStatus) MarkEventPoliciesUnknown(reason, messageFormat string, messageA ...interface{}) {
sCondSet.Manage(ss).MarkUnknown(SequenceConditionEventPoliciesReady, reason, messageFormat, messageA...)
}

func (ss *SequenceStatus) MarkEventPoliciesTrue() {
sCondSet.Manage(ss).MarkTrue(SequenceConditionEventPoliciesReady)
}

func (ss *SequenceStatus) MarkEventPoliciesTrueWithReason(reason, messageFormat string, messageA ...interface{}) {
sCondSet.Manage(ss).MarkTrueWithReason(SequenceConditionEventPoliciesReady, reason, messageFormat, messageA...)
}

func (ss *SequenceStatus) setAddress(address *duckv1.Addressable) {
if address == nil || address.URL == nil {
ss.Address = duckv1.Addressable{}
Expand Down
Loading

0 comments on commit d1223f3

Please sign in to comment.