From a78690bf339e806fd739e338157c7a27de102c47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20St=C3=A4bler?= Date: Wed, 12 Jun 2024 13:02:58 +0200 Subject: [PATCH 01/12] Add AppliedEventPoliciesStatus type --- pkg/apis/eventing/v1/eventpolicy_type.go | 34 ++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 pkg/apis/eventing/v1/eventpolicy_type.go diff --git a/pkg/apis/eventing/v1/eventpolicy_type.go b/pkg/apis/eventing/v1/eventpolicy_type.go new file mode 100644 index 00000000000..9f3cde92aa4 --- /dev/null +++ b/pkg/apis/eventing/v1/eventpolicy_type.go @@ -0,0 +1,34 @@ +/* +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. +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 v1 + +// AppliedEventPoliciesStatus contains the list of policies which apply to a resource +type AppliedEventPoliciesStatus struct { + // Policies holds the list of applied EventPolicies + // +optional + Policies []AppliedEventPoliciesStatusPolicy `json:"policies,omitempty"` +} + +// AppliedEventPoliciesStatusPolicy is the reference to a EventPolicy +type AppliedEventPoliciesStatusPolicy struct { + // APIVersion of the applied EventPolicy. + // This indicates, which version of EventPolicy is supported by the resource. + APIVersion string `json:"apiVersion"` + + // Name of the applied EventPolicy + Name string `json:"name"` +} From 59aed17e128a24ab839334be5c6fb38483afda8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20St=C3=A4bler?= Date: Wed, 12 Jun 2024 13:03:14 +0200 Subject: [PATCH 02/12] Add AppliedEventPoliciesStatus to Broker status --- config/core/resources/broker.yaml | 12 ++++++++++++ pkg/apis/eventing/v1/broker_types.go | 3 +++ 2 files changed, 15 insertions(+) diff --git a/config/core/resources/broker.yaml b/config/core/resources/broker.yaml index 365692f9727..c8e3eea5f39 100644 --- a/config/core/resources/broker.yaml +++ b/config/core/resources/broker.yaml @@ -132,6 +132,18 @@ spec: description: Annotations is additional Status fields for the Resource to save some additional State as well as convey more information to the user. This is roughly akin to Annotations on any k8s resource, just the reconciler conveying richer information outwards. type: object x-kubernetes-preserve-unknown-fields: true + policies: + description: List of applied EventPolicies + type: array + items: + type: object + properties: + apiVersion: + description: The API version of the applied EventPolicy. This indicates, which version of EventPolicy is supported by the resource. + type: string + name: + description: The name of the applied EventPolicy + type: string conditions: description: Conditions the latest available observations of a resource's current state. type: array diff --git a/pkg/apis/eventing/v1/broker_types.go b/pkg/apis/eventing/v1/broker_types.go index e86ffad7cc7..5107d5fc671 100644 --- a/pkg/apis/eventing/v1/broker_types.go +++ b/pkg/apis/eventing/v1/broker_types.go @@ -96,6 +96,9 @@ type BrokerStatus struct { // DeliveryStatus contains a resolved URL to the dead letter sink address, and any other // resolved delivery options. eventingduckv1.DeliveryStatus `json:",inline"` + + // AppliedEventPoliciesStatus contains the list of EventPolicies which apply to this Broker + AppliedEventPoliciesStatus `json:",inline"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object From b4c136a3e9b8325181202ee6d777bb8f140bdca2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20St=C3=A4bler?= Date: Wed, 12 Jun 2024 13:03:23 +0200 Subject: [PATCH 03/12] Add AppliedEventPoliciesStatus to Parallel status --- config/core/resources/parallel.yaml | 12 ++++++++++++ pkg/apis/flows/v1/parallel_types.go | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/config/core/resources/parallel.yaml b/config/core/resources/parallel.yaml index 269eb193022..492e3f119f4 100644 --- a/config/core/resources/parallel.yaml +++ b/config/core/resources/parallel.yaml @@ -589,6 +589,18 @@ spec: description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' type: string + policies: + description: List of applied EventPolicies + type: array + items: + type: object + properties: + apiVersion: + description: The API version of the applied EventPolicy. This indicates, which version of EventPolicy is supported by the resource. + type: string + name: + description: The name of the applied EventPolicy + type: string conditions: description: Conditions the latest available observations of a resource's current state. diff --git a/pkg/apis/flows/v1/parallel_types.go b/pkg/apis/flows/v1/parallel_types.go index cf9d6d6eae0..240d7c873f0 100644 --- a/pkg/apis/flows/v1/parallel_types.go +++ b/pkg/apis/flows/v1/parallel_types.go @@ -20,6 +20,7 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" + eventingv1 "knative.dev/eventing/pkg/apis/eventing/v1" eventingduckv1 "knative.dev/eventing/pkg/apis/duck/v1" messagingv1 "knative.dev/eventing/pkg/apis/messaging/v1" @@ -123,6 +124,9 @@ type ParallelStatus struct { // Auth provides the relevant information for OIDC authentication. // +optional Auth *duckv1.AuthStatus `json:"auth,omitempty"` + + // AppliedEventPoliciesStatus contains the list of EventPolicies which apply to this Broker + eventingv1.AppliedEventPoliciesStatus `json:",inline"` } // ParallelBranchStatus represents the current state of a Parallel branch From 2968d10240b75e4a102e0c09cfa8fa600b5013b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20St=C3=A4bler?= Date: Wed, 12 Jun 2024 13:03:30 +0200 Subject: [PATCH 04/12] Add AppliedEventPoliciesStatus to Sequence status --- config/core/resources/sequence.yaml | 12 ++++++++++++ pkg/apis/flows/v1/sequence_types.go | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/config/core/resources/sequence.yaml b/config/core/resources/sequence.yaml index af6157e4eff..f0021d89c88 100644 --- a/config/core/resources/sequence.yaml +++ b/config/core/resources/sequence.yaml @@ -257,6 +257,18 @@ spec: type: description: Type of condition. type: string + policies: + description: List of applied EventPolicies + type: array + items: + type: object + properties: + apiVersion: + description: The API version of the applied EventPolicy. This indicates, which version of EventPolicy is supported by the resource. + type: string + name: + description: The name of the applied EventPolicy + type: string conditions: description: Conditions the latest available observations of a resource's current state. type: array diff --git a/pkg/apis/flows/v1/sequence_types.go b/pkg/apis/flows/v1/sequence_types.go index e02af40b7e0..874899dae90 100644 --- a/pkg/apis/flows/v1/sequence_types.go +++ b/pkg/apis/flows/v1/sequence_types.go @@ -20,6 +20,7 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" + eventingv1 "knative.dev/eventing/pkg/apis/eventing/v1" "knative.dev/pkg/apis" duckv1 "knative.dev/pkg/apis/duck/v1" @@ -135,6 +136,9 @@ type SequenceStatus struct { // Auth provides the relevant information for OIDC authentication. // +optional Auth *duckv1.AuthStatus `json:"auth,omitempty"` + + // AppliedEventPoliciesStatus contains the list of EventPolicies which apply to this Broker + eventingv1.AppliedEventPoliciesStatus `json:",inline"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object From bbe18db9b8bdd5a72779194a77dbbf84f9f2b3b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20St=C3=A4bler?= Date: Wed, 12 Jun 2024 13:03:43 +0200 Subject: [PATCH 05/12] Add AppliedEventPoliciesStatus to InMemoryChannel status --- .../resources/in-memory-channel.yaml | 12 ++++++++++++ pkg/apis/messaging/v1/in_memory_channel_types.go | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/config/channels/in-memory-channel/resources/in-memory-channel.yaml b/config/channels/in-memory-channel/resources/in-memory-channel.yaml index be64bb4cb3a..be5a469d060 100644 --- a/config/channels/in-memory-channel/resources/in-memory-channel.yaml +++ b/config/channels/in-memory-channel/resources/in-memory-channel.yaml @@ -209,6 +209,18 @@ spec: description: Annotations is additional Status fields for the Resource to save some additional State as well as convey more information to the user. This is roughly akin to Annotations on any k8s resource, just the reconciler conveying richer information outwards. type: object x-kubernetes-preserve-unknown-fields: true + policies: + description: List of applied EventPolicies + type: array + items: + type: object + properties: + apiVersion: + description: The API version of the applied EventPolicy. This indicates, which version of EventPolicy is supported by the resource. + type: string + name: + description: The name of the applied EventPolicy + type: string conditions: description: Conditions the latest available observations of a resource's current state. type: array diff --git a/pkg/apis/messaging/v1/in_memory_channel_types.go b/pkg/apis/messaging/v1/in_memory_channel_types.go index 5b0c971b54b..67d849c8dab 100644 --- a/pkg/apis/messaging/v1/in_memory_channel_types.go +++ b/pkg/apis/messaging/v1/in_memory_channel_types.go @@ -20,6 +20,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" eventingduckv1 "knative.dev/eventing/pkg/apis/duck/v1" + eventingv1 "knative.dev/eventing/pkg/apis/eventing/v1" "knative.dev/pkg/apis" duckv1 "knative.dev/pkg/apis/duck/v1" "knative.dev/pkg/kmeta" @@ -73,6 +74,9 @@ type InMemoryChannelSpec struct { type InMemoryChannelStatus struct { // Channel conforms to Duck type ChannelableStatus. eventingduckv1.ChannelableStatus `json:",inline"` + + // AppliedEventPoliciesStatus contains the list of EventPolicies which apply to this Broker + eventingv1.AppliedEventPoliciesStatus `json:",inline"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object From bc3d74e616303c54543e1f227854e71e48bdd9de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20St=C3=A4bler?= Date: Wed, 12 Jun 2024 13:23:35 +0200 Subject: [PATCH 06/12] Move AppliedEventPoliciesStatus to eventingduckv1 --- .../v1/appliedeventepoliciesstatus_type.go} | 3 ++- pkg/apis/eventing/v1/broker_types.go | 2 +- pkg/apis/flows/v1/parallel_types.go | 4 +--- pkg/apis/flows/v1/sequence_types.go | 4 +--- pkg/apis/messaging/v1/in_memory_channel_types.go | 3 +-- 5 files changed, 6 insertions(+), 10 deletions(-) rename pkg/apis/{eventing/v1/eventpolicy_type.go => duck/v1/appliedeventepoliciesstatus_type.go} (93%) diff --git a/pkg/apis/eventing/v1/eventpolicy_type.go b/pkg/apis/duck/v1/appliedeventepoliciesstatus_type.go similarity index 93% rename from pkg/apis/eventing/v1/eventpolicy_type.go rename to pkg/apis/duck/v1/appliedeventepoliciesstatus_type.go index 9f3cde92aa4..21a207e0bc6 100644 --- a/pkg/apis/eventing/v1/eventpolicy_type.go +++ b/pkg/apis/duck/v1/appliedeventepoliciesstatus_type.go @@ -16,7 +16,8 @@ limitations under the License. package v1 -// AppliedEventPoliciesStatus contains the list of policies which apply to a resource +// AppliedEventPoliciesStatus contains the list of policies which apply to a resource. +// This type is intended to be embedded into a status struct. type AppliedEventPoliciesStatus struct { // Policies holds the list of applied EventPolicies // +optional diff --git a/pkg/apis/eventing/v1/broker_types.go b/pkg/apis/eventing/v1/broker_types.go index 5107d5fc671..fbf38ed704f 100644 --- a/pkg/apis/eventing/v1/broker_types.go +++ b/pkg/apis/eventing/v1/broker_types.go @@ -98,7 +98,7 @@ type BrokerStatus struct { eventingduckv1.DeliveryStatus `json:",inline"` // AppliedEventPoliciesStatus contains the list of EventPolicies which apply to this Broker - AppliedEventPoliciesStatus `json:",inline"` + eventingduckv1.AppliedEventPoliciesStatus `json:",inline"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object diff --git a/pkg/apis/flows/v1/parallel_types.go b/pkg/apis/flows/v1/parallel_types.go index 240d7c873f0..4a4e75f843b 100644 --- a/pkg/apis/flows/v1/parallel_types.go +++ b/pkg/apis/flows/v1/parallel_types.go @@ -20,8 +20,6 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" - eventingv1 "knative.dev/eventing/pkg/apis/eventing/v1" - eventingduckv1 "knative.dev/eventing/pkg/apis/duck/v1" messagingv1 "knative.dev/eventing/pkg/apis/messaging/v1" "knative.dev/pkg/apis" @@ -126,7 +124,7 @@ type ParallelStatus struct { Auth *duckv1.AuthStatus `json:"auth,omitempty"` // AppliedEventPoliciesStatus contains the list of EventPolicies which apply to this Broker - eventingv1.AppliedEventPoliciesStatus `json:",inline"` + eventingduckv1.AppliedEventPoliciesStatus `json:",inline"` } // ParallelBranchStatus represents the current state of a Parallel branch diff --git a/pkg/apis/flows/v1/sequence_types.go b/pkg/apis/flows/v1/sequence_types.go index 874899dae90..d31511ab002 100644 --- a/pkg/apis/flows/v1/sequence_types.go +++ b/pkg/apis/flows/v1/sequence_types.go @@ -20,8 +20,6 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" - eventingv1 "knative.dev/eventing/pkg/apis/eventing/v1" - "knative.dev/pkg/apis" duckv1 "knative.dev/pkg/apis/duck/v1" "knative.dev/pkg/kmeta" @@ -138,7 +136,7 @@ type SequenceStatus struct { Auth *duckv1.AuthStatus `json:"auth,omitempty"` // AppliedEventPoliciesStatus contains the list of EventPolicies which apply to this Broker - eventingv1.AppliedEventPoliciesStatus `json:",inline"` + eventingduckv1.AppliedEventPoliciesStatus `json:",inline"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object diff --git a/pkg/apis/messaging/v1/in_memory_channel_types.go b/pkg/apis/messaging/v1/in_memory_channel_types.go index 67d849c8dab..3ad1fbf0ef5 100644 --- a/pkg/apis/messaging/v1/in_memory_channel_types.go +++ b/pkg/apis/messaging/v1/in_memory_channel_types.go @@ -20,7 +20,6 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" eventingduckv1 "knative.dev/eventing/pkg/apis/duck/v1" - eventingv1 "knative.dev/eventing/pkg/apis/eventing/v1" "knative.dev/pkg/apis" duckv1 "knative.dev/pkg/apis/duck/v1" "knative.dev/pkg/kmeta" @@ -76,7 +75,7 @@ type InMemoryChannelStatus struct { eventingduckv1.ChannelableStatus `json:",inline"` // AppliedEventPoliciesStatus contains the list of EventPolicies which apply to this Broker - eventingv1.AppliedEventPoliciesStatus `json:",inline"` + eventingduckv1.AppliedEventPoliciesStatus `json:",inline"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object From ccce3e4b9f51b85fd293b8b011e97271ed853234 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20St=C3=A4bler?= Date: Wed, 12 Jun 2024 13:36:16 +0200 Subject: [PATCH 07/12] run ./hack/update-codegen.sh --- docs/eventing-api.md | 138 ++++++++++++++++++ pkg/apis/duck/v1/zz_generated.deepcopy.go | 37 +++++ pkg/apis/eventing/v1/zz_generated.deepcopy.go | 1 + pkg/apis/flows/v1/zz_generated.deepcopy.go | 2 + .../messaging/v1/zz_generated.deepcopy.go | 1 + 5 files changed, 179 insertions(+) diff --git a/docs/eventing-api.md b/docs/eventing-api.md index 6bec7a309d8..df87dae0868 100644 --- a/docs/eventing-api.md +++ b/docs/eventing-api.md @@ -43,6 +43,80 @@

Resource Types:
    +

    AppliedEventPoliciesStatus +

    +

    +(Appears on:BrokerStatus, ParallelStatus, SequenceStatus, InMemoryChannelStatus) +

    +

    +

    AppliedEventPoliciesStatus contains the list of policies which apply to a resource. +This type is intended to be embedded into a status struct.

    +

    + + + + + + + + + + + + + +
    FieldDescription
    +policies
    + + +[]AppliedEventPoliciesStatusPolicy + + +
    +(Optional) +

    Policies holds the list of applied EventPolicies

    +
    +

    AppliedEventPoliciesStatusPolicy +

    +

    +(Appears on:AppliedEventPoliciesStatus) +

    +

    +

    AppliedEventPoliciesStatusPolicy is the reference to a EventPolicy

    +

    + + + + + + + + + + + + + + + + + +
    FieldDescription
    +apiVersion
    + +string + +
    +

    APIVersion of the applied EventPolicy. +This indicates, which version of EventPolicy is supported by the resource.

    +
    +name
    + +string + +
    +

    Name of the applied EventPolicy

    +

    BackoffPolicyType (string alias)

    @@ -2099,6 +2173,22 @@ DeliveryStatus resolved delivery options.

    + + +AppliedEventPoliciesStatus
    + + +AppliedEventPoliciesStatus + + + + +

    +(Members of AppliedEventPoliciesStatus are embedded into this type.) +

    +

    AppliedEventPoliciesStatus contains the list of EventPolicies which apply to this Broker

    + +

    SubscriptionsAPIFilter @@ -3859,6 +3949,22 @@ knative.dev/pkg/apis/duck/v1.AuthStatus

    Auth provides the relevant information for OIDC authentication.

    + + +AppliedEventPoliciesStatus
    + + +AppliedEventPoliciesStatus + + + + +

    +(Members of AppliedEventPoliciesStatus are embedded into this type.) +

    +

    AppliedEventPoliciesStatus contains the list of EventPolicies which apply to this Broker

    + +

    ParallelSubscriptionStatus @@ -4207,6 +4313,22 @@ knative.dev/pkg/apis/duck/v1.AuthStatus

    Auth provides the relevant information for OIDC authentication.

    + + +AppliedEventPoliciesStatus
    + + +AppliedEventPoliciesStatus + + + + +

    +(Members of AppliedEventPoliciesStatus are embedded into this type.) +

    +

    AppliedEventPoliciesStatus contains the list of EventPolicies which apply to this Broker

    + +

    SequenceStep @@ -4880,6 +5002,22 @@ ChannelableStatus

    Channel conforms to Duck type ChannelableStatus.

    + + +AppliedEventPoliciesStatus
    + + +AppliedEventPoliciesStatus + + + + +

    +(Members of AppliedEventPoliciesStatus are embedded into this type.) +

    +

    AppliedEventPoliciesStatus contains the list of EventPolicies which apply to this Broker

    + +

    SubscriptionSpec diff --git a/pkg/apis/duck/v1/zz_generated.deepcopy.go b/pkg/apis/duck/v1/zz_generated.deepcopy.go index 0dcd45cf788..b755f8c044c 100644 --- a/pkg/apis/duck/v1/zz_generated.deepcopy.go +++ b/pkg/apis/duck/v1/zz_generated.deepcopy.go @@ -27,6 +27,43 @@ import ( duckv1 "knative.dev/pkg/apis/duck/v1" ) +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AppliedEventPoliciesStatus) DeepCopyInto(out *AppliedEventPoliciesStatus) { + *out = *in + if in.Policies != nil { + in, out := &in.Policies, &out.Policies + *out = make([]AppliedEventPoliciesStatusPolicy, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AppliedEventPoliciesStatus. +func (in *AppliedEventPoliciesStatus) DeepCopy() *AppliedEventPoliciesStatus { + if in == nil { + return nil + } + out := new(AppliedEventPoliciesStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AppliedEventPoliciesStatusPolicy) DeepCopyInto(out *AppliedEventPoliciesStatusPolicy) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AppliedEventPoliciesStatusPolicy. +func (in *AppliedEventPoliciesStatusPolicy) DeepCopy() *AppliedEventPoliciesStatusPolicy { + if in == nil { + return nil + } + out := new(AppliedEventPoliciesStatusPolicy) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Channelable) DeepCopyInto(out *Channelable) { *out = *in diff --git a/pkg/apis/eventing/v1/zz_generated.deepcopy.go b/pkg/apis/eventing/v1/zz_generated.deepcopy.go index 41765815e95..b873f4032a0 100644 --- a/pkg/apis/eventing/v1/zz_generated.deepcopy.go +++ b/pkg/apis/eventing/v1/zz_generated.deepcopy.go @@ -121,6 +121,7 @@ func (in *BrokerStatus) DeepCopyInto(out *BrokerStatus) { in.Status.DeepCopyInto(&out.Status) in.AddressStatus.DeepCopyInto(&out.AddressStatus) in.DeliveryStatus.DeepCopyInto(&out.DeliveryStatus) + in.AppliedEventPoliciesStatus.DeepCopyInto(&out.AppliedEventPoliciesStatus) return } diff --git a/pkg/apis/flows/v1/zz_generated.deepcopy.go b/pkg/apis/flows/v1/zz_generated.deepcopy.go index 64a7474117b..03008035d86 100644 --- a/pkg/apis/flows/v1/zz_generated.deepcopy.go +++ b/pkg/apis/flows/v1/zz_generated.deepcopy.go @@ -209,6 +209,7 @@ func (in *ParallelStatus) DeepCopyInto(out *ParallelStatus) { *out = new(duckv1.AuthStatus) (*in).DeepCopyInto(*out) } + in.AppliedEventPoliciesStatus.DeepCopyInto(&out.AppliedEventPoliciesStatus) return } @@ -376,6 +377,7 @@ func (in *SequenceStatus) DeepCopyInto(out *SequenceStatus) { *out = new(duckv1.AuthStatus) (*in).DeepCopyInto(*out) } + in.AppliedEventPoliciesStatus.DeepCopyInto(&out.AppliedEventPoliciesStatus) return } diff --git a/pkg/apis/messaging/v1/zz_generated.deepcopy.go b/pkg/apis/messaging/v1/zz_generated.deepcopy.go index fff2d237b49..f0e08f87f5f 100644 --- a/pkg/apis/messaging/v1/zz_generated.deepcopy.go +++ b/pkg/apis/messaging/v1/zz_generated.deepcopy.go @@ -245,6 +245,7 @@ func (in *InMemoryChannelSpec) DeepCopy() *InMemoryChannelSpec { func (in *InMemoryChannelStatus) DeepCopyInto(out *InMemoryChannelStatus) { *out = *in in.ChannelableStatus.DeepCopyInto(&out.ChannelableStatus) + in.AppliedEventPoliciesStatus.DeepCopyInto(&out.AppliedEventPoliciesStatus) return } From e0382c06795761f3b9ee4a1610705eef776efb3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20St=C3=A4bler?= Date: Wed, 12 Jun 2024 13:39:50 +0200 Subject: [PATCH 08/12] Fix typo in filename and rename --- ...edeventepoliciesstatus_type.go => eventpoliciesstatus_type.go} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename pkg/apis/duck/v1/{appliedeventepoliciesstatus_type.go => eventpoliciesstatus_type.go} (100%) diff --git a/pkg/apis/duck/v1/appliedeventepoliciesstatus_type.go b/pkg/apis/duck/v1/eventpoliciesstatus_type.go similarity index 100% rename from pkg/apis/duck/v1/appliedeventepoliciesstatus_type.go rename to pkg/apis/duck/v1/eventpoliciesstatus_type.go From 8e5ab4cf796eb7a18d0260fae1debcf8aebe5088 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20St=C3=A4bler?= Date: Wed, 12 Jun 2024 13:57:08 +0200 Subject: [PATCH 09/12] Mark .status.policies as optional --- docs/eventing-api.md | 4 ++++ pkg/apis/eventing/v1/broker_types.go | 1 + pkg/apis/flows/v1/parallel_types.go | 1 + pkg/apis/flows/v1/sequence_types.go | 1 + pkg/apis/messaging/v1/in_memory_channel_types.go | 1 + 5 files changed, 8 insertions(+) diff --git a/docs/eventing-api.md b/docs/eventing-api.md index df87dae0868..36b7d106bcb 100644 --- a/docs/eventing-api.md +++ b/docs/eventing-api.md @@ -2186,6 +2186,7 @@ AppliedEventPoliciesStatus

    (Members of AppliedEventPoliciesStatus are embedded into this type.)

    +(Optional)

    AppliedEventPoliciesStatus contains the list of EventPolicies which apply to this Broker

    @@ -3962,6 +3963,7 @@ AppliedEventPoliciesStatus

    (Members of AppliedEventPoliciesStatus are embedded into this type.)

    +(Optional)

    AppliedEventPoliciesStatus contains the list of EventPolicies which apply to this Broker

    @@ -4326,6 +4328,7 @@ AppliedEventPoliciesStatus

    (Members of AppliedEventPoliciesStatus are embedded into this type.)

    +(Optional)

    AppliedEventPoliciesStatus contains the list of EventPolicies which apply to this Broker

    @@ -5015,6 +5018,7 @@ AppliedEventPoliciesStatus

    (Members of AppliedEventPoliciesStatus are embedded into this type.)

    +(Optional)

    AppliedEventPoliciesStatus contains the list of EventPolicies which apply to this Broker

    diff --git a/pkg/apis/eventing/v1/broker_types.go b/pkg/apis/eventing/v1/broker_types.go index fbf38ed704f..f536a879b2f 100644 --- a/pkg/apis/eventing/v1/broker_types.go +++ b/pkg/apis/eventing/v1/broker_types.go @@ -98,6 +98,7 @@ type BrokerStatus struct { eventingduckv1.DeliveryStatus `json:",inline"` // AppliedEventPoliciesStatus contains the list of EventPolicies which apply to this Broker + // +optional eventingduckv1.AppliedEventPoliciesStatus `json:",inline"` } diff --git a/pkg/apis/flows/v1/parallel_types.go b/pkg/apis/flows/v1/parallel_types.go index 4a4e75f843b..2740a72f010 100644 --- a/pkg/apis/flows/v1/parallel_types.go +++ b/pkg/apis/flows/v1/parallel_types.go @@ -124,6 +124,7 @@ type ParallelStatus struct { Auth *duckv1.AuthStatus `json:"auth,omitempty"` // AppliedEventPoliciesStatus contains the list of EventPolicies which apply to this Broker + // +optional eventingduckv1.AppliedEventPoliciesStatus `json:",inline"` } diff --git a/pkg/apis/flows/v1/sequence_types.go b/pkg/apis/flows/v1/sequence_types.go index d31511ab002..88461b092c8 100644 --- a/pkg/apis/flows/v1/sequence_types.go +++ b/pkg/apis/flows/v1/sequence_types.go @@ -136,6 +136,7 @@ type SequenceStatus struct { Auth *duckv1.AuthStatus `json:"auth,omitempty"` // AppliedEventPoliciesStatus contains the list of EventPolicies which apply to this Broker + // +optional eventingduckv1.AppliedEventPoliciesStatus `json:",inline"` } diff --git a/pkg/apis/messaging/v1/in_memory_channel_types.go b/pkg/apis/messaging/v1/in_memory_channel_types.go index 3ad1fbf0ef5..cdf0f6075ba 100644 --- a/pkg/apis/messaging/v1/in_memory_channel_types.go +++ b/pkg/apis/messaging/v1/in_memory_channel_types.go @@ -75,6 +75,7 @@ type InMemoryChannelStatus struct { eventingduckv1.ChannelableStatus `json:",inline"` // AppliedEventPoliciesStatus contains the list of EventPolicies which apply to this Broker + // +optional eventingduckv1.AppliedEventPoliciesStatus `json:",inline"` } From f6955d3754c6dcf08e8d7b85ec61fd9579b63974 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20St=C3=A4bler?= Date: Wed, 12 Jun 2024 13:57:31 +0200 Subject: [PATCH 10/12] Fix build issue in IMC lifecycle unit test --- pkg/apis/messaging/v1/in_memory_channel_lifecycle_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/apis/messaging/v1/in_memory_channel_lifecycle_test.go b/pkg/apis/messaging/v1/in_memory_channel_lifecycle_test.go index 34bb45a96ff..7c97a86ed21 100644 --- a/pkg/apis/messaging/v1/in_memory_channel_lifecycle_test.go +++ b/pkg/apis/messaging/v1/in_memory_channel_lifecycle_test.go @@ -150,7 +150,7 @@ func TestInMemoryChannelInitializeConditions(t *testing.T) { }, { name: "one false", cs: &InMemoryChannelStatus{ - eventingduckv1.ChannelableStatus{ + ChannelableStatus: eventingduckv1.ChannelableStatus{ Status: duckv1.Status{ Conditions: []apis.Condition{{ Type: InMemoryChannelConditionDispatcherReady, @@ -160,7 +160,7 @@ func TestInMemoryChannelInitializeConditions(t *testing.T) { }, }, want: &InMemoryChannelStatus{ - eventingduckv1.ChannelableStatus{ + ChannelableStatus: eventingduckv1.ChannelableStatus{ Status: duckv1.Status{ Conditions: []apis.Condition{{ Type: InMemoryChannelConditionAddressable, From 1d25509427819984438d72c8fec30208822f6087 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20St=C3=A4bler?= Date: Wed, 12 Jun 2024 15:52:56 +0200 Subject: [PATCH 11/12] Included review feedback (AppliedEventPoliciesStatusPolicy -> AppliedEventPolicyRef) --- docs/eventing-api.md | 8 ++++---- pkg/apis/duck/v1/eventpoliciesstatus_type.go | 6 +++--- pkg/apis/duck/v1/zz_generated.deepcopy.go | 10 +++++----- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/eventing-api.md b/docs/eventing-api.md index 36b7d106bcb..5776fc4567e 100644 --- a/docs/eventing-api.md +++ b/docs/eventing-api.md @@ -64,8 +64,8 @@ This type is intended to be embedded into a status struct.

    policies
    - -[]AppliedEventPoliciesStatusPolicy + +[]AppliedEventPolicyRef @@ -76,13 +76,13 @@ This type is intended to be embedded into a status struct.

    -

    AppliedEventPoliciesStatusPolicy +

    AppliedEventPolicyRef

    (Appears on:AppliedEventPoliciesStatus)

    -

    AppliedEventPoliciesStatusPolicy is the reference to a EventPolicy

    +

    AppliedEventPolicyRef is the reference to a EventPolicy

    diff --git a/pkg/apis/duck/v1/eventpoliciesstatus_type.go b/pkg/apis/duck/v1/eventpoliciesstatus_type.go index 21a207e0bc6..d895e075eb7 100644 --- a/pkg/apis/duck/v1/eventpoliciesstatus_type.go +++ b/pkg/apis/duck/v1/eventpoliciesstatus_type.go @@ -21,11 +21,11 @@ package v1 type AppliedEventPoliciesStatus struct { // Policies holds the list of applied EventPolicies // +optional - Policies []AppliedEventPoliciesStatusPolicy `json:"policies,omitempty"` + Policies []AppliedEventPolicyRef `json:"policies,omitempty"` } -// AppliedEventPoliciesStatusPolicy is the reference to a EventPolicy -type AppliedEventPoliciesStatusPolicy struct { +// AppliedEventPolicyRef is the reference to an EventPolicy +type AppliedEventPolicyRef struct { // APIVersion of the applied EventPolicy. // This indicates, which version of EventPolicy is supported by the resource. APIVersion string `json:"apiVersion"` diff --git a/pkg/apis/duck/v1/zz_generated.deepcopy.go b/pkg/apis/duck/v1/zz_generated.deepcopy.go index b755f8c044c..609c7f6f6e0 100644 --- a/pkg/apis/duck/v1/zz_generated.deepcopy.go +++ b/pkg/apis/duck/v1/zz_generated.deepcopy.go @@ -32,7 +32,7 @@ func (in *AppliedEventPoliciesStatus) DeepCopyInto(out *AppliedEventPoliciesStat *out = *in if in.Policies != nil { in, out := &in.Policies, &out.Policies - *out = make([]AppliedEventPoliciesStatusPolicy, len(*in)) + *out = make([]AppliedEventPolicyRef, len(*in)) copy(*out, *in) } return @@ -49,17 +49,17 @@ func (in *AppliedEventPoliciesStatus) DeepCopy() *AppliedEventPoliciesStatus { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AppliedEventPoliciesStatusPolicy) DeepCopyInto(out *AppliedEventPoliciesStatusPolicy) { +func (in *AppliedEventPolicyRef) DeepCopyInto(out *AppliedEventPolicyRef) { *out = *in return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AppliedEventPoliciesStatusPolicy. -func (in *AppliedEventPoliciesStatusPolicy) DeepCopy() *AppliedEventPoliciesStatusPolicy { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AppliedEventPolicyRef. +func (in *AppliedEventPolicyRef) DeepCopy() *AppliedEventPolicyRef { if in == nil { return nil } - out := new(AppliedEventPoliciesStatusPolicy) + out := new(AppliedEventPolicyRef) in.DeepCopyInto(out) return out } From e6d9058d88cf4b50eea8dfb77d83b604867261ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20St=C3=A4bler?= Date: Wed, 12 Jun 2024 16:22:50 +0200 Subject: [PATCH 12/12] Fix verify issue --- docs/eventing-api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/eventing-api.md b/docs/eventing-api.md index 5776fc4567e..dfeb7189a91 100644 --- a/docs/eventing-api.md +++ b/docs/eventing-api.md @@ -82,7 +82,7 @@ This type is intended to be embedded into a status struct.

    (Appears on:AppliedEventPoliciesStatus)

    -

    AppliedEventPolicyRef is the reference to a EventPolicy

    +

    AppliedEventPolicyRef is the reference to an EventPolicy