Skip to content

Commit bd9af0a

Browse files
mgencuropenshift-cherrypick-robot
authored andcommitted
Use GetServiceHostname when passing URL to JobSink (knative#8303)
This allows using Knative Service as the sink simply by adding an option to enviroment: eventshub.WithKnativeServiceForwarder
1 parent 18e69b6 commit bd9af0a

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

test/rekt/features/jobsink/jobsink.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import (
2929
"k8s.io/apimachinery/pkg/util/wait"
3030
"knative.dev/pkg/apis"
3131
kubeclient "knative.dev/pkg/client/injection/kube/client"
32+
"knative.dev/pkg/network"
3233
"knative.dev/reconciler-test/pkg/environment"
3334
"knative.dev/reconciler-test/pkg/eventshub"
3435
"knative.dev/reconciler-test/pkg/eventshub/assert"
@@ -49,13 +50,17 @@ func Success() *feature.Feature {
4950
jobSink := feature.MakeRandomK8sName("jobsink")
5051
source := feature.MakeRandomK8sName("source")
5152

52-
sinkURL := &apis.URL{Scheme: "http", Host: sink}
53-
5453
event := cetest.FullEvent()
5554
event.SetID(uuid.NewString())
5655

5756
f.Setup("install forwarder sink", eventshub.Install(sink, eventshub.StartReceiver))
58-
f.Setup("install job sink", jobsink.Install(jobSink, jobsink.WithForwarderJob(sinkURL.String())))
57+
f.Setup("install job sink", func(ctx context.Context, t feature.T) {
58+
sinkURL := &apis.URL{
59+
Scheme: "http",
60+
Host: network.GetServiceHostname(sink, environment.FromContext(ctx).Namespace()),
61+
}
62+
jobsink.Install(jobSink, jobsink.WithForwarderJob(sinkURL.String()))(ctx, t)
63+
})
5964

6065
f.Setup("jobsink is addressable", jobsink.IsAddressable(jobSink))
6166
f.Setup("jobsink is ready", jobsink.IsReady(jobSink))

0 commit comments

Comments
 (0)