fixing that triggers can actually have no filters...
@@ -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
}
@@ -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
