Skip to content
Open
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
8 changes: 8 additions & 0 deletions generator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,16 @@ resources:
hooks:
delta_pre_compare:
code: customPreCompare(delta, a, b)
sdk_read_one_post_set_output:
template_path: hooks/eventsourcemapping/clean_destination_config.go.tpl
sdk_create_post_set_output:
template_path: hooks/eventsourcemapping/clean_destination_config.go.tpl
sdk_update_post_set_output:
template_path: hooks/eventsourcemapping/clean_destination_config.go.tpl
sdk_update_post_build_request:
template_path: hooks/eventsourcemapping/sdk_update_post_build_request.go.tpl
sdk_update_pre_build_request:
template_path: hooks/eventsourcemapping/sdk_update_pre_build_request.go.tpl
tags:
ignore: true
FunctionUrlConfig:
Expand Down
44 changes: 44 additions & 0 deletions pkg/resource/event_source_mapping/sdk.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions templates/hooks/eventsourcemapping/clean_destination_config.go.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
if ko.Spec.DestinationConfig != nil {
if ko.Spec.DestinationConfig.OnFailure != nil && ko.Spec.DestinationConfig.OnFailure.Destination == nil {
ko.Spec.DestinationConfig.OnFailure = nil
}
if ko.Spec.DestinationConfig.OnSuccess != nil && ko.Spec.DestinationConfig.OnSuccess.Destination == nil {
ko.Spec.DestinationConfig.OnSuccess = nil
}
if ko.Spec.DestinationConfig.OnFailure == nil && ko.Spec.DestinationConfig.OnSuccess == nil {
ko.Spec.DestinationConfig = nil
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
if desired.ko.Spec.DestinationConfig != nil {
if desired.ko.Spec.DestinationConfig.OnFailure != nil && desired.ko.Spec.DestinationConfig.OnFailure.Destination == nil {
desired.ko.Spec.DestinationConfig.OnFailure = nil
}
if desired.ko.Spec.DestinationConfig.OnSuccess != nil && desired.ko.Spec.DestinationConfig.OnSuccess.Destination == nil {
desired.ko.Spec.DestinationConfig.OnSuccess = nil
}
if desired.ko.Spec.DestinationConfig.OnFailure == nil && desired.ko.Spec.DestinationConfig.OnSuccess == nil {
desired.ko.Spec.DestinationConfig = nil
}
}