From bc044cf098fcfc28ccd54d37b54c033d4cee4ba4 Mon Sep 17 00:00:00 2001 From: Tonia Elengikal Date: Tue, 2 Mar 2021 11:44:25 -0500 Subject: [PATCH 1/2] # This is a combination of 9 commits. # This is the 1st commit message: adding BUILT-IN SOURCE column for kn source list-types # The commit message #2 will be skipped: # changing list test to check for BUILT-IN SOURCE column # The commit message #3 will be skipped: # changing e2e source list test to check for BUILT-IN SOURCE column # The commit message #4 will be skipped: # adding CHANGELOG entry # The commit message #5 will be skipped: # kn source list-types: changing BUILT-IN SOURCE to BUILT-IN and moving DESCRIPTION column to the end # The commit message #6 will be skipped: # changing BUILT-IN SOURCE to BUILT-IN in changelog # The commit message #7 will be skipped: # Update CHANGELOG.adoc # # Co-authored-by: David Simansky # The commit message #8 will be skipped: # kn source list-types: changing column header to S, values to X, and moving to second column # The commit message #9 will be skipped: # fixing CHANGELOG merge conflict --- CHANGELOG.adoc | 8 ++++++++ pkg/kn/commands/source/human_readable_flags.go | 11 ++++++++++- pkg/kn/commands/source/list_test.go | 6 +++--- test/e2e/source_list_test.go | 2 +- 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index b36b5295e1..1f3828f3e9 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -21,6 +21,14 @@ | Update CRDs API version to `v1` | https://github.com/knative/client/issues/1248[#1248] +| 🐛 +| Fix kn export to always honor mode irrespective of revisions flag and have Export as the default mode +| https://github.com/knative/client/pull/1212[#1212] + +| 🎁 +| Add `BUILT-IN` column to `kn source list-types` +| https://github.com/knative/client/pull/1246[#1246] + |=== ## v0.21.0 (2021-02-23) diff --git a/pkg/kn/commands/source/human_readable_flags.go b/pkg/kn/commands/source/human_readable_flags.go index f511948abe..c86045cff6 100644 --- a/pkg/kn/commands/source/human_readable_flags.go +++ b/pkg/kn/commands/source/human_readable_flags.go @@ -37,10 +37,19 @@ var sourceTypeDescription = map[string]string{ "KafkaSource": "Route events from Apache Kafka Server to addressable", } +var sourceTypeSupported = map[string]string{ + "ApiServerSource": "X", + "SinkBinding": "X", + "PingSource": "X", + "ContainerSource": "X", + "KafkaSource": "", +} + // ListTypesHandlers handles printing human readable table for `kn source list-types` func ListTypesHandlers(h printers.PrintHandler) { sourceTypesColumnDefinitions := []metav1beta1.TableColumnDefinition{ {Name: "Type", Type: "string", Description: "Kind / Type of the source type", Priority: 1}, + {Name: "S", Type: "string", Description: "Supported source", Priority: 1}, {Name: "Name", Type: "string", Description: "Name of the source type", Priority: 1}, {Name: "Description", Type: "string", Description: "Description of the source type", Priority: 1}, } @@ -78,7 +87,7 @@ func printSourceTypes(sourceType unstructured.Unstructured, options printers.Pri row := metav1beta1.TableRow{ Object: runtime.RawExtension{Object: &sourceType}, } - row.Cells = append(row.Cells, kind, name, sourceTypeDescription[kind]) + row.Cells = append(row.Cells, kind, sourceTypeSupported[kind], name, sourceTypeDescription[kind]) return []metav1beta1.TableRow{row}, nil } diff --git a/pkg/kn/commands/source/list_test.go b/pkg/kn/commands/source/list_test.go index 3cf09dde4c..8eef8b99de 100644 --- a/pkg/kn/commands/source/list_test.go +++ b/pkg/kn/commands/source/list_test.go @@ -64,9 +64,9 @@ func TestSourceListTypes(t *testing.T) { newSourceCRDObjWithSpec("apiserversources", "sources.knative.dev", "v1alpha1", "ApiServerSource"), ) assert.NilError(t, err) - assert.Check(t, util.ContainsAll(output[0], "TYPE", "NAME", "DESCRIPTION")) - assert.Check(t, util.ContainsAll(output[1], "ApiServerSource", "apiserversources")) - assert.Check(t, util.ContainsAll(output[2], "PingSource", "pingsources")) + assert.Check(t, util.ContainsAll(output[0], "TYPE", "S", "NAME", "DESCRIPTION")) + assert.Check(t, util.ContainsAll(output[1], "ApiServerSource", "X", "apiserversources")) + assert.Check(t, util.ContainsAll(output[2], "PingSource", "X", "pingsources")) } func TestSourceListTypesNoHeaders(t *testing.T) { diff --git a/test/e2e/source_list_test.go b/test/e2e/source_list_test.go index af8c00d219..94473351fe 100644 --- a/test/e2e/source_list_test.go +++ b/test/e2e/source_list_test.go @@ -39,7 +39,7 @@ func TestSourceListTypes(t *testing.T) { t.Log("List available source types") output := sourceListTypes(r) - assert.Check(t, util.ContainsAll(output, "TYPE", "NAME", "DESCRIPTION", "Ping", "ApiServer")) + assert.Check(t, util.ContainsAll(output, "TYPE", "S", "NAME", "DESCRIPTION", "Ping", "ApiServer")) t.Log("List available source types in YAML format") From 2ae9576328aa28d15ca7f408aebb8539412e6576 Mon Sep 17 00:00:00 2001 From: Tonia Elengikal Date: Tue, 2 Mar 2021 11:44:25 -0500 Subject: [PATCH 2/2] adding BUILT-IN SOURCE column for kn source list-types --- CHANGELOG.adoc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 1f3828f3e9..f8aec4f613 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -26,8 +26,9 @@ | https://github.com/knative/client/pull/1212[#1212] | 🎁 -| Add `BUILT-IN` column to `kn source list-types` +| Add S column to specify built-in sources in kn source list-types | https://github.com/knative/client/pull/1246[#1246] +|=== |===