Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List applying EventPolicies in Brokers status #4054

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions control-plane/pkg/reconciler/base/receiver_condition_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ const (
ConditionConfigParsed apis.ConditionType = "ConfigParsed"
ConditionInitialOffsetsCommitted apis.ConditionType = "InitialOffsetsCommitted"
ConditionProbeSucceeded apis.ConditionType = "ProbeSucceeded"
ConditionEventPoliciesReady apis.ConditionType = "EventPoliciesReady"
)

var IngressConditionSet = apis.NewLivingConditionSet(
Expand All @@ -51,6 +52,7 @@ var IngressConditionSet = apis.NewLivingConditionSet(
ConditionConfigMapUpdated,
ConditionConfigParsed,
ConditionProbeSucceeded,
ConditionEventPoliciesReady,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty sure that since this condition set is used by all components that receive events, we will need to set this condition to some form of "ready" value in the kafka sink and kafka channel reconciler code so that the tests can deploy properly

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I updated it for KafkaSink. KafkaChannel seems to set its own ConditionSet (which we then need to update, when we add the support in the KafkaChannel):

messagingv1beta.RegisterAlternateKafkaChannelConditionSet(conditionSet)

)

var EgressConditionSet = apis.NewLivingConditionSet(
Expand Down
8 changes: 8 additions & 0 deletions control-plane/pkg/reconciler/broker/broker.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"knative.dev/eventing-kafka-broker/control-plane/pkg/receiver"
"knative.dev/eventing-kafka-broker/control-plane/pkg/reconciler/base"
"knative.dev/eventing-kafka-broker/control-plane/pkg/security"
eventingv1alpha1listers "knative.dev/eventing/pkg/client/listers/eventing/v1alpha1"
)

const (
Expand Down Expand Up @@ -86,6 +87,8 @@
Prober prober.NewProber
Counter *counter.Counter
KafkaFeatureFlags *apisconfig.KafkaFeatureFlags

EventPolicyLister eventingv1alpha1listers.EventPolicyLister
}

func (r *Reconciler) ReconcileKind(ctx context.Context, broker *eventing.Broker) reconciler.Event {
Expand Down Expand Up @@ -297,6 +300,11 @@

broker.GetConditionSet().Manage(broker.GetStatus()).MarkTrue(base.ConditionAddressable)

err = auth.UpdateStatusWithEventPolicies(feature.FromContext(ctx), &broker.Status.AppliedEventPoliciesStatus, &broker.Status, r.EventPolicyLister, eventing.SchemeGroupVersion.WithKind("Broker"), broker.ObjectMeta)
if err != nil {
return fmt.Errorf("could not update broker status with EventPolicies: %v", err)

Check warning on line 305 in control-plane/pkg/reconciler/broker/broker.go

View check run for this annotation

Codecov / codecov/patch

control-plane/pkg/reconciler/broker/broker.go#L305

Added line #L305 was not covered by tests
}

return nil
}

Expand Down
Loading
Loading