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

fixing that triggers can actually have no filters... #2696

Merged
Merged
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
9 changes: 7 additions & 2 deletions pkg/apis/eventing/v1alpha1/trigger_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,19 @@ func (source *Trigger) ConvertTo(ctx context.Context, obj apis.Convertible) erro
sink.Spec.Subscriber = source.Spec.Subscriber
if source.Spec.Filter != nil {
sink.Spec.Filter = &v1beta1.TriggerFilter{
Attributes: make(v1beta1.TriggerFilterAttributes, 0),
}
if source.Spec.Filter.Attributes != nil {
sink.Spec.Filter = &v1beta1.TriggerFilter{
Attributes: make(v1beta1.TriggerFilterAttributes, 0),
}
for k, v := range *source.Spec.Filter.Attributes {
sink.Spec.Filter.Attributes[k] = v
}
}
if source.Spec.Filter.DeprecatedSourceAndType != nil {
sink.Spec.Filter = &v1beta1.TriggerFilter{
Attributes: make(v1beta1.TriggerFilterAttributes, 0),
}
sink.Spec.Filter.Attributes["source"] = source.Spec.Filter.DeprecatedSourceAndType.Source
sink.Spec.Filter.Attributes["type"] = source.Spec.Filter.DeprecatedSourceAndType.Type
}
Expand All @@ -63,7 +68,7 @@ func (sink *Trigger) ConvertFrom(ctx context.Context, obj apis.Convertible) erro
sink.ObjectMeta = source.ObjectMeta
sink.Spec.Broker = source.Spec.Broker
sink.Spec.Subscriber = source.Spec.Subscriber
if source.Spec.Filter != nil {
if source.Spec.Filter != nil && source.Spec.Filter.Attributes != nil {
attributes := TriggerFilterAttributes{}
for k, v := range source.Spec.Filter.Attributes {
attributes[k] = v
Expand Down