Skip to content

Commit 6c42449

Browse files
committed
fix kn trigger list command to show correct v1/service sink output
1 parent 2e71451 commit 6c42449

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

pkg/kn/commands/flags/sink.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ func parseSink(sink string) (string, string, string) {
149149
// SinkToString prepares a sink for list output
150150
func SinkToString(sink duckv1.Destination) string {
151151
if sink.Ref != nil {
152-
if sink.Ref.Kind == "Service" {
152+
if sink.Ref.Kind == "Service" && sink.Ref.APIVersion == "serving.knative.dev/v1" {
153153
return fmt.Sprintf("ksvc:%s", sink.Ref.Name)
154154
} else {
155155
return fmt.Sprintf("%s:%s", strings.ToLower(sink.Ref.Kind), sink.Ref.Name)

pkg/kn/commands/flags/sink_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,13 @@ func TestSinkToString(t *testing.T) {
194194
Name: "default"}}
195195
expected = "broker:default"
196196
assert.Equal(t, expected, SinkToString(sink))
197+
sink = duckv1.Destination{
198+
Ref: &duckv1.KReference{Kind: "Service",
199+
APIVersion: "v1",
200+
Namespace: "my-namespace",
201+
Name: "mysvc"}}
202+
expected = "service:mysvc"
203+
assert.Equal(t, expected, SinkToString(sink))
197204

198205
uri := "http://target.example.com"
199206
targetExampleCom, err := apis.ParseURL(uri)

0 commit comments

Comments
 (0)