diff --git a/go.mod b/go.mod index c5403f9920..b4baaacf99 100644 --- a/go.mod +++ b/go.mod @@ -21,10 +21,10 @@ require ( k8s.io/client-go v0.27.6 k8s.io/code-generator v0.27.6 k8s.io/kube-openapi v0.0.0-20230928205116-a78145627833 - knative.dev/eventing v0.39.1-0.20231114180859-d964da3a8ace + knative.dev/eventing v0.39.1-0.20231117075909-dc965225f635 knative.dev/hack v0.0.0-20231109190034-5deaddeb51a7 knative.dev/pkg v0.0.0-20231115001034-97c7258e3a98 - knative.dev/reconciler-test v0.0.0-20231109234136-36fcbd054949 + knative.dev/reconciler-test v0.0.0-20231115072946-99723665c94d sigs.k8s.io/controller-runtime v0.15.2 ) diff --git a/go.sum b/go.sum index 55ad85d0e5..5d604d1310 100644 --- a/go.sum +++ b/go.sum @@ -1870,14 +1870,14 @@ k8s.io/kube-openapi v0.0.0-20230928205116-a78145627833 h1:iFFEmmB7szQhJP42AvRD2+ k8s.io/kube-openapi v0.0.0-20230928205116-a78145627833/go.mod h1:AsvuZPBlUDVuCdzJ87iajxtXuR9oktsTctW/R9wwouA= k8s.io/utils v0.0.0-20230726121419-3b25d923346b h1:sgn3ZU783SCgtaSJjpcVVlRqd6GSnlTLKgpAAttJvpI= k8s.io/utils v0.0.0-20230726121419-3b25d923346b/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= -knative.dev/eventing v0.39.1-0.20231114180859-d964da3a8ace h1:zKNCpnzCVHO8YqHiKX/l3PmpEiirG0z517j3Qf1B9p4= -knative.dev/eventing v0.39.1-0.20231114180859-d964da3a8ace/go.mod h1:bG5Dzu03aolsgCmoUwCYjcQuI4Puo31dBz7Ho/ZYZg4= +knative.dev/eventing v0.39.1-0.20231117075909-dc965225f635 h1:UuDZus9PmvDRLDsPe2M8abuoorvx53SMIbqJkpmuR2w= +knative.dev/eventing v0.39.1-0.20231117075909-dc965225f635/go.mod h1:LGZfBR1ykKiLBF06aX+C7vqe4HogiNc9MmFpJz9lvtw= knative.dev/hack v0.0.0-20231109190034-5deaddeb51a7 h1:HXf7M7n9jwn+Hp904r0HXRSymf+DLXSciFpXVpCg+Bs= knative.dev/hack v0.0.0-20231109190034-5deaddeb51a7/go.mod h1:yk2OjGDsbEnQjfxdm0/HJKS2WqTLEFg/N6nUs6Rqx3Q= knative.dev/pkg v0.0.0-20231115001034-97c7258e3a98 h1:uvOLwp5Ar7oJlaYEszh51CemuZc1sRRI14xzKhUEF3U= knative.dev/pkg v0.0.0-20231115001034-97c7258e3a98/go.mod h1:56Qcm0ai7xPWqGxpOnjRi4sAX9fZM9UDTk7fKyjUqZM= -knative.dev/reconciler-test v0.0.0-20231109234136-36fcbd054949 h1:/YkzlzrywuNVwpGyLVgFkwbmmRpXxNL1gcXQ4xkELGY= -knative.dev/reconciler-test v0.0.0-20231109234136-36fcbd054949/go.mod h1:Ps0NWuOGMxNZcnc2kpnPfySnPZ+eGc0LDEEk4qhPI6I= +knative.dev/reconciler-test v0.0.0-20231115072946-99723665c94d h1:pvpbn1jetRm2qk2nGFS0Wrujmmu+dnkEi3a3aNlVVbQ= +knative.dev/reconciler-test v0.0.0-20231115072946-99723665c94d/go.mod h1:V5dY5ZYfAwVe2JzJ6+WSwg1v9uzTrDR/vb0EHC01C+g= lukechampine.com/uint128 v1.1.1/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk= lukechampine.com/uint128 v1.2.0/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk= modernc.org/cc/v3 v3.36.0/go.mod h1:NFUHyPn4ekoC/JHeZFfZurN6ixxawE1BnVonP/oahEI= diff --git a/vendor/knative.dev/eventing/pkg/apis/config/defaults.go b/vendor/knative.dev/eventing/pkg/apis/config/defaults.go index 368f1be7e6..f12b83ab53 100644 --- a/vendor/knative.dev/eventing/pkg/apis/config/defaults.go +++ b/vendor/knative.dev/eventing/pkg/apis/config/defaults.go @@ -85,6 +85,8 @@ type Defaults struct { type ClassAndBrokerConfig struct { BrokerClass string `json:"brokerClass,omitempty"` *BrokerConfig `json:",inline"` + + DisallowDifferentNamespaceConfig *bool `json:"disallowDifferentNamespaceConfig,omitempty"` } // BrokerConfig contains configuration for a given namespace for broker. Allows diff --git a/vendor/knative.dev/eventing/pkg/apis/config/zz_generated.deepcopy.go b/vendor/knative.dev/eventing/pkg/apis/config/zz_generated.deepcopy.go index a57b366a93..e02665cc87 100644 --- a/vendor/knative.dev/eventing/pkg/apis/config/zz_generated.deepcopy.go +++ b/vendor/knative.dev/eventing/pkg/apis/config/zz_generated.deepcopy.go @@ -60,6 +60,11 @@ func (in *ClassAndBrokerConfig) DeepCopyInto(out *ClassAndBrokerConfig) { *out = new(BrokerConfig) (*in).DeepCopyInto(*out) } + if in.DisallowDifferentNamespaceConfig != nil { + in, out := &in.DisallowDifferentNamespaceConfig, &out.DisallowDifferentNamespaceConfig + *out = new(bool) + **out = **in + } return } diff --git a/vendor/knative.dev/eventing/pkg/apis/eventing/v1/broker_validation.go b/vendor/knative.dev/eventing/pkg/apis/eventing/v1/broker_validation.go index d6c4180c68..1829872f9e 100644 --- a/vendor/knative.dev/eventing/pkg/apis/eventing/v1/broker_validation.go +++ b/vendor/knative.dev/eventing/pkg/apis/eventing/v1/broker_validation.go @@ -23,6 +23,8 @@ import ( "knative.dev/pkg/apis" "knative.dev/pkg/kmp" + + "knative.dev/eventing/pkg/apis/config" ) const ( @@ -30,7 +32,22 @@ const ( ) func (b *Broker) Validate(ctx context.Context) *apis.FieldError { - withNS := apis.AllowDifferentNamespace(apis.WithinParent(ctx, b.ObjectMeta)) + ctx = apis.WithinParent(ctx, b.ObjectMeta) + + cfg := config.FromContextOrDefaults(ctx) + var brConfig *config.ClassAndBrokerConfig + if cfg.Defaults != nil { + if c, ok := cfg.Defaults.NamespaceDefaultsConfig[b.GetNamespace()]; ok { + brConfig = c + } else { + brConfig = cfg.Defaults.ClusterDefault + } + } + + withNS := ctx + if brConfig == nil || brConfig.DisallowDifferentNamespaceConfig == nil || !*brConfig.DisallowDifferentNamespaceConfig { + withNS = apis.AllowDifferentNamespace(ctx) + } // Make sure a BrokerClassAnnotation exists var errs *apis.FieldError diff --git a/vendor/knative.dev/eventing/pkg/apis/eventing/v1beta1/eventtype_types.go b/vendor/knative.dev/eventing/pkg/apis/eventing/v1beta1/eventtype_types.go index 0c3fd2e8ef..cad21a02e6 100644 --- a/vendor/knative.dev/eventing/pkg/apis/eventing/v1beta1/eventtype_types.go +++ b/vendor/knative.dev/eventing/pkg/apis/eventing/v1beta1/eventtype_types.go @@ -30,6 +30,7 @@ import ( // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // EventType represents a type of event that can be consumed from a Broker. +// Deprecated: use v1beta2.EventType instead. type EventType struct { metav1.TypeMeta `json:",inline"` // +optional diff --git a/vendor/knative.dev/eventing/pkg/apis/flows/v1/parallel_lifecycle.go b/vendor/knative.dev/eventing/pkg/apis/flows/v1/parallel_lifecycle.go index b02363ebfb..34467c058d 100644 --- a/vendor/knative.dev/eventing/pkg/apis/flows/v1/parallel_lifecycle.go +++ b/vendor/knative.dev/eventing/pkg/apis/flows/v1/parallel_lifecycle.go @@ -25,7 +25,7 @@ import ( pkgduckv1 "knative.dev/pkg/apis/duck/v1" ) -var pCondSet = apis.NewLivingConditionSet(ParallelConditionReady, ParallelConditionChannelsReady, ParallelConditionSubscriptionsReady, ParallelConditionAddressable) +var pCondSet = apis.NewLivingConditionSet(ParallelConditionReady, ParallelConditionChannelsReady, ParallelConditionSubscriptionsReady, ParallelConditionAddressable, ParallelConditionOIDCIdentityCreated) const ( // ParallelConditionReady has status True when all subconditions below have been set to True. @@ -41,7 +41,8 @@ const ( // ParallelConditionAddressable has status true when this Parallel meets // the Addressable contract and has a non-empty hostname. - ParallelConditionAddressable apis.ConditionType = "Addressable" + ParallelConditionAddressable apis.ConditionType = "Addressable" + ParallelConditionOIDCIdentityCreated apis.ConditionType = "OIDCIdentityCreated" ) // GetConditionSet retrieves the condition set for this resource. Implements the KRShaped interface. @@ -195,6 +196,22 @@ func (ps *ParallelStatus) MarkAddressableNotReady(reason, messageFormat string, pCondSet.Manage(ps).MarkFalse(ParallelConditionAddressable, reason, messageFormat, messageA...) } +func (ps *ParallelStatus) MarkOIDCIdentityCreatedSucceeded() { + pCondSet.Manage(ps).MarkTrue(ParallelConditionOIDCIdentityCreated) +} + +func (ps *ParallelStatus) MarkOIDCIdentityCreatedSucceededWithReason(reason, messageFormat string, messageA ...interface{}) { + pCondSet.Manage(ps).MarkTrueWithReason(ParallelConditionOIDCIdentityCreated, reason, messageFormat, messageA...) +} + +func (ps *ParallelStatus) MarkOIDCIdentityCreatedFailed(reason, messageFormat string, messageA ...interface{}) { + pCondSet.Manage(ps).MarkFalse(ParallelConditionOIDCIdentityCreated, reason, messageFormat, messageA...) +} + +func (ps *ParallelStatus) MarkOIDCIdentityCreatedUnknown(reason, messageFormat string, messageA ...interface{}) { + pCondSet.Manage(ps).MarkUnknown(ParallelConditionOIDCIdentityCreated, reason, messageFormat, messageA...) +} + func (ps *ParallelStatus) setAddress(address *pkgduckv1.Addressable) { ps.Address = address if address == nil { diff --git a/vendor/knative.dev/eventing/pkg/apis/flows/v1/sequence_lifecycle.go b/vendor/knative.dev/eventing/pkg/apis/flows/v1/sequence_lifecycle.go index bc6559edac..441566e237 100644 --- a/vendor/knative.dev/eventing/pkg/apis/flows/v1/sequence_lifecycle.go +++ b/vendor/knative.dev/eventing/pkg/apis/flows/v1/sequence_lifecycle.go @@ -28,7 +28,8 @@ import ( duckv1 "knative.dev/pkg/apis/duck/v1" ) -var sCondSet = apis.NewLivingConditionSet(SequenceConditionReady, SequenceConditionChannelsReady, SequenceConditionSubscriptionsReady, SequenceConditionAddressable) +var sCondSet = apis.NewLivingConditionSet(SequenceConditionReady, SequenceConditionChannelsReady, SequenceConditionSubscriptionsReady, SequenceConditionAddressable, + SequenceConditionOIDCIdentityCreated) const ( // SequenceConditionReady has status True when all subconditions below have been set to True. @@ -45,6 +46,10 @@ const ( // SequenceConditionAddressable has status true when this Sequence meets // the Addressable contract and has a non-empty hostname. SequenceConditionAddressable apis.ConditionType = "Addressable" + + // SequenceConditionOIDCIdentityCreated has status True when the OIDCIdentity has been created. + // This condition is only relevant if the OIDC feature is enabled. + SequenceConditionOIDCIdentityCreated apis.ConditionType = "OIDCIdentityCreated" ) // GetConditionSet retrieves the condition set for this resource. Implements the KRShaped interface. @@ -190,3 +195,23 @@ func (ss *SequenceStatus) setAddress(address *duckv1.Addressable) { sCondSet.Manage(ss).MarkTrue(SequenceConditionAddressable) } } + +// MarkOIDCIdentityCreatedSucceeded marks the OIDCIdentityCreated condition as true. +func (ss *SequenceStatus) MarkOIDCIdentityCreatedSucceeded() { + sCondSet.Manage(ss).MarkTrue(SequenceConditionOIDCIdentityCreated) +} + +// MarkOIDCIdentityCreatedSucceededWithReason marks the OIDCIdentityCreated condition as true with the given reason. +func (ss *SequenceStatus) MarkOIDCIdentityCreatedSucceededWithReason(reason, messageFormat string, messageA ...interface{}) { + sCondSet.Manage(ss).MarkTrueWithReason(SequenceConditionOIDCIdentityCreated, reason, messageFormat, messageA...) +} + +// MarkOIDCIdentityCreatedFailed marks the OIDCIdentityCreated condition as false with the given reason. +func (ss *SequenceStatus) MarkOIDCIdentityCreatedFailed(reason, messageFormat string, messageA ...interface{}) { + sCondSet.Manage(ss).MarkFalse(SequenceConditionOIDCIdentityCreated, reason, messageFormat, messageA...) +} + +// MarkOIDCIdentityCreatedUnknown marks the OIDCIdentityCreated condition as unknown with the given reason. +func (ss *SequenceStatus) MarkOIDCIdentityCreatedUnknown(reason, messageFormat string, messageA ...interface{}) { + sCondSet.Manage(ss).MarkUnknown(SequenceConditionOIDCIdentityCreated, reason, messageFormat, messageA...) +} diff --git a/vendor/knative.dev/eventing/pkg/reconciler/testing/v1/parallel.go b/vendor/knative.dev/eventing/pkg/reconciler/testing/v1/parallel.go index a9d50c0743..dd8463a14d 100644 --- a/vendor/knative.dev/eventing/pkg/reconciler/testing/v1/parallel.go +++ b/vendor/knative.dev/eventing/pkg/reconciler/testing/v1/parallel.go @@ -18,9 +18,11 @@ package testing import ( "context" + "fmt" "time" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "knative.dev/eventing/pkg/apis/feature" flowsv1 "knative.dev/eventing/pkg/apis/flows/v1" messagingv1 "knative.dev/eventing/pkg/apis/messaging/v1" duckv1 "knative.dev/pkg/apis/duck/v1" @@ -113,3 +115,31 @@ func WithFlowsParallelAddressableNotReady(reason, message string) FlowsParallelO p.Status.MarkAddressableNotReady(reason, message) } } + +func WithFlowsParallelOIDCIdentityCreatedSucceeded() FlowsParallelOption { + return func(p *flowsv1.Parallel) { + p.Status.MarkOIDCIdentityCreatedSucceeded() + } +} + +func WithFlowsParallelOIDCIdentityCreatedSucceededBecauseOIDCFeatureDisabled() FlowsParallelOption { + return func(p *flowsv1.Parallel) { + p.Status.MarkOIDCIdentityCreatedSucceededWithReason(fmt.Sprintf("%s feature disabled", feature.OIDCAuthentication), "") + } +} + +func WithFlowsParallelOIDCIdentityCreatedFailed(reason, message string) FlowsParallelOption { + return func(p *flowsv1.Parallel) { + p.Status.MarkOIDCIdentityCreatedFailed(reason, message) + } +} + +func WithFlowsParallelOIDCServiceAccountName(name string) FlowsParallelOption { + return func(p *flowsv1.Parallel) { + if p.Status.Auth == nil { + p.Status.Auth = &duckv1.AuthStatus{} + } + + p.Status.Auth.ServiceAccountName = &name + } +} diff --git a/vendor/knative.dev/eventing/pkg/reconciler/testing/v1/sequence.go b/vendor/knative.dev/eventing/pkg/reconciler/testing/v1/sequence.go index d54e2b5f11..6423298412 100644 --- a/vendor/knative.dev/eventing/pkg/reconciler/testing/v1/sequence.go +++ b/vendor/knative.dev/eventing/pkg/reconciler/testing/v1/sequence.go @@ -18,9 +18,11 @@ package testing import ( "context" + "fmt" "time" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "knative.dev/eventing/pkg/apis/feature" flowsv1 "knative.dev/eventing/pkg/apis/flows/v1" messagingv1 "knative.dev/eventing/pkg/apis/messaging/v1" duckv1 "knative.dev/pkg/apis/duck/v1" @@ -113,3 +115,31 @@ func WithSequenceAddressableNotReady(reason, message string) SequenceOption { p.Status.MarkAddressableNotReady(reason, message) } } + +func WithSequenceOIDCIdentityCreatedSucceeded() SequenceOption { + return func(s *flowsv1.Sequence) { + s.Status.MarkOIDCIdentityCreatedSucceeded() + } +} + +func WithSequenceOIDCIdentityCreatedSucceededBecauseOIDCFeatureDisabled() SequenceOption { + return func(s *flowsv1.Sequence) { + s.Status.MarkOIDCIdentityCreatedSucceededWithReason(fmt.Sprintf("%s feature disabled", feature.OIDCAuthentication), "") + } +} + +func WithSequenceOIDCIdentityCreatedFailed(reason, message string) SequenceOption { + return func(s *flowsv1.Sequence) { + s.Status.MarkOIDCIdentityCreatedFailed(reason, message) + } +} + +func WithSequenceOIDCServiceAccountName(name string) SequenceOption { + return func(s *flowsv1.Sequence) { + if s.Status.Auth == nil { + s.Status.Auth = &duckv1.AuthStatus{} + } + + s.Status.Auth.ServiceAccountName = &name + } +} diff --git a/vendor/modules.txt b/vendor/modules.txt index c9563ff9b0..5ab189fffd 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1085,7 +1085,7 @@ k8s.io/utils/pointer k8s.io/utils/ptr k8s.io/utils/strings/slices k8s.io/utils/trace -# knative.dev/eventing v0.39.1-0.20231114180859-d964da3a8ace +# knative.dev/eventing v0.39.1-0.20231117075909-dc965225f635 ## explicit; go 1.19 knative.dev/eventing/cmd/heartbeats knative.dev/eventing/pkg/adapter/v2 @@ -1304,7 +1304,7 @@ knative.dev/pkg/webhook/json knative.dev/pkg/webhook/resourcesemantics knative.dev/pkg/webhook/resourcesemantics/defaulting knative.dev/pkg/webhook/resourcesemantics/validation -# knative.dev/reconciler-test v0.0.0-20231109234136-36fcbd054949 +# knative.dev/reconciler-test v0.0.0-20231115072946-99723665c94d ## explicit; go 1.20 knative.dev/reconciler-test/cmd/eventshub knative.dev/reconciler-test/pkg/environment