From f28333b21c953cb697b1f076337abb94181ad91a Mon Sep 17 00:00:00 2001 From: Marek Schmidt Date: Fri, 28 Jun 2024 10:13:57 +0200 Subject: [PATCH 1/2] backport trigger_tests_set_annotations_correctly_now patch --- ..._tests_set_annotations_correctly_now.patch | 54 +++++++++++++++++++ .../test/rekt/features/trigger/feature.go | 3 +- .../test/rekt/resources/trigger/trigger.go | 12 ++--- .../test/rekt/resources/trigger/trigger.yaml | 2 +- 4 files changed, 61 insertions(+), 10 deletions(-) create mode 100644 openshift/patches/trigger_tests_set_annotations_correctly_now.patch diff --git a/openshift/patches/trigger_tests_set_annotations_correctly_now.patch b/openshift/patches/trigger_tests_set_annotations_correctly_now.patch new file mode 100644 index 0000000000..45bbf00163 --- /dev/null +++ b/openshift/patches/trigger_tests_set_annotations_correctly_now.patch @@ -0,0 +1,54 @@ +diff --git a/vendor/knative.dev/eventing/test/rekt/features/trigger/feature.go b/vendor/knative.dev/eventing/test/rekt/features/trigger/feature.go +index 4896fd1c7..219e48535 100644 +--- a/vendor/knative.dev/eventing/test/rekt/features/trigger/feature.go ++++ b/vendor/knative.dev/eventing/test/rekt/features/trigger/feature.go +@@ -69,7 +69,8 @@ func TriggerDependencyAnnotation() *feature.Feature { + // Install the trigger + f.Setup("install trigger", trigger.Install(triggerName, brokerName, cfg...)) + +- f.Setup("trigger goes ready", trigger.IsReady(triggerName)) ++ // trigger won't go ready until after the pingsource exists, because of the dependency annotation ++ f.Requirement("trigger goes ready", trigger.IsReady(triggerName)) + + f.Requirement("install pingsource", func(ctx context.Context, t feature.T) { + brokeruri, err := broker.Address(ctx, brokerName) +diff --git a/vendor/knative.dev/eventing/test/rekt/resources/trigger/trigger.go b/vendor/knative.dev/eventing/test/rekt/resources/trigger/trigger.go +index dc59d58ba..e6ea82a71 100644 +--- a/vendor/knative.dev/eventing/test/rekt/resources/trigger/trigger.go ++++ b/vendor/knative.dev/eventing/test/rekt/resources/trigger/trigger.go +@@ -124,18 +124,14 @@ func WithSubscriberFromDestination(dest *duckv1.Destination) manifest.CfgFn { + // WithAnnotations adds annotations to the trigger + func WithAnnotations(annotations map[string]interface{}) manifest.CfgFn { + return func(cfg map[string]interface{}) { +- if _, set := cfg["ceOverrides"]; !set { +- cfg["ceOverrides"] = map[string]interface{}{} ++ if _, set := cfg["annotations"]; !set { ++ cfg["annotations"] = map[string]string{} + } +- ceOverrides := cfg["ceOverrides"].(map[string]interface{}) + + if annotations != nil { +- if _, set := ceOverrides["annotations"]; !set { +- ceOverrides["annotations"] = map[string]interface{}{} +- } +- ceExt := ceOverrides["annotations"].(map[string]interface{}) ++ annotation := cfg["annotations"].(map[string]string) + for k, v := range annotations { +- ceExt[k] = v ++ annotation[k] = v.(string) + } + } + } +diff --git a/vendor/knative.dev/eventing/test/rekt/resources/trigger/trigger.yaml b/vendor/knative.dev/eventing/test/rekt/resources/trigger/trigger.yaml +index 4521988db..77d02ad19 100644 +--- a/vendor/knative.dev/eventing/test/rekt/resources/trigger/trigger.yaml ++++ b/vendor/knative.dev/eventing/test/rekt/resources/trigger/trigger.yaml +@@ -20,7 +20,7 @@ metadata: + {{ if .annotations }} + annotations: + {{ range $key, $value := .annotations }} +- {{ $key }}: {{ $value }} ++ {{ $key }}: '{{ $value }}' + {{ end }} + {{ end }} + spec: diff --git a/vendor/knative.dev/eventing/test/rekt/features/trigger/feature.go b/vendor/knative.dev/eventing/test/rekt/features/trigger/feature.go index 4896fd1c7d..219e48535c 100644 --- a/vendor/knative.dev/eventing/test/rekt/features/trigger/feature.go +++ b/vendor/knative.dev/eventing/test/rekt/features/trigger/feature.go @@ -69,7 +69,8 @@ func TriggerDependencyAnnotation() *feature.Feature { // Install the trigger f.Setup("install trigger", trigger.Install(triggerName, brokerName, cfg...)) - f.Setup("trigger goes ready", trigger.IsReady(triggerName)) + // trigger won't go ready until after the pingsource exists, because of the dependency annotation + f.Requirement("trigger goes ready", trigger.IsReady(triggerName)) f.Requirement("install pingsource", func(ctx context.Context, t feature.T) { brokeruri, err := broker.Address(ctx, brokerName) diff --git a/vendor/knative.dev/eventing/test/rekt/resources/trigger/trigger.go b/vendor/knative.dev/eventing/test/rekt/resources/trigger/trigger.go index dc59d58ba6..e6ea82a71f 100644 --- a/vendor/knative.dev/eventing/test/rekt/resources/trigger/trigger.go +++ b/vendor/knative.dev/eventing/test/rekt/resources/trigger/trigger.go @@ -124,18 +124,14 @@ func WithSubscriberFromDestination(dest *duckv1.Destination) manifest.CfgFn { // WithAnnotations adds annotations to the trigger func WithAnnotations(annotations map[string]interface{}) manifest.CfgFn { return func(cfg map[string]interface{}) { - if _, set := cfg["ceOverrides"]; !set { - cfg["ceOverrides"] = map[string]interface{}{} + if _, set := cfg["annotations"]; !set { + cfg["annotations"] = map[string]string{} } - ceOverrides := cfg["ceOverrides"].(map[string]interface{}) if annotations != nil { - if _, set := ceOverrides["annotations"]; !set { - ceOverrides["annotations"] = map[string]interface{}{} - } - ceExt := ceOverrides["annotations"].(map[string]interface{}) + annotation := cfg["annotations"].(map[string]string) for k, v := range annotations { - ceExt[k] = v + annotation[k] = v.(string) } } } diff --git a/vendor/knative.dev/eventing/test/rekt/resources/trigger/trigger.yaml b/vendor/knative.dev/eventing/test/rekt/resources/trigger/trigger.yaml index 4521988db4..77d02ad190 100644 --- a/vendor/knative.dev/eventing/test/rekt/resources/trigger/trigger.yaml +++ b/vendor/knative.dev/eventing/test/rekt/resources/trigger/trigger.yaml @@ -20,7 +20,7 @@ metadata: {{ if .annotations }} annotations: {{ range $key, $value := .annotations }} - {{ $key }}: {{ $value }} + {{ $key }}: '{{ $value }}' {{ end }} {{ end }} spec: From a27610d83d9ebca68e09ce2fee1abb91e0e5b503 Mon Sep 17 00:00:00 2001 From: Marek Schmidt Date: Fri, 28 Jun 2024 10:31:33 +0200 Subject: [PATCH 2/2] add trigger_tests_set_annotations_correctly_now patch to generate-releae --- openshift/release/generate-release.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/openshift/release/generate-release.sh b/openshift/release/generate-release.sh index fdc7018b2d..b098fbd37e 100755 --- a/openshift/release/generate-release.sh +++ b/openshift/release/generate-release.sh @@ -6,6 +6,7 @@ source $(dirname $0)/resolve.sh GITHUB_ACTIONS=true $(dirname $0)/../../hack/update-codegen.sh git apply openshift/patches/refactor_newfilters.patch +git apply openshift/patches/trigger_tests_set_annotations_correctly_now.patch # Eventing core will bring the config tracing ConfigMap, so remove it from heret rm -f control-plane/config/eventing-kafka-broker/200-controller/100-config-tracing.yaml