Skip to content

Commit

Permalink
Support testing ContainerSource with istio (knative#6790)
Browse files Browse the repository at this point in the history
Inject istio pod annotations when istio testing is enabled

Signed-off-by: Pierangelo Di Pilato <[email protected]>
  • Loading branch information
pierDipi authored Mar 6, 2023
1 parent a8128e6 commit 1ff36e1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/rekt/resources/containersource/containersource.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"time"

"k8s.io/apimachinery/pkg/runtime/schema"

"knative.dev/eventing/test/rekt/resources/source"

"knative.dev/reconciler-test/pkg/environment"
Expand Down Expand Up @@ -52,6 +53,10 @@ func Install(name string, opts ...manifest.CfgFn) feature.StepFn {
}

return func(ctx context.Context, t feature.T) {
if ic := environment.GetIstioConfig(ctx); ic.Enabled {
manifest.WithIstioPodAnnotations(cfg)
}

if err := registerImage(ctx); err != nil {
t.Fatal(err)
}
Expand Down
7 changes: 7 additions & 0 deletions test/rekt/resources/containersource/containersource.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ spec:
uri: {{ .sink.uri }}
{{ end }}
template:
{{ if .podannotations }}
metadata:
annotations:
{{ range $key, $value := .podannotations }}
{{ $key }}: {{ $value }}
{{ end }}
{{ end }}
spec:
containers:
- name: heartbeats
Expand Down

0 comments on commit 1ff36e1

Please sign in to comment.